Skip to content

net: fib_rules: Add DSCP selector support

Ido Schimmel netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 11 repliesApplied 6/6

Patches in v1 All 6 applied

#Subject and filesSizeRepliesApplied
1/6net: fib_rules: Add DSCP selector attributeinclude/uapi/linux/fib_rules.h net/core/fib_rules.c+3 -11 replyApplied
2/6ipv4: fib_rules: Add DSCP selector supportnet/ipv4/fib_rules.c+50 -41 replyApplied
3/6ipv6: fib_rules: Add DSCP selector supportnet/ipv6/fib6_rules.c+40 -31 replyApplied
4/6net: fib_rules: Enable DSCP selector usagenet/core/fib_rules.c+2 -11 replyApplied
5/6selftests: fib_rule_tests: Add DSCP selector match teststools/testing/selftests/net/fib_rule_tests.sh+34 -01 replyApplied
6/6selftests: fib_rule_tests: Add DSCP selector connect teststools/testing/selftests/net/fib_rule_tests.sh+56 -01 replyApplied

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGuillaume NaultDavid Ahern
SeriesR-b
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 0/6] net: fib_rules: Add DSCP selector support

Currently, the kernel rejects IPv4 FIB rules that try to match on the upper three DSCP bits:

 # ip -4 rule add tos 0x1c table 100
 # ip -4 rule add tos 0x3c table 100
 Error: Invalid tos.

The reason for that is that historically users of the FIB lookup API only populated the lower three DSCP bits in the TOS field of the IPv4 flow key ('flowi4_tos'), which fits the TOS definition from the initial IPv4 specification (RFC 791).

This is not very useful nowadays and instead some users want to be able to match on the six bits DSCP field, which replaced the TOS and IP precedence fields over 25 years ago (RFC 2474). In addition, the current behavior differs between IPv4 and IPv6 which does allow users to match on the entire DSCP field using the TOS selector.

Recent patchsets made sure that callers of the FIB lookup API now populate the entire DSCP field in the IPv4 flow key. Therefore, it is now possible to extend FIB rules to match on DSCP.

This is done by adding a new DSCP attribute which is implemented for both IPv4 and IPv6 to provide user space programs a consistent behavior between both address families.

The behavior of the old TOS selector is unchanged and IPv4 FIB rules using it will only match on the lower three DSCP bits. The kernel will reject rules that try to use both selectors.

Patch #1 adds the new DSCP attribute but rejects its usage.

Patches #2-#3 implement IPv4 and IPv6 support.

Patch #4 allows user space to use the new attribute.

Patches #5-#6 add selftests.

iproute2 changes can be found here [1].

[1] https://github.com/idosch/iproute2/tree/submit/dscp_rfc_v1

Ido Schimmel (6):
net: fib_rules: Add DSCP selector attribute
ipv4: fib_rules: Add DSCP selector support
ipv6: fib_rules: Add DSCP selector support
net: fib_rules: Enable DSCP selector usage
selftests: fib_rule_tests: Add DSCP selector match tests
selftests: fib_rule_tests: Add DSCP selector connect tests

 include/uapi/linux/fib_rules.h                |  1 +
 net/core/fib_rules.c                          |  4 +-
 net/ipv4/fib_rules.c                          | 54 ++++++++++-
 net/ipv6/fib6_rules.c                         | 43 ++++++++-
 tools/testing/selftests/net/fib_rule_tests.sh | 90 +++++++++++++++++++
 5 files changed, 184 insertions(+), 8 deletions(-)
Signature · 1 line
2.46.0