mimugmail / opn-repo

OPNsense repo by mimugmail
Other
358 stars 27 forks source link

IPv6 binding for unifi plugin #196

Closed hslabbert closed 8 months ago

hslabbert commented 9 months ago

g'day

I'm running a test single stack network (dns64/nat64-enabled), and noticed that the unifi controller web app only binds on IPv4. After poking around a bit, it looks like this can be tweaked to both v4 and v6 with a slight tweak in the unifi rc file, 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 \

That seems to permit the application to do a tcp46 bind and respond on IPv6 addresses. It's a little bit weird as the docs suggest that the default value for the java.net.preferIPv4Stack flag should be false, but it does seem to change the behaviour here.

Is that something that can be included in the plugin?

mimugmail commented 9 months ago

This needs to be added to FreeBSD port. Can you post this to their bugzilla so the maintainer can add it?

hslabbert commented 9 months ago

Will do, thx

hslabbert commented 8 months ago

Submitted to FreeBSD bugzilla at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276213