openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
3.94k stars 3.45k forks source link

miniupnpd not show router with ipv4, ipv6 - works #6530

Closed rasdotsu closed 3 years ago

rasdotsu commented 6 years ago

Hello,

miniupnpd - 2.1-1

openwrt-18.06.0-rc2-ar71xx-generic-tl-wr1043nd-v2-squashfs-sysupgrade

cat /etc/config/upnpd

config upnpd 'config' option download '1024' option upload '512' option internal_iface 'lan' option external_iface 'wan' option port '5000' option upnp_lease_file '/var/run/miniupnpd.leases' option enabled '1' option uuid '37405787-6edf-4bf5-96db-d40b6e20dbf9'

config perm_rule option action 'allow' option ext_ports '1024-65535' option int_addr '0.0.0.0/0' option int_ports '1024-65535' option comment 'Allow high ports'

config perm_rule option action 'deny' option ext_ports '0-65535' option int_addr '0.0.0.0/0' option int_ports '0-65535' option comment 'Default deny'

upnp not shown or detectd via ipv4, if ipv6 used - works and found.

ipv4 search:

./listdevices searching all UPnP devices no device found.

ipv6 search:

./listdevices -6 searching all UPnP devices 1: uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa
http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa 2: uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb
http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb 3: urn:schemas-upnp-org:device:WANDevice:2
http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa::urn:schemas-upnp-org:device:WANDevice:2 4: urn:schemas-upnp-org:service:WANIPConnection:2
http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:service:WANIPConnection:2 5: urn:schemas-upnp-org:service:DeviceProtection:1 http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::urn:schemas-upnp-org:service:DeviceProtection:1 6: urn:schemas-upnp-org:service:WANIPv6FirewallControl:1 http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:service:WANIPv6FirewallControl:1 7: urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa::urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 8: urn:schemas-upnp-org:service:WANPPPConnection:1 http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:service:WANPPPConnection:1 9: urn:schemas-upnp-org:service:Layer3Forwarding:1 http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::urn:schemas-upnp-org:service:Layer3Forwarding:1 10: uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9
http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9 11: upnp:rootdevice
http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::upnp:rootdevice 12: urn:schemas-upnp-org:device:InternetGatewayDevice:2 http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::urn:schemas-upnp-org:device:InternetGatewayDevice:2 13: urn:schemas-upnp-org:device:WANConnectionDevice:2 http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:device:WANConnectionDevice:2

http://[fd69:b7a7:ac55::1]:5000/rootDesc.xml : 1: uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa 2: uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb 3: urn:schemas-upnp-org:device:WANDevice:2 uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa::urn:schemas-upnp-org:device:WANDevice:2 4: urn:schemas-upnp-org:service:WANIPConnection:2 uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:service:WANIPConnection:2 5: urn:schemas-upnp-org:service:DeviceProtection:1 uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::urn:schemas-upnp-org:service:DeviceProtection:1 6: urn:schemas-upnp-org:service:WANIPv6FirewallControl:1 uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:service:WANIPv6FirewallControl:1 7: urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 uuid:37405787-6edf-4bf5-96db-d40b6e20dbfa::urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 8: urn:schemas-upnp-org:service:WANPPPConnection:1 uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:service:WANPPPConnection:1 9: urn:schemas-upnp-org:service:Layer3Forwarding:1 uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::urn:schemas-upnp-org:service:Layer3Forwarding:1 10: uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9 uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9 11: upnp:rootdevice uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::upnp:rootdevice 12: urn:schemas-upnp-org:device:InternetGatewayDevice:2 uuid:37405787-6edf-4bf5-96db-d40b6e20dbf9::urn:schemas-upnp-org:device:InternetGatewayDevice:2 13: urn:schemas-upnp-org:device:WANConnectionDevice:2 uuid:37405787-6edf-4bf5-96db-d40b6e20dbfb::urn:schemas-upnp-org:device:WANConnectionDevice:2

SirDMZ commented 6 years ago

Can confirm. Disabled IPv6 on lan interface and restarted miniupnp, now it works.

diizzyy commented 6 years ago

@ldir-EDB0

ldir-EDB0 commented 6 years ago

No idea. And the reports are confusing, one says disabled IPv6 and it works, the other says enabled ipv6 and it works. I don't know what this './listdevices' is?

