Bug 276213 - net-mgmt/unifi7: explicitly disable preferIPv4Stack
Summary: net-mgmt/unifi7: explicitly disable preferIPv4Stack
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Juraj Lutter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-09 04:58 UTC by Hugo Slabbert
Modified: 2024-01-12 14:03 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Slabbert 2024-01-09 04:58:23 UTC
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 \
Comment 1 Mina Galić freebsd_triage 2024-01-09 07:58:28 UTC
^Triage: rename correctly and assign to maintainer
Comment 2 Juraj Lutter freebsd_committer freebsd_triage 2024-01-09 12:36:23 UTC
I will do this change for net-mgmt/unifi8, as unifi7 is slated for expiration soon.
Comment 3 Hugo Slabbert 2024-01-09 15:14:31 UTC
Much appreciated, thank you.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-01-12 12:15:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=00d2fcdaab14b18f2a4e132f7a7557c84c704061

commit 00d2fcdaab14b18f2a4e132f7a7557c84c704061
Author:     Juraj Lutter <otis@FreeBSD.org>
AuthorDate: 2024-01-12 12:03:04 +0000
Commit:     Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2024-01-12 12:13:00 +0000

    net-mgmt/unifi8: Allow binding to both INET and INET6 addresses

    PR:             276213

 net-mgmt/unifi8/Makefile       | 1 +
 net-mgmt/unifi8/files/unifi.in | 1 +
 2 files changed, 2 insertions(+)
Comment 5 Juraj Lutter freebsd_committer freebsd_triage 2024-01-12 14:03:57 UTC
Committed, thanks.