Skip to content

feat(upnp): UPnP / NAT-PMP management via miniupnpd - #539

Merged
gnacho merged 1 commit into
mainfrom
feat/448-upnp-natpmp
Oct 17, 2026
Merged

gnacho merged 1 commit into
mainfrom
feat/448-upnp-natpmp

Conversation

@gnacho

@gnacho gnacho commented Oct 17, 2026

Copy link
Copy Markdown
Owner

UPnP / NAT-PMP management (miniupnpd) following the optional-package pattern, UniFi-style:

  • Backend module (banIP pattern): cheap installed/enabled/running status probe, full probe with the daemon's lease file (active mappings), UCI perm_rule ACLs, and install/uninstall/enable/disable/reload actions through the executor with snapshot and rollback. Enabling forces secure_mode=1 (LAN-only mappings) and the daemon ships disabled.
  • Mapping table is read-only by design, verified against the OpenWrt miniupnpd package: there is no way to delete a single mapping (the lease file is a daemon-managed snapshot, not the source of the nft rules) and no lease-duration cap option, so the table shows each mapping's remaining lease from the real PROTO:ext:int:port:ts:desc lease format.
  • Per-client allow/deny as named UCI perm_rule sections (no new executor op), validated IP/CIDR and port ranges.
  • New page on Internet (after port forwards) with a risk confirmation on enable, i18n ES/EN, demo stub, and 7 unit tests for the lease parser, UCI mapping and rule ops.

Live-verified on a lab router (OpenWrt 25.12, apk): install resolves miniupnpd-nftables, enable writes enabled+secure_mode and starts the daemon, ACL add/delete land in the real config, disable returns to the safe state.

Closes #448

Optional-package service following the banIP pattern: install miniupnpd
through the executor, enable it with safe defaults (off by default;
enabling forces secure_mode so only LAN clients can add mappings), list
the active mappings read-only from the daemon's lease file, and manage
per-client allow/deny ACLs as named UCI perm_rule sections.

Verified against the OpenWrt miniupnpd package: the mapping table is
read-only because miniupnpd exposes no way to delete a single mapping
(the lease file is a daemon-managed snapshot, not the source of the nft
rules), and there is no lease-duration cap option, so the table shows
each mapping's remaining lease instead.
@gnacho
gnacho merged commit 39519ba into main Oct 17, 2026
2 checks passed
@gnacho
gnacho deleted the feat/448-upnp-natpmp branch October 17, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: UPnP / NAT-PMP

1 participant