Is there a difference between the ports miniupnpd is listening to one a working v non working router? Proving it at least thinks it's listening would be a start 'netstat -nap | grep miniupn'

SirDMZ commented 6 years ago

Bad:

root@OpenWrt:~# netstat -nap | grep miniupn tcp 0 0 :::5000 ::: LISTEN 31306/miniupnpd udp 0 0 172.30.200.1:55072 0.0.0.0: 31306/miniupnpd udp 0 0 0.0.0.0:1900 0.0.0.0: 31306/miniupnpd udp 0 0 172.30.200.1:5351 0.0.0.0: 31306/miniupnpd udp 0 0 :::46344 ::: 31306/miniupnpd udp 0 0 :::1900 ::: 31306/miniupnpd udp 0 0 :::5351 :::* 31306/miniupnpd unix 2 [ ] DGRAM 457704 31306/miniupnpd

Good:

root@OpenWrt:~# netstat -nap | grep miniupn tcp 0 0 :::5000 ::: LISTEN 32152/miniupnpd udp 0 0 172.30.200.1:57405 0.0.0.0: 32152/miniupnpd udp 0 0 0.0.0.0:1900 0.0.0.0: 32152/miniupnpd udp 0 0 172.30.200.1:5351 0.0.0.0: 32152/miniupnpd udp 0 0 :::37964 ::: 32152/miniupnpd udp 0 0 :::1900 ::: 32152/miniupnpd udp 0 0 :::5351 :::* 32152/miniupnpd unix 2 [ ] DGRAM 461035 32152/miniupnpd

No real difference there.

Syslog doesn't show anything useful. In both cases it has: Sun Jul 22 18:50:26 2018 daemon.notice miniupnpd[442]: shutting down MiniUPnPd

  | Sun Jul 22 18:50:27 2018 daemon.notice miniupnpd[830]: HTTP listening on port 5000   | Sun Jul 22 18:50:27 2018 daemon.notice miniupnpd[830]: HTTP IPv6 address given to control points : [fd23:c778:59e1::1]   | Sun Jul 22 18:50:27 2018 daemon.notice miniupnpd[830]: Listening for NAT-PMP/PCP traffic on port 5351

I tried disabling pmp and upnp one at a time to see where the issue is. The issue appears to be in upnp.

ldir-EDB0 commented 6 years ago

I'm afraid I have absolutely no idea how to progress this.

rasdotsu commented 6 years ago

listdevices - tool from miniupnpc-2.1 miniupnpd listen only ipv6 and not ipv4

ldir-EDB0 commented 6 years ago

ok so I got 'listdevices' to build on my mac and it lists many devices including my openwrt router when run as 'listdevices', it lists only my router when run as 'listdevices -6'. I have an ancient windows server box that gets quite upset if it can't talk ipv4 to the upnp gateway and that appears to be happy. So this smells like a config issue rather than any fundamental 'miniupnpd is broken'. /etc/config/upnpd is effectively a wrapper around /var/etc/miniupnpd.conf, which is generated by the startup script. What is in /var/etc/miniupnpd.conf? and are the interface definitions there sane?

panda-mute commented 6 years ago

I have meet the similar issue, my router will suddenly disappeared when eanble mwan3. If disable it, the upnp device is always there. When met such issue, try to restart firewall also can bring upnp device back.

SirDMZ commented 6 years ago

ext_ifname=pppoe-wan listening_ip=br-lan port=5000 enable_natpmp=yes enable_upnp=yes secure_mode=yes pcp_allow_thirdparty=no system_uptime=yes force_igd_desc_v1=no lease_file=/var/run/miniupnpd.leases bitrate_down=8388608 bitrate_up=4194304 uuid= Stripped, not sure of security implications allow 1024-65535 0.0.0.0/0 1024-65535 #Allow high ports deny 0-65535 0.0.0.0/0 0-65535 #Default deny

Looks sane to me.

neheb commented 6 years ago

Please try with the latest version.

SirDMZ commented 5 years ago

Still not happy on 18.06.1

SirDMZ commented 5 years ago

I installed the 2.0 version of this package from lede 17 packages. works great. yes, installed in on openwrt 18.06.1

DOCaCola commented 5 years ago

