Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to find a way to get my router to report back my WAN IP using UPnP/SSDP, but so far I have been unable to even get a list of UPnP supporting internet access devices on my network. Here's the request I'm sending:

    $ cat request.txt
    M-SEARCH * HTTP/1.1
    HOST: 239.255.255.250:1900
    MAN: "ssdp:discover"
    MX: 3
    ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1

With the command:

    $ nc -uvv 239.255.255.250 1900 < request.txt
    Connection to 239.255.255.250 1900 port [udp/ssdp] succeeded!

I just get the connnection succeded message and then nothing...

Could anyone give me any pointers (no memory addresses please!) as to what I'm doing wrong?

Update: Ok so I tried using tcpdump to get responses here's what I got:

    $ sudo tcpdump -vv -A -s 0 -i en1 udp port 1900 and host 239.255.255.250 
    …

    NOTIFY * HTTP/1.1
    Host: 239.255.255.250:1900
    Cache-Control: max-age=60
    Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
    NTS: ssdp:alive
    Server: POSIX, UPnP/1.0 linux/5.100.104.2 
    NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1

    …

I guess the next step is to parse the output of tcpdump and filter out all responses that don't contain the NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1 header then make the actual SOAP request to the router.

share|improve this question
    
Why does your 'nc' command use two 'v' parameters? –  parsley72 May 18 '12 at 3:01

1 Answer 1

up vote 1 down vote accepted

You'll need to use tcpdump or something similar to see the reply or replies.

nc is looking for a reply from the endpoint you sent the request to. But the endpoint you sent the request to is a generic broadcast target. The reply will come not from a generic broadcast target but from the specific device that replies.

As nc's output says, it has connected to the broadcast target. So it's not going to see the replies that come from the replying devices.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.