[Bug 282251] java/openjdk22: IPv6 / INET6 is broken
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 282251] java/openjdk22: IPv6 / INET6 is broken"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 21 Nov 2024 20:56:24 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282251 --- Comment #3 from antonfb@hesiod.org --- I stand by my comment. I put your code into a class with imports etc. This is java22 seine.hesiod.org:anton[1]: java -version openjdk version "22.0.2" 2024-07-16 OpenJDK Runtime Environment (build 22.0.2+9-1) OpenJDK 64-Bit Server VM (build 22.0.2+9-1, mixed mode, sharing) First run (without preferipv4stack=false): seine.hesiod.org:anton[11]: java bugtest Connected Socket[addr=seine.hesiod.org/192.168.2.3,port=46994,localport=21181] to Socket[addr=/192.168.2.3,port=21181,localport=46994] Connected Socket[addr=/127.0.0.1,port=57640,localport=10314] to Socket[addr=/127.0.0.1,port=10314,localport=57640] Failed to connect to localhost with INET6 java.net.SocketException: Protocol family unavailable at java.base/sun.nio.ch.Net.bind0(Native Method) at java.base/sun.nio.ch.Net.bind(Net.java:565) at java.base/sun.nio.ch.Net.bind(Net.java:554) at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:636) at java.base/java.net.ServerSocket.bind(ServerSocket.java:390) at java.base/java.net.ServerSocket.<init>(ServerSocket.java:277) at bugtest.main(bugtest.java:47) Second run (with java flag): seine.hesiod.org:anton[12]: java -Djava.net.preferIPv4Stack=false bugtest Failed to connect to localhost with unspecified protocol java.net.SocketException: Invalid argument at java.base/sun.nio.ch.Net.connect0(Native Method) at java.base/sun.nio.ch.Net.connect(Net.java:589) at java.base/sun.nio.ch.Net.connect(Net.java:578) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:583) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:752) at java.base/java.net.Socket.connect(Socket.java:687) at java.base/java.net.Socket.<init>(Socket.java:556) at java.base/java.net.Socket.<init>(Socket.java:357) at bugtest.main(bugtest.java:14) Failed to connect to localhost with INET java.net.BindException: Can't assign requested address at java.base/sun.nio.ch.Net.bind0(Native Method) at java.base/sun.nio.ch.Net.bind(Net.java:565) at java.base/sun.nio.ch.Net.bind(Net.java:554) at java.base/sun.nio.ch.NioSocketImpl.bind(NioSocketImpl.java:636) at java.base/java.net.ServerSocket.bind(ServerSocket.java:390) at java.base/java.net.ServerSocket.<init>(ServerSocket.java:277) at bugtest.main(bugtest.java:30) Failed to connect to localhost with INET6 java.net.SocketException: Invalid argument at java.base/sun.nio.ch.Net.connect0(Native Method) at java.base/sun.nio.ch.Net.connect(Net.java:589) at java.base/sun.nio.ch.Net.connect(Net.java:578) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:583) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:752) at java.base/java.net.Socket.connect(Socket.java:687) at java.base/java.net.Socket.<init>(Socket.java:556) at java.base/java.net.Socket.<init>(Socket.java:357) at bugtest.main(bugtest.java:48) Third run (with flag & sysctl net.inet6.ip6.v6only=0) seine.hesiod.org:anton[13]: java -Djava.net.preferIPv4Stack=false bugtest Connected Socket[addr=seine.hesiod.org/192.168.2.3,port=46531,localport=13926] to Socket[addr=/192.168.2.3,port=13926,localport=46531] Connected Socket[addr=/127.0.0.1,port=63268,localport=33512] to Socket[addr=/127.0.0.1,port=33512,localport=63268] Connected Socket[addr=seine.hesiod.org/192.168.2.3,port=53154,localport=63501] to Socket[addr=/192.168.2.3,port=63501,localport=53154] So as I wrote five years ago the jdk was intentionally broken WRT ipv6. To make it work, you must pass the -Djava.net.preferIPv4Stack=false to your java vm AND change the global sysctl net.inet6.ip6.v6only=0 If you want to unbreak this I'm not certain what to do. I would like to see this fixed and ipv6 cleanly supported without having to set the system wide level setting. I don't think the code fix is the problem. The problem will be that the maintainers do not want this fixed. -- You are receiving this mail because: You are the assignee for the bug.