noq-udp: allow setting DSCP (the per-datagram ECN cmsg overwrites the socket's TOS byte)

Open
#874 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
networking

Research direction

Start in noq-udp/src/unix.rs where the per-datagram ECN cmsg sets IP_TOS and IPV6_TCLASS, then check the matching code in apple_fast.rs and the UdpSocketState struct. The issue proposes a set_dscp(u8) setter whose value is ORed into the high six bits of that cmsg, with a default of 0 so behavior is unchanged. Done means a test that reads the TOS byte back via recvmsg for both IPv4 and IPv6. The API shape is still open, so confirm it with the maintainers before writing code.

Written by the indexing model from the issue text.

Description

On Linux/macOS, noq-udp puts an IP_TOS / IPV6_TCLASS cmsg on every datagram carrying only the ECN bits (noq-udp/src/unix.rs ~L676/L681, apple_fast.rs). That cmsg sets the whole TOS byte for the packet, so a DSCP set on the socket with setsockopt(IP_TOS) is overwritten with 0 on every send.

We'd like to mark game traffic as Non-Queue-Building (RFC 9956, DSCP 45) next to ECT(1) for L4S, and right now there's no way to do that through noq-udp.

Proposal: a small UdpSocketState::set_dscp(u8) (stored next to the existing state) that ORs the DSCP into the high six bits of the cmsg value; default 0, so nothing changes for anyone who doesn't call it. We have it working in a vendored copy with a test that reads the TOS byte back via recvmsg for v4 and v6.

Would you take a PR for this? Happy to adjust the API shape.

Dominant language
Rust
Stars
454
Forks
98
Avg merge
2d 8h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from n0-computer/noq

All issues in n0-computer/noq

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.