huin / goupnp

UPnP client library for Go (#golang)
BSD 2-Clause "Simplified" License
417 stars 84 forks source link

Why can't i find this upnp device (http://192.168.61.1:5000/rootDesc.xml)? #30

Closed siredwin closed 5 years ago

siredwin commented 5 years ago

Is it a subnet issue? I can find this device using a third party app. Finally i can load it by url

`

1 0 urn:schemas-upnp-org:device:InternetGatewayDevice:1 OpenWRT router OpenWRT http://www.openwrt.org/ OpenWRT router OpenWRT router 1 http://www.openwrt.org/ 00000000 uuid:8d483abf-ca0e-45cc-9b.... urn:schemas-upnp-org:service:Layer3Forwarding:1 urn:upnp-org:serviceId:Layer3Forwarding1 /ctl/L3F /evt/L3F /L3F.xml urn:schemas-upnp-org:device:WANDevice:1 WANDevice MiniUPnP http://miniupnp.free.fr/ WAN Device WAN Device 20160127 http://miniupnp.free.fr/ 00000000 uuid:8d483abf-ca0e-4f 000000000000 urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 urn:upnp-org:serviceId:WANCommonIFC1 /ctl/CmnIfCfg /evt/CmnIfCfg /WANCfg.xml urn:schemas-upnp-org:device:WANConnectionDevice:1 WANConnectionDevice MiniUPnP http://miniupnp.free.fr/ MiniUPnP daemon MiniUPnPd 20160127 http://miniupnp.free.fr/ 00000000 uuid:8d483abf-ca0e-45cc-9bf0 000000000000 urn:schemas-upnp-org:service:WANIPConnection:1 urn:upnp-org:serviceId:WANIPConn1 /ctl/IPConn /evt/IPConn /WANIPCn.xml http://192....1/

`

huin commented 5 years ago

It's not clear what's causing this not to be found. What would be most useful is a filtered packet dump of what UDP packets came from 192.168.61.1 (or whatever IP the device is on at the time) in the two situations:

1) when asking goupnp to discover devices 2) when the third party app is discovering

Filtered especially to avoid over-sharing what's happening on your home network.

Particularly of interest are UDP packets that contain something looking like an HTTP response.

siredwin commented 5 years ago

The router is safe. It is for testing purposes only on the local network and nothing important connects to it.

What UDP packets are you implying? Unfortunately, the third party app(android - app) manages to find urls from both of my UPnP enabled routers in less than 5 seconds but none of the Go packages do.

huin commented 5 years ago

From your description I'm assuming that you're using goupnp to discover the router on your network, and it's failing to do so. (sidenote: do you have the code snippet?)

UPnP uses a few protocols to work. The discovery portion of it sends UDP to the local network, and then it listens for replies from devices. I'm guessing that some portion of this discovery process is not working.

siredwin commented 5 years ago

I am just running the examples for now.

// Use discovered WANIPConnection2 services to find external IP addresses.
func Example_WANIPConnection2_GetExternalIPAddress() {
    clients, errors, err := internetgateway2.NewWANIPConnection1Clients()
    extIPClients := make([]GetExternalIPAddresser, len(clients))
    for i, client := range clients {
        extIPClients[i] = client
    }
    DisplayExternalIPResults(extIPClients, errors, err)
    // Output:
 }

//Successfully discovered 0 services:
siredwin commented 5 years ago

Fixed! It was my local firewall. Now I will try to figure out which ports I need to open locally.