UPnP Detection Delay

I have RaspBMC installed on Raspberry Pi, XBMC on Window laptop and UPnPlay on my Android device. Raspberry Pi is always on and is designed to work as a server for the system.

Accepted IP Addresses:

  • 192.168.0.18: RPi

  • 192.168.0.13: Notebook

  • 192.168.0.1: Router

When I connect my Android device to Wi-Fi and turn on UPnPlay or launch XBMC on my laptop, there would be a delay of 5-10 minutes before the Raspberry Pi appears in the list of devices. However, over the past few weeks, Pi does not appear at all unless I restart it while other services are running (XBMC or UPnPlay). I can use ssh and sftp for Pi and access the RaspBMC web interface from both devices without problems.

Is it possible that UPnP network discovery / announcement messages are lost or blocked in some way? How would I research this? My knowledge of networking is limited to port forwarding.

I am open to suggestions of alternative protocols for UPnP - this is the simple first one I came across, and it worked great on my previous setup (XBMC on a desktop computer sending media to Apple TV).


EDIT:

Some analyzes with Wireshark on the laptop show that the laptop behaves as expected - sending M-SEARCH and NOTIFY packets at regular intervals over SSDP up to 239.255.255.250 (which, I believe, is a multicast address). However, RPi does not respond to these packets with unicast packets (as Wikipedia suggests), but it also does not send any SSDP packets other than downloading.

I am very new to Wireshark and network analysis in general, but I am very grateful for any recommendations or advice you can give.

The Wireshark filter that I used was "(udp.dstport == 1900 or ip.addr == 192.168.0.18) and! (Ip.src == 192.168.0.1)", where 192.168.0.18 is my RPi address - I I think this is correct, but, as I said, I am very new to Wireshark - please correct me if I made a mistake! In particular, I assumed that the RPi multicast response to M-SEARCH would have ip.src = 192.168.0.18, but I'm not sure about that (maybe it could be 192.168.0.1 or 239.255.255.250)


EDIT 2:

Guided by this post , I ran /sbin/route -n and got the following output.

 pi@raspbmc:~$ /sbin/route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 

I donโ€™t know how to interpret this, but judging by the other comments of the related stream, it seems that there is no record for multicast. Again, following these related flow tips, I ran sudo route add -net 239.0.0.0 netmask 255.0.0.0 eth0 , added it to /etc/rc.local and restarted RPi - however, Pi still does not appear in the list of network devices for UPnP clients. I also tried using 239.255.255.250 as the multicast address (see the "Editing 1" section above), resulting in a route: netmask doesn't match route address error.

Again, guided by a related message, I started tshark and ran sudo tshark -i et0 multicast | grep 192.168.0.18 sudo tshark -i et0 multicast | grep 192.168.0.18 (I added grep since I saw a lot of traffic between other devices on the network).

Here is the conclusion.

RPi sends a cluster from NOTIFY packets, but very rarely (this entry takes almost 20 minutes, and only two clusters are sent). I believe that ARP packets are described below, implying that some devices lack MAC addresses for other devices on the network. While this is potentially troubling (some devices ask for the same address more than once โ€” why do they โ€œforgetโ€ it?), It may be more troubling about the inaccuracy with which these packets are sent, and the fact that even when they are sent, clients in networks still don't pick up RPi.

So, we summarize:

  • RPi sends NOTIFY packets, but very rarely. Is there any way to control this?

  • Even when RPi sends NOTIFY packets (in the normal course of events, and not during loading), clients on the network do not get stuck in its existence.

  • RPi does not seem to respond to M-SEARCH packets sent from other devices.

+8
raspberry-pi upnp xbmc
source share
2 answers

Is it possible that UPnP network discovery / announcement messages are lost or blocked in some way?

Lost, definitely not. It is blocked, possibly in the sense that it is not sent at all due to improper implementation of voice multicast UDP, or in the UPnP node. I regularly observe similar behavior with RaspBMC in brand-certified home entertainment devices.

Any node connecting to the UPnP network should advertise itself: send multicast (i.e., to the address 239.255.255.250) UDP packet with content very similar to HTTP, but the NOTIFY action. This part of RaspBMC seems to work well - which is why I asked for another test case.

Then the same node can additionally detect the network: send the multicast UDP packet again with the M-SEARCH action, but contrary to NOTIFY it actually expects unicast responses from other UPnP nodes. RaspBMC as a media server does not need to do this because it does not need to know other nodes. But other nodes need to know about the servers on the network, and several things may be wrong:

  • XBMC / UPnPlay does not send this multicast discovery (it is unlikely you said that XBMC worked for you)
  • RaspBMC throttles and does not send the expected unicast response on first discovery, only on later
  • XBMC / UPnPlay does not understand the response sent by RaspBMC and discards it.

How will I research this?

On your Windows laptop, install DeviceSpy from Intel UPnP Developer Tools . It is consistently considered as the most reliable implementation of the UPnP checkpoint. If your RasPi does not appear immediately, then this is a RaspBMC problem. He either did not send the unicast response at all, or the answer was incorrect.

If it pops up, run Device Sniffer from the same toolbox. Launch XBMC or UPnPPlay and view the UPnP discovery multicast traffic. If there is an M-SEARCH coming from the expected Windows or Android IP address but RaspBMC does not appear, then this is a RaspBMC problem. The tool, unfortunately, cannot catch a unicast response from RaspBMC (if any)

In the worst case, install Wireshark and filter the capture to the RasPi IP address. It will tell you whether it sent a unicast response or not, and you can see it.

+5
source share

You might want to try disconnecting the router from the rest of the network (that is, all other devices can see each other, but not through your router) - some routers "interfere" with UPNP traffic. This will tell you that your router is disabling or blocking UPnP traffic. BT home homes are especially guilty.

0
source share

All Articles