Skip to content

Commit f5d783c

Browse files
idoschkuba-moo
authored andcommitted
selftests: fib_rule_tests: Add port mask match tests
Add tests for FIB rules that match on source and destination ports with a mask. Test both good and bad flows. # ./fib_rule_tests.sh IPv6 FIB rule tests [...] TEST: rule6 check: sport and dport redirect to table [ OK ] TEST: rule6 check: sport and dport no redirect to table [ OK ] TEST: rule6 del by pref: sport and dport redirect to table [ OK ] TEST: rule6 check: sport and dport range redirect to table [ OK ] TEST: rule6 check: sport and dport range no redirect to table [ OK ] TEST: rule6 del by pref: sport and dport range redirect to table [ OK ] TEST: rule6 check: sport and dport masked redirect to table [ OK ] TEST: rule6 check: sport and dport masked no redirect to table [ OK ] TEST: rule6 del by pref: sport and dport masked redirect to table [ OK ] [...] Tests passed: 292 Tests failed: 0 Reviewed-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Guillaume Nault <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 94694aa commit f5d783c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tools/testing/selftests/net/fib_rule_tests.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ fib_rule6_test()
266266
"sport and dport range no redirect to table"
267267
fi
268268

269+
ip rule help 2>&1 | grep sport | grep -q MASK
270+
if [ $? -eq 0 ]; then
271+
match="sport 0x0f00/0xff00 dport 0x000f/0x00ff"
272+
getmatch="sport 0x0f11 dport 0x220f"
273+
getnomatch="sport 0x1f11 dport 0x221f"
274+
fib_rule6_test_match_n_redirect "$match" "$getmatch" \
275+
"$getnomatch" "sport and dport masked redirect to table" \
276+
"sport and dport masked no redirect to table"
277+
fi
278+
269279
fib_check_iproute_support "ipproto" "ipproto"
270280
if [ $? -eq 0 ]; then
271281
match="ipproto tcp"
@@ -543,6 +553,16 @@ fib_rule4_test()
543553
"sport and dport range no redirect to table"
544554
fi
545555

556+
ip rule help 2>&1 | grep sport | grep -q MASK
557+
if [ $? -eq 0 ]; then
558+
match="sport 0x0f00/0xff00 dport 0x000f/0x00ff"
559+
getmatch="sport 0x0f11 dport 0x220f"
560+
getnomatch="sport 0x1f11 dport 0x221f"
561+
fib_rule4_test_match_n_redirect "$match" "$getmatch" \
562+
"$getnomatch" "sport and dport masked redirect to table" \
563+
"sport and dport masked no redirect to table"
564+
fi
565+
546566
fib_check_iproute_support "ipproto" "ipproto"
547567
if [ $? -eq 0 ]; then
548568
match="ipproto tcp"

0 commit comments

Comments
 (0)