[Bug 276213] net-mgt/unifi7: explicitly disable preferIPv4Stack

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 09 Jan 2024 04:58:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276213

            Bug ID: 276213
           Summary: net-mgt/unifi7: explicitly disable preferIPv4Stack
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: hugo@slabnet.com

I'm running unifi7 on an opnsense 23.7.11 box, based on FreeBSD 13.2 with
unifi7 version 7.5.187_1.

The system is fully dual stack, but out of the box the java processes for the
unifi7 application (web UI and such) appear to bind only to IPv4.

I've confirmed that explicitly toggling java.net.preferIPv4Stack in
/usr/local/etc/rc.d/unifi to 'false' permits the application to bind to both v4
and v6 (tcp46 bind). The java docs at
https://docs.oracle.com/javase%2F7%2Fdocs%2Fapi%2F%2F/java/net/doc-files/net-properties.html
indicate that this setting *should* be 'false' by default, but in an
out-of-the-box setup it definitely was only listening on v4 for me.

I don't have another system to validate this on at the moment, but if it *is*
binding on v4 by default, could we toss an explicit
'-Djava.net.preferIPv4Stack=false' in the rc script to permit a dual AF bind by
default?

e.g.:

$ diff -u unifi unifi_afbind
--- unifi       2024-01-07 18:27:14
+++ unifi_afbind        2024-01-07 18:27:07
@@ -46,6 +46,7 @@
 : ${unifi_chdir=/usr/local/share/java/unifi}
 : ${unifi_java_home=/usr/local/openjdk17}
 : ${unifi_javaflags="-Djava.awt.headless=true -Xmx1024M \
+       -Djava.net.preferIPv4Stack=false \
        --add-opens java.base/java.lang=ALL-UNNAMED \
        --add-opens java.base/java.time=ALL-UNNAMED \
        --add-opens java.base/sun.security.util=ALL-UNNAMED \

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