Skip to content

RECVTOS support (including macOS) #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
past-due opened this issue May 3, 2025 · 0 comments
Open

RECVTOS support (including macOS) #376

past-due opened this issue May 3, 2025 · 0 comments

Comments

@past-due
Copy link
Contributor

past-due commented May 3, 2025

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:

if ( unlikely( cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_TOS ) )

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant