OSDN Git Service

ipv4: Stop taking ECN bits into account in fib4-rules
authorGuillaume Nault <gnault@redhat.com>
Fri, 4 Feb 2022 13:58:14 +0000 (14:58 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 8 Feb 2022 04:12:46 +0000 (20:12 -0800)
commit563f8e97e054451d167327336a53b7381517a998
treea3dd5f35304c41a1be2d3be1fbdfc7bf3622d3c1
parenta410a0cf98854a698a519bfbeb604145da384c0e
ipv4: Stop taking ECN bits into account in fib4-rules

Use the new dscp_t type to replace the tos field of struct fib4_rule,
so that fib4-rules consistently ignore ECN bits.

Before this patch, fib4-rules did accept rules with the high order ECN
bit set (but not the low order one). Also, it relied on its callers
masking the ECN bits of ->flowi4_tos to prevent those from influencing
the result. This was brittle and a few call paths still do the lookup
without masking the ECN bits first.

After this patch fib4-rules only compare the DSCP bits. ECN can't
influence the result anymore, even if the caller didn't mask these
bits. Also, fib4-rules now must have both 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>
net/ipv4/fib_rules.c
tools/testing/selftests/net/fib_rule_tests.sh