Get ready for the next long read without the happy end
We’re stepping into the area where I’m really a noob. And the discussion doesn’t really match a Basic setup as mentioned in the topic. I didn’t expect this kind of details here.
We clarified how discovery is done, but I’ll repeat again briefly. Client (media player) sends data from 192.168.11.9:57047:
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
ST: urn:schemas-upnp-org:service:ContentDirectory:1
USER-AGENT: OS/version UPnP/1.1 product/version
MX: 3
By saying that we’re sending a request to a multicast group 239.255.255.250 trying to get a reply from the available Media Server devices (device:ContentDirectory). And we’re expecting a reply to return any time within next 3 seconds due to MX value of 3 which is greater than 1 and less than 5. Seems compliant, except we didn’t sent a user agent because this header is optional. Search requests should be sent multiple times due to UDP protocol usage.
An expected reply from media server must be sent back to 192.168.11.9:57047, disregarding where the server is located (note ST header):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age = seconds until advertisement expires
DATE: when response was generated
EXT:
LOCATION: URL for UPnP description for root device
SERVER: OS/version UPnP/1.1 product/version
ST: search target
USN: composite identifier for the advertisement
Now I’m done with preparations and I description of the test config. I start traffic sniffing on interface and wait until all my 2 DLNA servers (win 10 is 192.168.10.40 and QNAP is 192.168.10.58) appear in the app.
We can truly see 3 M-Search packets with repeat time about 3 seconds. The content of the messages is the same. Sample is shown and fully compliant.


We’re done with the client. Let’s see what servers reply within 3 seconds from our M-Search request. We can see a reply from DLNA on PC with proper HTTP/1.1 200 OK, ST header and resource location. So about 2 seconds after we sent a search request, I can spot one of my DLNA servers. Same picture appears with other 2 search/reply sequences.


Now let’s see a reply from QNAP. Check the Protocol column, it says just UDP instead of SSDP as on the previous capture. But the data inside looks like an expected content.


HTTP/1.1 200 OK
CACHE-CONTROL: max-age=1800
DATE: Fri, 06 Jul 2018 20:54:21 GMT
EXT:
LOCATION: http://192.168.10.58:8080/upnpd/583fe79aa7.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: e155542e-809f-11e8-a4ce-934cd74f7952
SERVER: Linux/4.2.8, UPnP/1.0, Portable SDK for UPnP devices/1.6.22
X-User-Agent: redsonic
ST: urn:schemas-upnp-org:service:ContentDirectory:1
USN: 787120b7-481b-4e3b-8488-49170c28608c::urn:schemas-upnp-org:service:ContentDirectory:1
The same thing happens upon subsequent searches. QNAP DLNA is not yet shown so far in my player. If you take a look at the location, that is not a DLNA port 8200, it’s a WWW port in my setup. And thus QNAP DLNA is not discovered by M-Search request at all.
So how the hell QNAP finally appears in the list? Let’s check for the other M-Search messages in the capture. As you can see starting from the 85-th second QNAP starts to query for available media receivers (device:MediaRenderer) and does that twice (frames 842 and 844). A reply is expected within MX=5 seconds.


And voila. Our Little Engine That Could media player replies with I’m your renderer and completes the discovery.


So, to be able to use QNAP you should be lucky enough that you start your media player close enough to the time when QNAP will search for media players, and not the vice versa how it should be in theory. That kinda sucks.
But if you are looking a media server inside the same segment, Qnap replies immediately. I still have questions for the next round of investigation:
- It looks like M-Search reaches the other end of PIM setup, because PC DLNA appears instantly
- Disabling WWW service is not an option for me, although maybe it intercepts SSDP message and it could work properly with disabled web-service (maybe?)
- Find out how to sniff traffic on QNAP
- Clarify whether the problem is connected with QVS configuration on my QNAP, and would situation improve if I disable that QVS and try with regular port configuration
- I doubt I would be able to investigate events on QNAP DLNA, but maybe there are some kind of logs there
- Strange thing that Spartacus has similar symptoms, but he uses Twonky instead of native DLNA app, however ethernet configuration and device model is unknown. I would like to get a comment on that, maybe it could help a bit in the problem understanding
So far it looks like a QNAP problem