I can't get UPnP port forwarding to work properly with Windows 10 or Xbox and OpenWrt 19.07.6 on x86.
Torrenting apps and basic UPnP test programs such as UPnP Wizard work fine, as does Demonware (e.g. for Call of Duty on the Xbox), but UPnP is not working for Xbox live in Windows 10 and on the Xbox - the port forwards never appear in the list of leases.
I've only become aware of this recently, so I'm not sure exactly when it broke, but it was definitely working with miniupnpd 2.1 in 18.0.6 before I upgraded to 19.0.7 (miniupnpd 2.2) a couple of months ago.
I've tried looking at the detailed UPnP logs and packet captures, but I don't really know what I'm looking at
Does anyone have any ideas about what might be happening, or how I would debug further?
As far as I can tell by looking at the logs, the Windows machine / Xbox never make any attempt to create the port forward - i.e. there's no AddPortMapping request or similar in the logs, unlike the successful operations with UPnP Wizard.
I can see them retrieving various bits of XML from the router, but it seems that they're not happy with the contents somehow.
I built the plugin from updated source from the miniupnpd master repo and have had bugs also.
With the updated source It asks to create mappings and fails with error 501 not just with xbox but also from qbtorrent on my PC, the latest build has a lot more debug info and suggested fixes in the log.
All worked with v18 of openwrt just seems to be an issue with v19 and above.
Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: HTTP REQUEST from [::ffff:192.168.2.189]:57346 : GET /rootDesc.xml (HTTP/1.1)
Thu Jan 21 20:34:51 2021 daemon.debug miniupnpd[6386]: Host: 192.168.2.1:5000
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: HTTP REQUEST from [::ffff:192.168.2.189]:57347 : POST /ctl/IPConn (HTTP/1.1)
Thu Jan 21 20:34:51 2021 daemon.debug miniupnpd[6386]: Host: 192.168.2.1:5000
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: HTTP REQUEST from [::ffff:192.168.2.189]:57348 : POST /ctl/IPConn (HTTP/1.1)
Thu Jan 21 20:34:51 2021 daemon.debug miniupnpd[6386]: Host: 192.168.2.1:5000
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetSpecificPortMappingEntry
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: Returning UPnPError 714: NoSuchEntryInArray
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: HTTP REQUEST from [::ffff:192.168.2.189]:57349 : POST /ctl/IPConn (HTTP/1.1)
Thu Jan 21 20:34:51 2021 daemon.debug miniupnpd[6386]: Host: 192.168.2.1:5000
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: AddPortMapping: ext port 3076 to 192.168.2.189:3076 protocol UDP for: DemonwarePortMapping leaseduration=604800 rhost=
Thu Jan 21 20:34:51 2021 daemon.debug miniupnpd[6386]: UPnP permission rule 0 matched : port mapping accepted
Thu Jan 21 20:34:51 2021 daemon.debug miniupnpd[6386]: Check protocol udp for port 3076 on ext_if eth1 192.168.1.130, 8201A8C0
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: redirecting port 3076 to 192.168.2.189:3076 protocol UDP for: DemonwarePortMapping
Thu Jan 21 20:34:51 2021 daemon.info miniupnpd[6386]: Returning UPnPError 501: ActionFailed
It is going to be difficult to keep all users of miniupnpd satisfied. The default with IGDv2 makes sense, as we want to support the latest and greatest. We could make this configurable with a menuconfig option, like https://github.com/openwrt/openwrt/blob/master/package/network/services/lldpd/Config.in#L4, but we would still default to IGDv2, so you'd have to build your own OpenWrt image, as the package built by the buildbot will have IGDv2 enabled, so we're still not able to satisfy all miniupnpd users.
I see two other options:
introduce a runtime option in miniupnpd that allows to fully disable IGDv2, and ideally this should be configurable per host or subnet, analog to the permission rules
have 2 variants in OpenWrt: miniupnpd-igdv1 and miniupnpd-igdv2, with a virtual package miniupnpd that is satisfied by either, and by default pulls in miniupnpd-igdv2
While I prefer the first option, the second one is probably much easier.
I don't think I'm really qualified to do a proper review, but the parts I understand look sensible. So we'd end up with two packages:
miniupnpd
miniupnpd-igdv1
Both of which will work with packages that have a dependency on miniupnpd (e.g. luci-app-upnp).
I don't really understand how and when patches flow through to the current OpenWrt release. Would these patches ever be made available for 19.0.7?
I noticed when compiling my own version earlier that miniupnpd now depends on libcap-ng, which doesn't seem to be available in the 19.0.7 repo (I had to compile that as well). That change was made last June but it doesn't seem to have made it into the 19.0.7 packages yet.
It seems that this package doesn't have a maintainer, but previous changes from master have been merged to openwrt-19.07. It also doesn't really change the miniupnpd package, it just introduces a new one, so I think there's little chance for regressions in the existing package.
I've patched the miniupnpd Makefile with your changes, but I can't work out how to build the IGDv1 variant. I assume it's not working for me because miniupnpd-igdv1 isn't in the package feeds?
Sorry to hijack the discussion, but I've recently decided to have a go at UPnP because I simply didn't want to open 20 ports each time I wanted to use a certain application for a few minutes, but by trial and error found out it simply doesn't work (19.07.5). I haven't found enough information how to get this to work, even if I had to compile the package myself (just that I have no idea how do I do this, especially with OWRT). I am using LuCi, but can hop into SSH and FTP if needed.
Any help would be appreciated as that would save me quite a lot of time.
I have a Archer C6 v2 router (CPU: Qualcomm Atheros QCA956X), so I assume it to be ath79? It also seems to say that in the techdata page (Target: ath79). I hope that is what you meant and needed.
Ok, I've built libcap-ng and miniupnpd-igdv1 packages based on this info. I have no way of testing them, so I obviously can't guarantee that they'll work correctly.