From 107f3376b5114cd17c115e25026b031bd439e9be Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 19 Jul 2021 13:55:52 +0200 Subject: [PATCH] Revert "net/miniupnpd: ext_ip_reserved_ignore support" This patch is causing several issues [1], which then were reported to upstream [2] and it was not accepted by upstream [3]. This results that nobody maintain this custom patch and it is not useful as it is changing addr_is_reserved behavior. [1] https://github.com/openwrt/packages/issues/15258 [2] https://github.com/miniupnp/miniupnp/issues/542 [3] https://github.com/miniupnp/miniupnp/pull/511 This reverts commit b76aa9919489f49b472a8f939f6d46ca33d05f64. Signed-off-by: Josef Schlehofer --- net/miniupnpd/Makefile | 2 +- net/miniupnpd/files/miniupnpd.init | 3 - .../patches/301-ext_ip_reserved_ignore.patch | 110 ------------------ 3 files changed, 1 insertion(+), 114 deletions(-) delete mode 100644 net/miniupnpd/patches/301-ext_ip_reserved_ignore.patch diff --git a/net/miniupnpd/Makefile b/net/miniupnpd/Makefile index c6152648e..519e15152 100644 --- a/net/miniupnpd/Makefile +++ b/net/miniupnpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=miniupnpd PKG_VERSION:=2.2.2 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL:=https://miniupnp.tuxfamily.org/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/net/miniupnpd/files/miniupnpd.init b/net/miniupnpd/files/miniupnpd.init index a37c5e8a7..cc13e0440 100644 --- a/net/miniupnpd/files/miniupnpd.init +++ b/net/miniupnpd/files/miniupnpd.init @@ -62,7 +62,6 @@ upnpd() { local use_stun stun_host stun_port uuid notify_interval presentation_url local upnp_lease_file clean_ruleset_threshold clean_ruleset_interval local ipv6_disable - local ext_ip_reserved_ignore local enabled config_get_bool enabled config enabled 1 @@ -90,7 +89,6 @@ upnpd() { config_get clean_ruleset_threshold config clean_ruleset_threshold config_get clean_ruleset_interval config clean_ruleset_interval config_get ipv6_disable config ipv6_disable 0 - config_get ext_ip_reserved_ignore config ext_ip_reserved_ignore 0 local conf ifname ifname6 @@ -143,7 +141,6 @@ upnpd() { upnpd_write_bool igdv1 0 force_igd_desc_v1 upnpd_write_bool use_stun 0 ext_perform_stun upnpd_write_bool ipv6_disable $ipv6_disable - upnpd_write_bool ext_ip_reserved_ignore $ext_ip_reserved_ignore [ "$use_stun" -eq 0 ] || { [ -n "$stun_host" ] && echo "ext_stun_host=$stun_host" diff --git a/net/miniupnpd/patches/301-ext_ip_reserved_ignore.patch b/net/miniupnpd/patches/301-ext_ip_reserved_ignore.patch deleted file mode 100644 index 5ec145e71..000000000 --- a/net/miniupnpd/patches/301-ext_ip_reserved_ignore.patch +++ /dev/null @@ -1,110 +0,0 @@ -commit cb046cfef1d6b954d3fc09f09a1fc3a7ffeb7593 -Author: Chen Minqiang -Date: Sun Jul 5 10:42:52 2020 +0800 - - options: ext_ip_reserved_ignore support - - This make the port forwarding force to work even - when the router is behind NAT - - Signed-off-by: Chen Minqiang - ---- a/getifaddr.c -+++ b/getifaddr.c -@@ -25,6 +25,7 @@ - #if defined(USE_GETIFADDRS) || defined(ENABLE_IPV6) || defined(ENABLE_PCP) - #include - #endif -+#include "upnpglobalvars.h" - - int - getifaddr(const char * ifname, char * buf, int len, -@@ -295,6 +296,11 @@ addr_is_reserved(struct in_addr * addr) - uint32_t address = ntohl(addr->s_addr); - size_t i; - -+ if(GETFLAG(EXTIPRESERVEDIGNOREMASK)) { -+ syslog(LOG_NOTICE, "private/reserved address checking is ignored"); -+ return 0; -+ } -+ - for (i = 0; i < sizeof(reserved)/sizeof(reserved[0]); ++i) { - if ((address >> reserved[i].rmask) == (reserved[i].address >> reserved[i].rmask)) - return 1; ---- a/miniupnpd.c -+++ b/miniupnpd.c -@@ -1241,6 +1241,10 @@ init(int argc, char * * argv, struct run - case UPNPEXT_IP: - use_ext_ip_addr = ary_options[i].value; - break; -+ case UPNPEXT_IP_RESERVED_IGNORE: -+ if(strcmp(ary_options[i].value, "yes") == 0) -+ SETFLAG(EXTIPRESERVEDIGNOREMASK); -+ break; - case UPNPEXT_PERFORM_STUN: - if(strcmp(ary_options[i].value, "yes") == 0) - SETFLAG(PERFORMSTUNMASK); ---- a/miniupnpd.conf -+++ b/miniupnpd.conf -@@ -9,6 +9,8 @@ - # Setting ext_ip is also useful in double NAT setup, you can declare here - # the public IP address. - #ext_ip= -+#ignore even if ext_ip is reserved: default is no -+#ext_ip_reserved_ignore=yes - # WAN interface must have public IP address. Otherwise it is behind NAT - # and port forwarding is impossible. In some cases WAN interface can be - # behind unrestricted full-cone NAT 1:1 when all incoming traffic is NAT-ed and ---- a/options.c -+++ b/options.c -@@ -34,6 +34,7 @@ static const struct { - { UPNPEXT_IFNAME6, "ext_ifname6" }, - #endif - { UPNPEXT_IP, "ext_ip" }, -+ { UPNPEXT_IP_RESERVED_IGNORE, "ext_ip_reserved_ignore" }, - { UPNPEXT_PERFORM_STUN, "ext_perform_stun" }, - { UPNPEXT_STUN_HOST, "ext_stun_host" }, - { UPNPEXT_STUN_PORT, "ext_stun_port" }, ---- a/options.h -+++ b/options.h -@@ -21,6 +21,7 @@ enum upnpconfigoptions { - UPNPEXT_IFNAME6, /* ext_ifname6 */ - #endif - UPNPEXT_IP, /* ext_ip */ -+ UPNPEXT_IP_RESERVED_IGNORE, /* ignore if ext_ip is reserved */ - UPNPEXT_PERFORM_STUN, /* ext_perform_stun */ - UPNPEXT_STUN_HOST, /* ext_stun_host */ - UPNPEXT_STUN_PORT, /* ext_stun_port */ ---- a/testgetifaddr.c -+++ b/testgetifaddr.c -@@ -13,6 +13,8 @@ - #include "config.h" - #include "getifaddr.h" - -+int runtime_flags = 0; -+ - #if defined(__sun) - /* solaris 10 does not define LOG_PERROR */ - #define LOG_PERROR 0 ---- a/testportinuse.c -+++ b/testportinuse.c -@@ -14,6 +14,8 @@ - #include "config.h" - #include "portinuse.h" - -+int runtime_flags = 0; -+ - int main(int argc, char * * argv) - { - #ifndef CHECK_PORTINUSE ---- a/upnpglobalvars.h -+++ b/upnpglobalvars.h -@@ -84,6 +84,8 @@ extern int runtime_flags; - - #define PERFORMSTUNMASK 0x1000 - -+#define EXTIPRESERVEDIGNOREMASK 0x2000 -+ - #define SETFLAG(mask) runtime_flags |= mask - #define GETFLAG(mask) (runtime_flags & mask) - #define CLEARFLAG(mask) runtime_flags &= ~mask