From owner-freebsd-current Wed Sep 18 20:11:32 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A14D737B401; Wed, 18 Sep 2002 20:11:30 -0700 (PDT) Received: from shuttle.wide.toshiba.co.jp (shuttle.wide.toshiba.co.jp [202.249.10.124]) by mx1.FreeBSD.org (Postfix) with ESMTP id 621D243E65; Wed, 18 Sep 2002 20:11:29 -0700 (PDT) (envelope-from jinmei@isl.rdc.toshiba.co.jp) Received: from localhost ([3ffe:501:4819:2000:1c30:4bd3:50b6:c139]) by shuttle.wide.toshiba.co.jp (8.11.6/8.9.1) with ESMTP id g8J3ASt49324; Thu, 19 Sep 2002 12:10:28 +0900 (JST) Date: Thu, 19 Sep 2002 12:10:54 +0900 Message-ID: From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= To: Trish Lynch Cc: , Subject: Re: ipv4 in ipv6 issue solved In-Reply-To: <20020918214345.O458-100000@femme.sapphite.org> References: <20020918214345.O458-100000@femme.sapphite.org> User-Agent: Wanderlust/2.6.1 (Upside Down) Emacs/21.2 Mule/5.0 (SAKAKI) Organization: Research & Development Center, Toshiba Corp., Kawasaki, Japan. MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Dispatcher: imput version 20000228(IM140) Lines: 47 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >>>>> On Wed, 18 Sep 2002 21:44:33 -0400 (EDT), >>>>> Trish Lynch said: > sysctl net.inet6.ip6.v6only=0 This should also work: *** foo.c.orig Thu Sep 19 12:05:04 2002 --- foo.c Thu Sep 19 12:05:56 2002 *************** *** 14,19 **** --- 14,20 ---- struct sockaddr_in6 addr; struct hostent *hostinfo; int sock; + int off; memset(&addr, 0, sizeof(struct sockaddr_in6)); *************** *** 30,35 **** --- 31,40 ---- addr.sin6_port = htons((u_short)5555); sock = socket(AF_INET6, SOCK_STREAM, 0); + #ifdef IPV6_V6ONLY + off = 0; + setsockopt(sock, IPPROTO_IPV6, &off, sizeof(off)); + #endif bind(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in6)); listen(sock, 5); I'd recommend this approach rather than to use sysctl, particularly for new applications built from the scratch, because we can control the policy per-socket basis. You may have to note that draft-ietf-ipngwg-rfc2553bis-06.txt specifies 0 as the default value of the option while FreeBSD does not follow the specification. Even though the clear specification, there is a certain amount of stack developers who have a different opinion on this and intentionally reverse the default. So, the safest way is to set the value explicitly. JINMEI, Tatuya Communication Platform Lab. Corporate R&D Center, Toshiba Corp. jinmei@isl.rdc.toshiba.co.jp To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message