packages icon indicating copy to clipboard operation
packages copied to clipboard

miniupnpd-nftables: produces multiple duplicate rules in upnp_prerouting and upnp_forward chains

Open bvasiliev opened this issue 4 years ago • 6 comments

Maintainer: @stintel @hnyman @tiagogaspar8 @jow- Environment: ath79/generic, OpenWrt 22.03.2 r19803-9a599fee93, kernel 5.10.146, package version 2022-08-31-68c8ec50-1

Description: miniupnpd with nftables and fw4 creates multiple duplicated rules in firewall chains for same pairs of hosts and ports. The number of duplicate rules increases over time.

For example:

        chain upnp_forward {
                iif "eth0.2" th dport 45738 @nh,128,32 0xa0a0a02 @nh,72,8 0x6 accept
                iif "eth0.2" th dport 45738 @nh,128,32 0xa0a0a02 @nh,72,8 0x11 accept
                iif "eth0.2" th dport 45738 @nh,128,32 0xa0a0a02 @nh,72,8 0x6 accept
                iif "eth0.2" th dport 45738 @nh,128,32 0xa0a0a02 @nh,72,8 0x11 accept
                iif "eth0.2" th dport 45738 @nh,128,32 0xa0a0a02 @nh,72,8 0x6 accept
				... skip about 200 lines
                iif "eth0.2" th dport 45738 @nh,128,32 0xa0a0a02 @nh,72,8 0x11 accept
                iif "eth0.2" th dport 12002 @nh,128,32 0xa0a0a02 @nh,72,8 0x6 accept
                iif "eth0.2" th dport 12002 @nh,128,32 0xa0a0a02 @nh,72,8 0x6 accept
        }

        chain upnp_prerouting {
                iif "eth0.2" @nh,72,8 0x6 th dport 45738 dnat ip to 192.168.0.2:45738
                iif "eth0.2" @nh,72,8 0x11 th dport 45738 dnat ip to 192.168.0.2:45738
                iif "eth0.2" @nh,72,8 0x6 th dport 45738 dnat ip to 192.168.0.2:45738
                iif "eth0.2" @nh,72,8 0x11 th dport 45738 dnat ip to 192.168.0.2:45738
                iif "eth0.2" @nh,72,8 0x6 th dport 45738 dnat ip to 192.168.0.2:45738
				... skip about 200 lines
                iif "eth0.2" @nh,72,8 0x11 th dport 45738 dnat ip to 192.168.0.2:45738
                iif "eth0.2" @nh,72,8 0x6 th dport 20373 dnat ip to 192.168.0.2:12002
                iif "eth0.2" @nh,72,8 0x6 th dport 53634 dnat ip to 192.168.0.2:12002
        }

bvasiliev avatar Oct 20 '22 05:10 bvasiliev

Upstream issue: miniupnp/miniupnp#582

bvasiliev avatar Oct 20 '22 06:10 bvasiliev

Recently released version 2.3.2 of miniupnpd fix the problem.

nms42 avatar Jan 25 '23 11:01 nms42

This issue was reported for 22.03 so the Fixes: tag in master is not entirely correct. I will do a PR cherry-picking the bump to 22.03, but as I don't run 22.03 anywhere, someone else shall have to runtime test this before it can be merged.

stintel avatar Mar 10 '23 01:03 stintel

still present

comio avatar Jun 13 '25 15:06 comio

still present

Which package version on which OpenWrt version?

Self-Hosting-Group avatar Jul 14 '25 12:07 Self-Hosting-Group

miniupnpd-nftables 2.3.7-r1 on OpenWrt 24.10.2 leaks entries in the upnp_forward chain. Rules are not removed from it, but they are from the upnp_prerouting chain. This happens both with PMP and UPnP.

This appears to be a similar but different issue because previously both chains leaked, now only one leaks and they become inconsistent.

yesbox avatar Sep 13 '25 08:09 yesbox