Skip to content

Commit 321e158

Browse files
miniupnpd: add second CGNAT UCI option
As requested by AquanJSW, to test with Tailscale. Also adds the required daemon fix. No public IPv4 address detection; issues with multiple clients, e.g. PCP/NAT-PMP (proposed for inclusion, to merge with prior) Signed-off-by: Self-Hosting-Group <[email protected]>
1 parent cdd870f commit 321e158

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

net/miniupnpd/files/miniupnpd.init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ upnpd_generate_config() {
130130
[ "$allow_cgnat" = "1" ] && echo "ext_perform_stun=yes"
131131
[ "$allow_cgnat" = "allow-filtered" ] && echo "ext_perform_stun=allow-filtered"
132132
# Alternatively, as allow-filtered detects the public IPv4 required by multiple clients, e.g. PCP/NAT-PMP
133-
# [ "$allow_cgnat" = "allow-private-ext-ipv4" ] && external_ip=203.1.2.3
133+
[ "$allow_cgnat" = "allow-private-ext-ipv4" ] && echo "ext_allow_private_ipv4=yes"
134134
echo "ext_stun_host=${stun_host%%:*}"
135135
[ "${stun_host%%:*}" != "${stun_host##*:}" ] && echo "ext_stun_port=${stun_host##*:}"
136136
fi
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
From 9ff3c71bfb6c7f7bf525d6bda447387de7257aff Mon Sep 17 00:00:00 2001
2+
From: Vlad Starodubtsev <[email protected]>
3+
Date: Wed, 6 Aug 2025 19:04:18 +0300
4+
Subject: [PATCH] miniupnpd: fix ALLOWPRIVATEIPV4MASK condition
5+
6+
Fixed usage of private/reserved WAN addresses if they are allowed in the configuration.
7+
8+
--- a/upnpsoap.c
9+
+++ b/upnpsoap.c
10+
@@ -370,7 +370,7 @@ GetExternalIPAddress(struct upnphttp * h
11+
ext_if_name);
12+
ext_ip_addr[0] = '\0';
13+
} else if (addr_is_reserved(&addr)) {
14+
- if (!GETFLAG(ALLOWPRIVATEIPV4MASK)) {
15+
+ if (GETFLAG(ALLOWPRIVATEIPV4MASK)) {
16+
syslog(LOG_WARNING, "IGNORED : private/reserved address %s is not suitable for external IP", ext_ip_addr);
17+
} else {
18+
syslog(LOG_NOTICE, "private/reserved address %s is not suitable for external IP", ext_ip_addr);

0 commit comments

Comments
 (0)