Description
Saw a commit about disabling IP_RECVTOS
support on macOS (ref: 1736cfa), 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:
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.