Open sheindel opened 7 years ago
@sheindel thanks for reporting this issue.
When we send a SDDP query, the ST
header specifies the Service Type we are looking for. That means that any discoverable server that offers that service type has to respond with the an url to the device definition (containing its list of services).
What I see here is that your server responds with a Hi, i provide the kind of service that you are looking for (urn:schemas-upnp-org:service:WANIPConnection:1) and gives you a url to a device that doesn't provide that ST. This is because your router uses miniupnpd software and that only works with WANIPConnection
, anway, it seems a bit wierd that the service description announces a WANPPPConnection.
Q: Are you sure the device description that you've shared here (the XML) is the one available in http://192.168.2.1:5555/rootDesc.xml? Please, paste the url in your browser and check it by yourself.
I would need to review the log files. Could you share that here? (of course remove all the info you don't want to publish)
Here is the exact rootDesc.xml. The framework chooses WANIPConnection:1 when we in fact get WANPPPConnection:1
So again, either the SSDP server or the UPnP server is reporting the wrong service type... I might just implement a workaround for now that uses the ServiceType from the SSDP server as a fallback.
Open to other suggestions.
And here is an snippet response of one of the port mappings
I think that by the moment you can do what you say: use the ST from de SSDP as fallback or, use the one in the response. In pseudocoude:
var st = responseText.Match("WAN[IP|PPP]Connection").Text;
For a better solution I have to review the miniupnpd server code in order to understand why it behaves as it does.
Netgear WNR2000v5 reports the following to SSDP response
And the following router device list response
When calling GetAllMappingsAsync(), the following data is returned
As can be seen, the ServiceType that is returned with the mapping is
urn:schemas-upnp-org:service:WANIPConnection:1
But when the UPnP device info was set up, it found ServiceType
urn:schemas-upnp-org:service:WANPPPConnection:1
(per UPnPSearcher.cs, BuildUpnpNatDeviceInfo(IPAddress localAddress, Uri location)) as the ServiceType. As such, GetPortMappingEntryResponseMessage constructor throws an exception atXmlNode data = GetNode();
because that function uses the ServiceType to get the root of the mapping response data, and in this case the servicetype is not there.Are you aware if the disparity between the SSDP ServiceType and the router device list ServiceType is a discrepancy or does each implementation still confirm the to the spec? If so, this would be a bug in the firmware and I would be open to suggestions to get around it for the time being. If this is in line with the spec, can we always use the SSDP reported service type or would it be better to store both names to use one as a "fallback"? Or perhaps just reference the child element without specifying the ServiceType in the XPath so it isn't an issue?