Page MenuHomeFreeBSD

net: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros
ClosedPublic

Authored by kp on Mar 4 2021, 12:33 PM.

Details

Summary

Introduce convenience macros to retrieve the DSCP, ECN or traffic class
bits from an IPv6 header.

Use them where appropriate.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kp requested review of this revision.Mar 4 2021, 12:33 PM
This revision is now accepted and ready to land.Mar 4 2021, 12:43 PM

there are siimilar constructs in the tcp stack, when checking for ECN (extracting the "common, legacy" TOS byte first:

tcp_input.c:692: iptos = (ntohl(ip6->ip6_flow) >> 20) & 0xff;
tcp_lro.c:1549: iptos = (ntohl(ip6->ip6_flow) >> 20) & 0xff;

perhaps replace those with
iptos = IPV6_DSCP(ip6) | IPV6_ECN(ipv6);
in this patch too?

sys/netinet6/ip6_output.c
661

typo?

kp retitled this revision from net: Introduce IPV6_DSCP() and IPV6_ECN() macros to net: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros.
kp edited the summary of this revision. (Show Details)
This revision now requires review to proceed.Mar 4 2021, 1:18 PM
kp marked an inline comment as done.Mar 4 2021, 1:20 PM

perhaps replace those with
iptos = IPV6_DSCP(ip6) | IPV6_ECN(ipv6);
in this patch too?

We may as well, while we're at it.
I've introduced IPV6_TRAFFIC_CLASS() for that (IPV6_TCLASS already exists), and I found a few more places where it would be suitable.

sys/netinet6/ip6_output.c
661

Whoops. Good catch. I really should have caught that myself.

This revision is now accepted and ready to land.Mar 4 2021, 1:27 PM
This revision was automatically updated to reflect the committed changes.
kp marked an inline comment as done.