Chad Wilson - 2006-03-31

Hello, I noticed that the version 3 linksys BEFSR41 is not correctly responding to a state variable request.  Here's the packet dump...

POST //WANIPConnection HTTP/1.0
Content-Type: text/xml; charset="utf-8"
HOST: 192.168.1.1
Content-Length: 353
SOAPACTION: "urn:schemas-upnp-org:control-1-0#QueryStateVariable"
Connection: close

HTTP/1.1 200 OK
Connection: close
Server: Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0
Content-length: 206
Content-Type: text/xml; charset="utf-8"

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
.<s:Body>
..<u:QueryStateVariable xmlns:u="urn:schemas-upnp-org:control-1-0">
...<u:varName>PortMappingNumberOfEntries</u:varName>
..</u:QueryStateVariable>
.</s:Body>
</s:Envelope>

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></SOAP-ENV:Body></SOAP-ENV:Envelope>

The last line is the kicker.  It appears that this router is not correctly formatting the xml output for a state variable request.  If you get a chance, skonno could you verify with your ver 2 BEFSR41?  Also anyone else who has a chance, could you verify as well?  Here's a method that I use for grabbing the state variable...

public int getNumberOfEntries() {
        StateVariable numberOfEntries = IGD.getStateVariable("PortMappingNumberOfEntries");
        int i = 0;
        if (numberOfEntries.postQuerylAction()) { //Typo in lib
            try {
                i = Integer.parseInt(numberOfEntries.getValue());
            } catch(NumberFormatException bad) {
                System.out.println(bad.getMessage());
                System.out.println("Oops!  Unable to get NAT table number of entries.");
            }
        } else {
            UPnPStatus err = numberOfEntries.getStatus();
            System.out.println("Error Code = " + err.getCode());
            System.out.println("Error Description = " + err.getDescription());
        }
        return i;
    }

IGD is the router device btw.  Cheers and thanks!