Page 1 of 1

Windows 10 Host and SSDP

Posted: 4. Apr 2020, 05:58
by fys
I am trying to implement SSDP (Simple Service Discovery Protocol) within my (hobby) OS. I am sending the following packet for discovery.

Code: Select all

*ETHERNET*
   01 00 5E 7F FF FA   ; target (translation of 239.255.255.250) (see note F)
   08 00-27 00 AF 69   ; source (MAC address Virtual Box gives me)
   08 00               ; IPv4

*IPv4*
   45      ; version/header length
   00      ; type of service
   00 A1   ; total length
   12 34   ; id
   00 00   ; flags/fragment offset
   04      ; time to live (see note (B) below)
   11      ; protocol (UDP)
   BB 5F   ; header check sum
   C0 A8 38 16   ; source  (192.168.56.22)
   EF FF FF FA   ; target  (239.255.255.250)

*UDP*
   C0 02   ; source port (49154)
   07 6C   ; target port (1900)
   00 8D   ; udp length
   59 AB   ; udp check sum

*SSDP*
M-SEARCH * HTTP/1.1\r\n
Host: 239.255.255.250:1900\r\n
ST: urn:schemas-wifialliance-org:device:WFADevice:1\r\n
Man: "ssdp:discover"\r\n
MX: 3\r\n
\r\n
- Given in binary format for the sake of this post so to verify that, yes, I am sending the correct data.
- Obviously not the *protocol* chars shown and \r\n are the actual 13 10 bytes.
- Also, please note that this is the identical packet received from Windows 10 (upon a Host request) except that the UDP:SourcePort is different, which changes the check sum(s), etc.

Side note:
- I am using Virtual Box 6.1.4 r136177 (Qt5.6.2)
- Windows 10 Host
- Host-only Adapter
- VirtualBox Host-Only Ethernet Adapter
- Intel Pro/1000 MT Desktop (82540EM)
- Promiscuous Mode: Deny
- MAC Address: duhh, same as above
- "Cable Connected" is checked

When I send this to the host, I get nothing back. i.e.: There is no indication that the host received, verified, and/or replied. I get no packet received back, of any kind.

While VirtualBox is running in the background, from the Windows10:Explorer>Network window, if I hit F5 to refresh, I get the Windows 10 "discover" packet, (almost) identical to the one shown above.
This means that my packet driver is working, at least the receive part. I can verify that the send part works as well since (when activated) my DHCP framework sends packets which are responded to by the host.
Therefore, my conclusion is one of the following ideas/notes:

A) My sent packet is corrupt in one way or another, and the Host (Windows 10) is dropping it.
B) I am using a TTL value of 4, whereas the SSDP/UPnP specs say I should use a TTL value of 2. However, Windows 10 is sending me its packet with a value of 4, meaning they are using a TTL = 4.
C) I actually hard coded and sent a packet to be the exact packet received from the Host (Windows 10), changing only the necessary MAC, to see if it was my packet, therefore sending exactly the same packet as Windows 10 sends on its "discover" request. Nope, still no response.
D) Virtual Box is blocking my packet
E) Virtual Box's SSDP is not quite correct (doubtful) (does VirtualBox even emulate SSDP, or is it simply passed on to the Host? i.e.: No need to emulate at all.)
F) I tried a target MAC of "FF FF FF FF FF FF", and any other multicast MAC as well as a direct MAC address to the host (virtual adapter) and still cannot get a response.

Also, on a side note, if I use the PCnet-FAST III (Am79C973) emulation within Virtual Box, Windows 10 does not send a SSDP "discover" packet when hitting F5 from the host. It does when using the E1000 emulation. Without looking at the Virtual Box network emulation, I can't tell you why it would make a difference. I can't imagine SSDP being dependent on the packet driver. However, some how, Windows 10 as a Host, knows not to send the SSDP discovery protocol when the PCnet emulation is chosen. It sends a DHCP protocol Discover request instead.

I have searched around to find other similar issues:
https://www.virtualbox.org/ticket/8698#comment:4
States to set the "Automatic Metric" value. This had no change.

