-
Notifications
You must be signed in to change notification settings - Fork 3.7k
miniupnpd: 24.10 daemon fix, build updates, revised UCI and config-gen #24988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
miniupnpd: 24.10 daemon fix, build updates, revised UCI and config-gen #24988
Conversation
618ed1f to
6da251a
Compare
|
@Self-Hosting-Group: Nice PR! cc: @systemcrash |
6da251a to
173ee62
Compare
cfbf68e to
cb7a02d
Compare
cc180f0 to
86f6935
Compare
upnpd UCI configuration options and defaultsupnpd UCI config options
|
A downgrade included in a patchset won't get accepted, since a downgrade may subtly reintroducing bugs for existing users, if we assume that point releases fix bugs only. Better to wait for a new release, and bump to that version. Migrations are probably a more serious matter: those must be carried basically 'forever'. The best way is simply to avoid those. One might introduce a new setting, and deprecate the old one, and change the UI over to use the new one. Still a bit of a bumpy road. I think personally this is minor in the grand scheme of things (rather unimportant settings), but other reviewers may take a much firmer stance on it since you are, after all, changing setting names. |
Acceptable. It just breaks compile at the next release bump when it no longer applies. Minor, I guess. |
86f6935 to
124dd12
Compare
|
Every single test-build failed: Dirty patches detected, please refresh and review the diff |
6eaafdb to
50eda40
Compare
in openwrt/packages#24988 Signed-off-by: Self-Hosting-Group <[email protected]>
in openwrt/packages#24988 Signed-off-by: Self-Hosting-Group <[email protected]>
Arrange `start_service` and main init functions first (to merge with prior) Signed-off-by: Self-Hosting-Group <[email protected]>
fe42ffe to
5ca92d9
Compare
|
Hello @BKPepe. Now, no new pushes to this repository, package works well! Finally, some code was moved and now I think is the right time to review the following commits. ;-) The mirror issues are addressed by using the official GitHub releases, see below. And thanks for your comments. packages/net/miniupnpd/Makefile Line 14 in 5ca92d9
In my eyes, everything fits, and I don't see anything else that needs to be done.
Yes, this commit was intended for cherry-picking, as were the two LuCI commits, as preparation to display a message to update in the event of an unsuitable config file being found, and get prepared for the section change. These commits have no dependencies. Daemon PR:
(The commits in bold were for cherry-picking, and those in italics were intended to be merged with the previous commit.) This PR has now implemented all the functions, from my point of view. The following LuCI screenshots are provided to help you understand the new/extended network-wide access control functionality during the review process. Thanks to the universal implementation of the The new network-wide access control functionality can best be described using the LuCI screenshots: |
|
Hello @BKPepe. Please review the following commits. UPnP IGD daemon compatibility patch added. An |
|
Hello @systemcrash.
This would help me a lot to continue working on OPNsense and to complete the PR there next week. I also think that some standardisation between new introduced options in the router OSs makes sense. |
|
@BKPepe As you can see, the rate of change has slowed down. This time, only a few of the UCI option names were shortened, with no code changes. No bugs have been found for months! |
|
PR description updated |
|
Hello @Rondom @kilroy98 @AquanJSW @Neustradamus You all responded positively to my PR description. I think it will increase the reviewer's confidence if not only I have tested the new, revised daemon and LuCI packages in practice, but also if you find the new functionality useful for your user cases. If you do not have an OpenWrt build environment for creating the new packages, I can compile them for easy installation if you wish. To do this, I need the router's |
|
Just compiled and tested on my machine, it seems to be working fine. |
|
Great! ;-) Thanks for testing.
packages/net/miniupnpd/files/miniupnpd.init Lines 123 to 124 in 5ca92d9
Setting the existing UCI option The Even though And the reason why |
|
(PS: I also heard about a recent bug bounty where a user liked a bug fix, but he gave up on his plan after contacting the maintainer, who maybe have lost interest in the project.) |
|
@Self-Hosting-Group: Good job since more one year about it. |
To test with Tailscale. Also adds the required daemon fix (proposed for inclusion, to merge with prior) Signed-off-by: Self-Hosting-Group <[email protected]>
Thanks for your explanation, but there actually exist some scenarios that only Hope we can add this in the future when it becomes stable. |
Could you please explain this in more detail and describe a scenario in which the STUN function cannot work with
How? The fact that some PCP/NAT-PMP clients are not compatible when a private IPv4 address is returned will not change. They require a public IPv4 address to function, with these protocols, it is required that the external IP address (reported by the router) must be sent along with the renewal. Therefore, I see the only option as sending a public IPv4 address so that port mapping works with all clients. And I don't want to suggest new, additional options that create compatibility issues. Removing the comment of this code would work immediately and would be a more compatible alternative to the daemon option if someone does not want to use STUN: If we have a use case, I will gladly enable the code. |
|
The known affected clients are: Apple and miniupnp natpmpc, and probably more. |
If I do want a PCP/NAT-PMP client to get private IP of the wan port reported, not sure if there is any other way, but in my test, only |
|
Hello @AquanJSW
These incompatible clients don't actually care if the returned IPv4 address is the real public IP, as long as it's not private. The mapping actually works, but the API returns an error, which is shown to the user.
Please also note that an additional bug in the I want to cover all user cases with the revision of the packages. Therefore, it is important to me that this also works for you. (And possibly not quote the entire comment, to avoid making the PR history even longer.) |
Sorry I didn't make it clear, if two tailscale client that behind a same private network want a direct connection between themselves though that private network but not a public one, they need to known the private IP each other, but not a pseudo or real public IP. |
My test looks like this: So if one wish the direct connection happens at |
OK. But you never mentioned having multiple routers before.
? |
Yes, it would be better for me to have a |
One more question about your setup. Does it currently work (tested?) by manually setting up firewall rules instead of using the service in OpenWrt, since the service has not been working so far for this specific user case (except with the X-Wrt enhancements)? If you have a testable setup, would you be willing to do a full test, including trying out the LuCI UI, to see if it works for you? I would then add this option as an additional, optional commit and see if the other reviewers also find this useful. |
No, manually setting up firewall rules doesn't work in this case.
The LuCI UI seems to be working fine to me so far. |
I'll add the commit, and then can you run the Tailscale test? I only want to introduce this option if it's proven to work with it. Otherwise, we probably don't need it. By the way: You need an unrestricted endpoint-independent (1:1) CGNAT to test with your setup whether the port maps between the routers work when they are not located at the same site. |
I'm here thanks to my symmetric NAT, so probably I can't perform such a test.
Yeah, glad to test :) |
Commit pushed for testing. Please recompile the daemon package with the latest commit. To easily test the LuCI plugin (including the rpcd ucode update) without compilation, I have prepared the following script to be executed on the router: |
Perhaps you will find someone for such a Tailscale test. |








