git: bad9dded1f1a - main - net-p2p/prowlarr: tell .NET to disable ipv6 when system has not configured it

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Sun, 26 Dec 2021 02:10:24 UTC
The branch main has been updated by tagattie:

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

commit bad9dded1f1a65e48975b4f45f114c788d801fc5
Author:     Michiel van Baak <michiel@vanbaak.eu>
AuthorDate: 2021-12-26 02:08:13 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2021-12-26 02:08:13 +0000

    net-p2p/prowlarr: tell .NET to disable ipv6 when system has not configured it
    
    As stated in
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259194#c17
    .NET 6+ uses dual mode sockets to avoid the separate AF handling.
    
    This breaks on systems (jails) where ipv6 is not enabled. This patch
    detects this on prowlarr starts and disables .NET ipv6 support if no
    ipv6 is configured.
    
    PR:             260645
    Reported by:    Michiel van Baak <michiel@vanbaak.eu> (maintainer)
---
 net-p2p/prowlarr/Makefile          | 1 +
 net-p2p/prowlarr/files/prowlarr.in | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/net-p2p/prowlarr/Makefile b/net-p2p/prowlarr/Makefile
index d50d01787699..8847845fc052 100644
--- a/net-p2p/prowlarr/Makefile
+++ b/net-p2p/prowlarr/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	prowlarr
 PORTVERSION=	0.1.8.1231
+PORTREVISION=	1
 CATEGORIES=	net-p2p
 MASTER_SITES=	https://github.com/Prowlarr/Prowlarr/releases/download/v${PORTVERSION}/
 DISTNAME=	Prowlarr.develop.${PORTVERSION}.freebsd-core-x64
diff --git a/net-p2p/prowlarr/files/prowlarr.in b/net-p2p/prowlarr/files/prowlarr.in
index db8c50e169dd..43e5bac3b626 100644
--- a/net-p2p/prowlarr/files/prowlarr.in
+++ b/net-p2p/prowlarr/files/prowlarr.in
@@ -40,6 +40,14 @@ start_precmd=${name}_precmd
         install -d -o ${%%PORTNAME%%_user} -g ${%%PORTNAME%%_group} ${%%PORTNAME%%_pid_dir}
     fi
 
+    # .NET 6+ use dual mode sockets to avoid the separate AF handling.
+    # disable .NET use of V6 if no ipv6 is configured.
+    # See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259194#c17
+    ifconfig | grep -q inet6
+    if [ $? == 1 ]; then
+        export DOTNET_SYSTEM_NET_DISABLEIPV6=1
+    fi
+
     chown -R ${%%PORTNAME%%_user}:${%%PORTNAME%%_group} ${%%PORTNAME%%_exec_dir}
 
     rc_flags="-r -f -p ${pidfile_child} -P ${pidfile} ${%%PORTNAME%%_exec_dir}/Prowlarr --data=${%%PORTNAME%%_data_dir} --nobrowser >> /dev/null 2>&1 ${rc_flags}"