maintainer-feedback requested: [Bug 282251] java/openjdk22: IPv6 / INET6 is broken

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 21 Oct 2024 15:38:12 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-java (Nobody)
<java@FreeBSD.org> for maintainer-feedback:
Bug 282251: java/openjdk22: IPv6 / INET6 is broken
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282251



--- Description ---
In java/openjdk22 IPv6 is broken, in java/openjdk17 it was working. I did not
try any openjdk's in between.

To be more specific in openjdk17 started with default settings, INET6 doesn't
work. However with -Djava.net.preferIPv4Stack=false INET, INET6 and unspecified
protocols all work.

In openjdk22 started with default settings, INET6 doesn't work. With
-Djava.net.preferIPv4Stack=false no internet protocols work.

These issues can be reproduced with the java code

// Test unspecified protocol
try {
	ServerSocket ss = new ServerSocket(0);
	Socket cs = new Socket(ss.getInetAddress(), ss.getLocalPort());
	OutputStream os = cs.getOutputStream();
	InputStream is = cs.getInputStream();
	Socket as = ss.accept();
	System.out.println("Connected " + cs + " to " + as);
	ss.close();
	cs.close();
	as.close();
} catch (IOException ex) {
	System.err.println("Failed to connect to localhost with unspecified
protocol");
	ex.printStackTrace();
}

// Test INET (IPv6)
try {
	InetAddress addr = InetAddress.getByName("127.0.0.1");
	ServerSocket ss = new ServerSocket(0, 1, addr);
	Socket cs = new Socket(ss.getInetAddress(), ss.getLocalPort());
	OutputStream os = cs.getOutputStream();
	InputStream is = cs.getInputStream();
	Socket as = ss.accept();
	System.out.println("Connected " + cs + " to " + as);
	ss.close();
	cs.close();
	as.close();
} catch (IOException ex) {
	System.err.println("Failed to connect to localhost with INET");
	ex.printStackTrace();
}

// Test INET6
try {
	InetAddress addr = InetAddress.getByName("::0");
	ServerSocket ss = new ServerSocket(0, 1, addr);
	Socket cs = new Socket(ss.getInetAddress(), ss.getLocalPort());
	OutputStream os = cs.getOutputStream();
	InputStream is = cs.getInputStream();
	Socket as = ss.accept();
	System.out.println("Connected " + cs + " to " + as);
	ss.close();
	cs.close();
	as.close();
} catch (IOException ex) {
	System.err.println("Failed to connect to localhost with INET6");
	ex.printStackTrace();
}