]> www.infradead.org Git - users/willy/xarray.git/commitdiff
selftests: fib_rule_tests: Add DSCP selector match tests
authorIdo Schimmel <idosch@nvidia.com>
Wed, 11 Sep 2024 09:37:47 +0000 (12:37 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Sep 2024 04:15:45 +0000 (21:15 -0700)
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>
tools/testing/selftests/net/fib_rule_tests.sh

index 53c5c1ad437e2e1a8a3a6c5694d5326a218eb263..21d11d23fab78529ca0626dfee6cf448100d193e 100755 (executable)
@@ -274,6 +274,23 @@ fib_rule6_test()
                        "$getnomatch" "ipproto ipv6-icmp match" \
                        "ipproto ipv6-tcp no match"
        fi
+
+       fib_check_iproute_support "dscp" "tos"
+       if [ $? -eq 0 ]; then
+               match="dscp 0x3f"
+               getmatch="tos 0xfc"
+               getnomatch="tos 0xf4"
+               fib_rule6_test_match_n_redirect "$match" "$getmatch" \
+                       "$getnomatch" "dscp redirect to table" \
+                       "dscp no redirect to table"
+
+               match="dscp 0x3f"
+               getmatch="from $SRC_IP6 iif $DEV tos 0xfc"
+               getnomatch="from $SRC_IP6 iif $DEV tos 0xf4"
+               fib_rule6_test_match_n_redirect "$match" "$getmatch" \
+                       "$getnomatch" "iif dscp redirect to table" \
+                       "iif dscp no redirect to table"
+       fi
 }
 
 fib_rule6_vrf_test()
@@ -468,6 +485,23 @@ fib_rule4_test()
                        "$getnomatch" "ipproto icmp match" \
                        "ipproto tcp no match"
        fi
+
+       fib_check_iproute_support "dscp" "tos"
+       if [ $? -eq 0 ]; then
+               match="dscp 0x3f"
+               getmatch="tos 0xfc"
+               getnomatch="tos 0xf4"
+               fib_rule4_test_match_n_redirect "$match" "$getmatch" \
+                       "$getnomatch" "dscp redirect to table" \
+                       "dscp no redirect to table"
+
+               match="dscp 0x3f"
+               getmatch="from $SRC_IP iif $DEV tos 0xfc"
+               getnomatch="from $SRC_IP iif $DEV tos 0xf4"
+               fib_rule4_test_match_n_redirect "$match" "$getmatch" \
+                       "$getnomatch" "iif dscp redirect to table" \
+                       "iif dscp no redirect to table"
+       fi
 }
 
 fib_rule4_vrf_test()