Skip to content

Commit ac6ad3f

Browse files
idoschkuba-moo
authored andcommitted
selftests: fib_rule_tests: Add DSCP selector match tests
Add tests for the new FIB rule DSCP selector. Test with both IPv4 and IPv6 and with both input and output routes. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Guillaume Nault <gnault@redhat.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20240911093748.3662015-6-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 4b041d2 commit ac6ad3f

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

tools/testing/selftests/net/fib_rule_tests.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,23 @@ fib_rule6_test()
274274
"$getnomatch" "ipproto ipv6-icmp match" \
275275
"ipproto ipv6-tcp no match"
276276
fi
277+
278+
fib_check_iproute_support "dscp" "tos"
279+
if [ $? -eq 0 ]; then
280+
match="dscp 0x3f"
281+
getmatch="tos 0xfc"
282+
getnomatch="tos 0xf4"
283+
fib_rule6_test_match_n_redirect "$match" "$getmatch" \
284+
"$getnomatch" "dscp redirect to table" \
285+
"dscp no redirect to table"
286+
287+
match="dscp 0x3f"
288+
getmatch="from $SRC_IP6 iif $DEV tos 0xfc"
289+
getnomatch="from $SRC_IP6 iif $DEV tos 0xf4"
290+
fib_rule6_test_match_n_redirect "$match" "$getmatch" \
291+
"$getnomatch" "iif dscp redirect to table" \
292+
"iif dscp no redirect to table"
293+
fi
277294
}
278295

279296
fib_rule6_vrf_test()
@@ -468,6 +485,23 @@ fib_rule4_test()
468485
"$getnomatch" "ipproto icmp match" \
469486
"ipproto tcp no match"
470487
fi
488+
489+
fib_check_iproute_support "dscp" "tos"
490+
if [ $? -eq 0 ]; then
491+
match="dscp 0x3f"
492+
getmatch="tos 0xfc"
493+
getnomatch="tos 0xf4"
494+
fib_rule4_test_match_n_redirect "$match" "$getmatch" \
495+
"$getnomatch" "dscp redirect to table" \
496+
"dscp no redirect to table"
497+
498+
match="dscp 0x3f"
499+
getmatch="from $SRC_IP iif $DEV tos 0xfc"
500+
getnomatch="from $SRC_IP iif $DEV tos 0xf4"
501+
fib_rule4_test_match_n_redirect "$match" "$getmatch" \
502+
"$getnomatch" "iif dscp redirect to table" \
503+
"iif dscp no redirect to table"
504+
fi
471505
}
472506

473507
fib_rule4_vrf_test()

0 commit comments

Comments
 (0)