Date: Fri, 17 Oct 2008 09:10:17 +0200 From: "Frank Behrens" <frank@harz.behrens.de> To: freebsd-java@freebsd.org Subject: Re: Java and IPv6 on BSD - it does not work well Message-ID: <200810170710.m9H7AHkx080704@post.behrens.de> In-Reply-To: <200810162241.54070.kurt@intricatesoftware.com> References: <200810141641.m9EGf4QG029110@post.behrens.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Kurt Miller <kurt@intricatesoftware.com> wrote on 16 Oct 2008 22:41: > The networking support in the BSD port is based on the linux/solaris > code. When compiled with IPv6 support enabled the JDK uses only IPv6 > sockets and relies on IPv4 to IPv6 address mapping. For security > reasons all BSD's have v4mapped addresses turned off by default. If > you want both IPv6 and IPv4 support in the jdk on FreeBSD you must > 1) compile the JDK with IPv6 support, 2) change the > net.inet6.ip6.v6only sysctl to 0 using sysctl or via /etc/sysctl.conf, > and 3) Use only IPv6 addresses and special addresses as described in: I agree and 3) is the main problem. You can only use the special addresses. > What really needs to happen is to port the Windows approach in > the JVM to BSD. On Windows two sockets are created per ServerSocket; > one for IPV6 and another for IPv4. This avoids the need to use We should distinguish between two use caes: a) I want to use the "transparent and automatic" IPv6 support in Java. That means I create one server socket and want to be able to receive IPv4 and IPv6 packets. That works in Java for INADDR_ANY and IPV6_V6ONLY=0. For other addresses and/or IPV6_V6ONLY=1 you need two server sockets (Windows approach). BTW: It was not a surprise for me to see problems with a), it is a special case. b) I want to listen with a socket to a specific IPv6 address and with another socket to a specific IPv4 address. A special case? Not for other programming languages. In this case the Java runtime creates always an IPv6 socket and later tries to bind with an IPv4 or IPv6 address - of course it will fail for IPv4. Here the solution should be: At first determine the address type and create later the socket with right address family. I wonder, that I did not find error reports about this issue. Did nobody discover, that listening to "localhost" does not work on an IPv6 enabled system? -- Frank Behrens, Osterwieck, Germany PGP-key 0x5B7C47ED on public servers available.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810170710.m9H7AHkx080704>