GalFe / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

UPnP Services not caught, result in malformed packet warnings in heartbeat() #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enable UPnP detection on a network with alternative UPnP services

What is the expected output? What do you see instead?
Expected: No warnings.
Actual: Malformed packet; stated payload length 1514, remaining bytes 350 
(Packet info in additional Info)

What version of the product are you using? On what operating system?
SVN r325, Win7 x64 with a DD-WRT enabled router.

Please provide any additional information below.

Actual received packet:
===begin===
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1801
DATE: Wed, 14 Nov 2012 15:48:08 GMT
EXT:
LOCATION: http://172.16.0.248:49152/wps_device.xml
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: uuid:7d7b9fd3-72c8-54c9-8d4e-b56a4bdb296c
USN: uuid:7d7b9fd3-72c8-54c9-8d4e-b56a4bdb296c
===end===

XML result from location:
===begin===
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
        <major>1</major>
        <minor>0</minor>
    </specVersion>
    <device>
        <deviceType>urn:schemas-wifialliance-org:device:WFADevice:1</deviceType>
        <friendlyName>DD-WRT WPS Access Point</friendlyName>
        <manufacturer>DD-WRT</manufacturer>
        <modelDescription>Wireless Access Point</modelDescription>
        <modelName>WZR-HP-G300NH2</modelName>
        <modelNumber>0</modelNumber>
        <serialNumber>12345</serialNumber>
        <UDN>uuid:7d7b9fd3-72c8-54c9-8d4e-b56a4bdb296c</UDN>
        <serviceList>
            <service>
                <serviceType>urn:schemas-wifialliance-org:service:WFAWLANConfig:1</serviceType>
                <serviceId>urn:wifialliance-org:serviceId:WFAWLANConfig1</serviceId>
                <SCPDURL>wps_scpd.xml</SCPDURL>
                <controlURL>wps_control</controlURL>
                <eventSubURL>wps_event</eventSubURL>
            </service>
        </serviceList>
    </device>
</root>
===end===

Suggested change:
NetPeer.Internal.cs

Change line 411
From: if (resp.Contains("upnp:rootdevice"))
To: if (resp.Contains("UPnP/1.0"))
Or: if (resp.Contains("upnp:rootdevice") || resp.Contains("UPnP/1.0"))
which will cause it to get trapped/return before the warning is issued.

I'm honestly not sure what this service provides, but it doesn't appear to do 
any port forwarding, so I suspect it is something that can be thrown away, 
however, it doesn't match on the upnp:routdevice string as other UPnP services 
do, however, it appears all should contain UPnP/1.0 in the SERVER header.  I'm 
not sure if additional handling would be required.

http://gpl.back2roots.org/source/puma5/netgear/CG3200-1TDNDS_GPL/ap/apps/wpa2/or
iginal/WFA%20WLANConfig%201_0%20Template%201_01.pdf is a document describing 
the service found via google.

Original issue reported on code.google.com by wewei...@gmail.com on 15 Nov 2012 at 3:48

GoogleCodeExporter commented 9 years ago
Fix added in 326; also a verbose message added when failing to parse xml

Original comment by lidg...@gmail.com on 15 Nov 2012 at 8:30