GameNetworkingSockets icon indicating copy to clipboard operation
GameNetworkingSockets copied to clipboard

RECVTOS support (including macOS)

Open past-due opened this issue 10 months ago • 0 comments

Saw a commit about disabling IP_RECVTOS support on macOS (ref: https://github.com/ValveSoftware/GameNetworkingSockets/commit/1736cfa48b9be6348b008614c8bf571b053341b0), and I thought I’d make a note of some findings from taking a brief look into it.

Useful references

Configuring UDP Sockets for ECN for Common Platforms: https://www.ietf.org/archive/id/draft-duke-tsvwg-udp-ecn-01.html

macOS support

The documentation I’ve found (including the above) would seem to indicate that this line: https://github.com/ValveSoftware/GameNetworkingSockets/blob/725e273c7442bac7a8bc903c0b210b1c15c34d92/src/steamnetworkingsockets/clientlib/steamnetworkingsockets_lowlevel.cpp#L2487

Should be checking cmsg->cmsg_type != IP_RECVTOS when defined(__APPLE__) (IP_RECVTOS does differ in value from IP_TOS in the macOS SDK headers).

If a UDP message (UDP/IPv4) is received on an IPv4 socket, the ancillary data will contain a cmsg of level IPPROTO_IP and type IP_RECVTOS. The cmsg data contains an unsigned char.

IPv6 support

See the reference document above, which details how to implement this across Linux + macOS + Windows.

past-due avatar May 03 '25 00:05 past-due