12

The short version: I am trying to set the IP_TOS field on the traffic my application is sending and even though setsockopt returns successfully and getsockopt returns the correct IP_TOS value, the traffic is untagged when leaving the Windows 10 box.

The longer version: I have an application that sends traffic that needs to have the IP_TOS field set and the IP_TOS value can be one in a range of values; it's an environment requirement so there is no way around it. The application also needs to be cross-platform (Windows 10 and Linux). Considering those requirements, we decided to just use boost asio and set the IP_TOS on the socket when it's created.

The Linux side works the way we want, socket is created, IP_TOS is set, data is sent, and tcpdump shows the data is correctly tagged on the send and receive sides.

The Windows side does everything except for actually tag the traffic. The socket is created, IP_TOS is set and read back to verify before sending, however wireshark/tcpdump shows that the traffic is not tagged at all (IP_TOS is 0). When we started to see issues with this, we created a simple test app using normal Windows TCP sockets, set and read IP_TOS using setsockopt and getsockopt and still had the same issues.

My google-fu can be weak at times, but information on Windows 10 support of IP_TOS seems rather sparse. I have one MSDN Doc say both to not use it (instead use the QoS API) but that it's supported in Windows 10 which I assumed meant it could be set. I also have an older support doc that says support has to be enabled, but I can't find a more recent document relevant to Windows 10. I did try the registry tweak, plus a second one (Do not use NLA) and that didn't help.

I'm at a bit of a loss now, so I'm hoping someone has dealt with this before and has a solution to setting IP_TOS on a socket. Really trying to avoid bringing in another API or making calls outside the application (netsh or group policy) to achieve something that should be simple.

phill
  • 466
  • 7
  • 17
  • 1
    "***Do not use**. Type of Service (TOS) settings should only be set using the Quality of Service API.*" - seems pretty definitive to me. – Remy Lebeau Sep 16 '19 at 05:02
  • 1
    Yet another example of Windows trying to do simple, standard things in overly complex non-standard ways. – dbush Sep 16 '19 at 12:53
  • It's tangentially worth noting that Windows 10 IoT Core does not support the QoS APIs: neither QOSSetFlow nor Traffic Control APIs are available. Without IP_TOS, it is not clear how traffic can be tagged on IoT Core, which is required for conformance on some protocols. – Dave Ruske Jan 20 '20 at 16:18

1 Answers1

1

TOS is disabled by default in OS(Imperfect)

To enable TOS use regedit: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DisableUserTOSSetting

Please see: Setting Type of Service (TOS) Bits

user20716902
  • 861
  • 1
  • 14
zzz3265
  • 11
  • 1