Commits
As this PR is extensive, the descriptions of the individual commits are collapsed here:
update daemon to 2.3.9 to fix issues and refresh building
upnp_forwardandreturn the correct client port. This also resulted in the excessive opening of
new ports
HTTP-only/HTTPS mirror were only available ~85%/77% over 3 months
https://redirect.github.com/miniupnp/miniupnp/issues/770
https://stats.uptimerobot.com/DwGDxUB914
mirror was recently and frequently impossible
comments to the public repository, in project since 2012, makes backports more
complex
--disable-pppconnto remove the old/IGDv1-only extra SSDPWANPPPConnection announcements workaround not included in other
implementations since >15y
--vendorcfgto allow customisation of the router/friendlyname (+5 potential options) displayed in Windows Explorer, 384 bytes extra
required on ARMv7 (binary)
compiles/runs without it, and 300-macos... as seems no longer needed
clean_ruleset_interval/thresholdUCI config options as notstandard/working since OpenWrt 22.03, as nftables not supported
Fix: https://redirect.github.com/openwrt/openwrt/issues/18011
Fix: https://redirect.github.com/openwrt/luci/issues/7759
patch for UPnP IGD compatibility with Microsoft/Apple clients
by returning an infinite (0) lease duration, so that listing and editing works
via GUI (Explorer/Network) when daemon has been compiled with IGDv2
caused problems if PCP/NAT-PMP (prioritised) was disabled
(proposed for inclusion)
Link: https://redirect.github.com/FreshTomato-Project/freshtomato-arm/issues/75
patch to fix description filter option
To fix the non-working description regex filter option
(proposed for inclusion)
Link: https://redirect.github.com/miniupnp/miniupnp/pull/853
new/revised UCI options and improve daemon init/config-gen
The following settings UCI options been added or changed, and the previous
options are migrated on the service restart:
Notes:
enabled=0 and upnp_igd_compat=igdv1
only use STUN when necessary with a private/CGNAT external IPv4
lease_file6=${lease_file}-ipv6so thatactive IPv6 port maps are not lost when service restarts, e.g. by deleting an
active port map. Use /run path, symlinked and appeared in FHS 3.0 in 2015 and
remove option if UCI default is set
8/4 Mbit/s, which is removed on migration
decide if the custom ACL should be checked before the preset. Extra ports can
also be set that are accepted/rejected. Presets:
accept-high-ports/accept-high-ports+web[+dns]/accept-all-ports/0
(FTP), 23 (Telnet), DCE/NetBIOS/SMB (135/137-139/445), RDP (3389)
Code refactoring:
booleans) according to the same principle and remove
upnpd_write_bool/etc/config/upnpdUCI config fileRelated LuCI PR: https://redirect.github.com/openwrt/luci/pull/7822
Close: https://redirect.github.com/openwrt/packages/pull/26531
group/rearrange config-gen and refactoring
and comment
does so using the created function
xml_encode(to merge with prior)
new/revised custom ACL UCI options and migrate section
no preset or listed accepted ports. Add (ignored) custom ACL template entries
on migration
acl_entryoptions are migrated on the service restart:
-> accept/reject). To avoid adding inverted actions when changing via LuCI,
ensure any missing are set, as LuCI and UCI had not matching action defaults.
Missing actions are now ignored/logged
migration, as the colon (:) is not valid in LuCI
IPv4 port map description, and fix the current collision with the comment
field which was not noticed due to a daemon bug
https://redirect.github.com/openwrt/packages/pull/24495
https://redirect.github.com/miniupnp/miniupnp/pull/853
Code refactoring:
is_port_or_rangefunction instead ofupnpd_get_port_rangeand check if it has a valid range, and removes ashellcheck warning
conf_rule_addfunction toupnpd_add_custom_acl_entryrename UCI section name to `settings` (v2.0)
Inspired/address copilot's PR review for a clearer config by rename UCI section
name
config(v1.0) ->settings(v2.0), helps on migration and to distinguishthe updated config from the previous one easily
(to merge with prior)
refactoring by separate service start and config-gen
config_foreach upnpd "upnpd"and replace it with regular functioncall, as init was not designed for a multi-instance setup, as the same
tmpconfwill be used/overwritten, and non-anonymous sectiononly perform external interface detection with the second one, and rename
function
upnpdtoupnpd_generate_configfile will not be regenerated on restarts
(to merge with prior)
rearrange init functions
Arrange
start_serviceand main init functions first(to merge with prior)
(The italic commits are intended to be merged with the previous ones after review.)
Screenshots
The new network-wide access control functionality can best be described using the LuCI screenshots:
Enabled Networks / Access Control
Edit network access control settings
Advanced Settings tab with new CGNAT functionality
New UPnP IGD Adjustments tab
LuCI notification if the related package is not updated
Full LuCI screenshot
Related LuCI PR: openwrt/luci#7822
Tested on: OpenWrt 24.10.4
The Port Control Protocol (PCP) is the successor to NAT-PMP, shares similar protocol concepts and packet formats, but supports IPv6 port mapping and options/extensions. For more information, see:
Port Mapping Protocols Overview and Comparison 2025: About UPnP IGD & PCP/NAT-PMP
https://github.com/Self-Hosting-Group/wiki/wiki/Port-Mapping-Protocols-Overview