I have experienced issues with the upnp service as well. With the help of a tool "PortMapper" (https://sourceforge.net/projects/upnp-portmapper/), i was able to figure out what was going on.

I have a OpenWRT box with IPv4/IPv6 enabled. Now i tested this with a client computer running Windows (both IPv4 and IPv6 enabled as well). When the Windows machine sends an UPNP request, miniupnp is reporting the IPv6 address of the OpenWrt box in the UPNP discovery. I have also tested this with IPv6 on the Windows machine disabled. Regardless of this, the machine gets always the IPv6 of the OpenWRT box reported. This is a big issue with many many games that only support IPv4 connections. These Programs and games will never be able to receive UPNP from OpenWRT this way. A way to improve this situation is to be able to bind miniupnpd to the IPv4 address of the interface. I think miniupnpd has this option or an option to disable IPv6 entirely, however it is not exposed through the openwrt config.

I have tested this with OpenWrt 18.06.2 using the miniupnpd 2.1-1 package.

ffrediani commented 5 years ago

I am not sure if this is the correct approach if I understood the question correctly.

If the UPNP request to the router if to create a IPv4 Port Forward then it must take in consideration the IPv4 address of the requester. The same way if the PCP request if to allow a connection to be forwarded to a IPv6 device in the LAN then the IPv6 address of the requester is the one to be taken in consideration.

neheb commented 4 years ago

Just looked into this. It seems IPv6 support here is somewhat broken as far as the configuration goes.

I just pushed an update to https://github.com/openwrt/packages/pull/11275 .

Can anyone test?

neheb commented 4 years ago

I wonder if the port should be changed to 2869 for better compatibility with Windows...

SirDMZ commented 4 years ago

Is this available on 19.07.1 at all? If it is then I'll give it a test tonight. What would be the miniupnp package version?

On 13 Feb 2020, at 16:05, Rosen Penev notifications@github.com wrote:

 Just looked into this. It seems IPv6 support here is somewhat broken as far as the configuration goes.

I just pushed an update to #11275 .

Can anyone test?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

neheb commented 4 years ago

Hrm this is strange. I can't get UPnP working on Windows.

There used to be a UPnP menu in the Network list. It's gone now. Maybe because of IPv6.

Looking at netstat, it seems it's listening on port 5000 under IPv6 only:

root@OpenWrt:~# netstat -ln -p | grep miniup
tcp        0      0 :::2869                 :::*                    LISTEN      5384/miniupnpd
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           5384/miniupnpd
udp        0      0 xxx.xxx.x.x:49020       0.0.0.0:*                           5384/miniupnpd
udp        0      0 xxx.xxx.x.x:5351        0.0.0.0:*                           5384/miniupnpd
udp        0      0 :::57188                :::*                                5384/miniupnpd
udp        0      0 :::1900                 :::*                                5384/miniupnpd
udp        0      0 :::5351                 :::*                                5384/miniupnpd

From looking at the code, a way to force it to listen to IPv4 is to pass -DV6SOCKETS_ARE_V6ONLY . Although that's used for BSDs...

edit: Just tested with upnpc. It's showing up as two UPnP devices on my network. One v4 and another v6. It's port forwarding through UPnP just fine.

Doesn't explain Windows though. Maybe fixing Windows requires disabling the IPv6 SSDP server...

edit2: Maybe it's actually a dnsmasq or odhcpd issue. My Windows interface has two gateways, one v4 and the other a link-local v6 one. Actually it's the OpenWrt link local address...

neheb commented 4 years ago

@SirDMZ all of this is in testing. I can't just push it like this :).

ffrediani commented 4 years ago

Hello @neheb I am not entirely sure but Windows has been delaying a lot support for PCP and IPv6 (more precisely to IGD2). In order to test it from Windows I have been using the miniupnpc (the client - http://miniupnp.free.fr/files/). Yes, normally the local IPv6 gateway will be a Link-Local address. The main point is the address requested by the client is understood as from the host originating it as a client interface will normally have multiple IPv6 addresses.

neheb commented 4 years ago

I pushed the linked PR. Maybe someone can test in a few days...

@ffrediani are you saying that disabling igdv2 works?

Neustradamus commented 3 years ago

@ all: What is the status of this ticket?

neheb commented 3 years ago

This sounds like 18.06, which is no longer supported.