[Bug 282251] java/openjdk22: IPv6 / INET6 is broken

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 21 Oct 2024 15:38:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282251

            Bug ID: 282251
           Summary: java/openjdk22: IPv6 / INET6 is broken
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: java@FreeBSD.org
          Reporter: freebsd.68fba@nospam.spacesurfer.com
             Flags: maintainer-feedback?(java@FreeBSD.org)
          Assignee: java@FreeBSD.org

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();
}

-- 
You are receiving this mail because:
You are the assignee for the bug.