Date: Thu, 19 Sep 2002 12:10:54 +0900 From: JINMEI Tatuya / =?ISO-2022-JP?B?GyRCP0BMQEMjOkgbKEI=?= <jinmei@isl.rdc.toshiba.co.jp> To: Trish Lynch <trish@bsdunix.net> Cc: <freebsd-net@FreeBSD.ORG>, <freebsd-current@FreeBSD.ORG> Subject: Re: ipv4 in ipv6 issue solved Message-ID: <y7velbqk729.wl@ocean.jinmei.org> In-Reply-To: <20020918214345.O458-100000@femme.sapphite.org> References: <20020918214345.O458-100000@femme.sapphite.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On Wed, 18 Sep 2002 21:44:33 -0400 (EDT), >>>>> Trish Lynch <trish@bsdunix.net> 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-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?y7velbqk729.wl>