ipv6: Define dscp_t and stop taking ECN bits into account in fib6-rules
authorGuillaume Nault <gnault@redhat.com>
Fri, 4 Feb 2022 13:58:11 +0000 (14:58 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 8 Feb 2022 04:12:45 +0000 (20:12 -0800)
commita410a0cf98854a698a519bfbeb604145da384c0e
treecfde099cddd235d30a1e37c4aa6939597d26ef12
parent642436a1ad34a28c45bbc2bdc131640a73782356
ipv6: Define dscp_t and stop taking ECN bits into account in fib6-rules

Define a dscp_t type and its appropriate helpers that ensure ECN bits
are not taken into account when handling DSCP.

Use this new type to replace the tclass field of struct fib6_rule, so
that fib6-rules don't get influenced by ECN bits anymore.

Before this patch, fib6-rules didn't make any distinction between the
DSCP and ECN bits. Therefore, rules specifying a DSCP (tos or dsfield
options in iproute2) stopped working as soon a packets had at least one
of its ECN bits set (as a work around one could create four rules for
each DSCP value to match, one for each possible ECN value).

After this patch fib6-rules only compare the DSCP bits. ECN doesn't
influence the result anymore. Also, fib6-rules now must have the ECN
bits cleared or they will be rejected.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Acked-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/inet_dscp.h [new file with mode: 0644]
include/net/ipv6.h
net/ipv6/fib6_rules.c
tools/testing/selftests/net/fib_rule_tests.sh