I have seen other posts stating that some people are having problems with multicast packets, but no one can pin-point the exact cause, so there is no fix.

The only thing I can think of next is to use a packet sniffer to see what is actually happening.

Has anyone here experienced a similar effect or has any idea what could be causing this effect?

Thank you for your time,
Ben

Re: Windows 10 Host and SSDP

Posted: 4. Apr 2020, 20:05
by fys
For an update, I installed a packet sniffer and can confirm that the SSDP "discovery" packet is being sent to the host. The packet sniffer is being ran from the Host and captures each packet I send.
I can also confirm that all CRC's are correct and the packet analyzer shows no errors.

Is the packet not being sent to the Windows 10 host?
Is the packet being ignored by the Windows 10 host? (firewall settings? doubtful)
I have verified that Windows 10 is allowing "discovery" within the settings.

The only thing I can imagine is that the VirtualBox Adapter is not propagating my SSDP packets beyond the virtual adapter. This is more so since if I use the VirtualBox PCnet adapter settings, I don't see Windows 10 SSDP packets sent to me on its "discovery" request.

As a followup to my comment in the last post about the PCnet adapter, I would think that Windows 10 is sending the SSDP "discover" packet, it just so happens that they might be blocked by the VirtualBox PCnet (virtual) adapter.

Confirmed. When using the PCnet adapter setting, if I am at a Windows 10>Network window (on the host, not via the Guest) and press F5, Windows 10 is in fact sending the SSDP "discover" packets. This is confirmed via the packet sniffer. However, these packets are being blocked by the PCnet adapter since my Guest does not see any of them.

So my question is, do the VirtualBox Network Adapters analyze the packets as they come through and drop any that it doesn't know about? In my humble opinion, it should not. It should propagate all packets. Or is this a problem with the multicast/uni-cast code within the virtual adapter, not properly identifying multi-cast packets?

Ben

Re: Windows 10 Host and SSDP

Posted: 5. Apr 2020, 15:38
by fth0
Some random thoughts:

I also read about multicast packets sometimes being a problem. You could try if enabling Promiscuous Mode makes a difference.

To take your (hobby) OS and your self-created SSDP packet out of the equation, you could use a Windows 10 guest for comparison.

Re: Windows 10 Host and SSDP

Posted: 5. Apr 2020, 20:33
by fys
I have tried different combinations of the Promiscuous function to no avail as well. Both the PCnet and the E1000 drivers.

I looked through the VirtualBox driver emulation source code and it does check for for Promiscuous mode.

PCnet:
https://www.virtualbox.org/browser/vbox ... .cpp#L1926

E1000:
https://www.virtualbox.org/browser/vbox ... .cpp#L6566

I haven't yet found anything else for a reason why it doesn't propagate some packets.
Ben

Re: Windows 10 Host and SSDP

Posted: 5. Apr 2020, 21:19
by fys
I installed a Windows 7 Guest and watched it try to Discover. It too sent the SSDP "discover" request, both IPv6 and IPv4. The Windows 10 Host never responded.

The Windows 7 Guest then used the IPv6 and LLMNR protocol to "query" the previously known connection and the Windows 10 Host responded.
(LLMNR = Link-Local Multicast Name Resolution)

The Windows 7 Guest tried twice more with the SSDP protocol, both IPv4 and IPv6, and still no response.

The Windows 10 Host sent a ICMPv6 Solicitation and the Windows 7 responded back with an appropriate ICMPv6 Advertisement.

Maybe there is nothing wrong with VirtualBox and (more importantly) my code. It must be something with Windows 10 not accepting the SSDP request. Though if it doesn't accept my SSDP request, why does it in turn send the same request to me? Doesn't seem fair, does it? I so miss Windows XP, where I still had control of my machine. :-(

Ben

Re: Windows 10 Host and SSDP

Posted: 6. Apr 2020, 02:14
by fth0
In my setup, the Windows 10 guest (using Bridged Mode) and the Windows 10 host both send SSDP discoveries, and both are answered by the NAS device in the same LAN. Maybe Windows in a default configuration doesn't react on SSDP discoveries.