diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh index 75d922438bc9768827a2d12a6ac2b1044e1d0f37..d8313d0438b7422df129f2fe5868236119eca991 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding" NUM_NETIFS=4 CHECK_TC="yes" source lib.sh @@ -75,14 +76,31 @@ cleanup() vrf_cleanup } +ping_ipv4() +{ + ping_test $h1 192.0.2.2 +} + +ping_ipv6() +{ + ping6_test $h1 2001:db8:1::2 +} + +learning() +{ + learning_test "br0" $swp1 $h1 $h2 +} + +flooding() +{ + flood_test $swp2 $h1 $h2 +} + trap cleanup EXIT setup_prepare setup_wait -ping_test $h1 192.0.2.2 -ping6_test $h1 2001:db8:1::2 -learning_test "br0" $swp1 $h1 $h2 -flood_test $swp2 $h1 $h2 +tests_run exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh index 1cddf06f691dd892fa2c922dfa8c26a023ee32e2..c15c6c85c9849ba768e74c478028a2d837c40426 100755 --- a/tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh +++ b/tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding" NUM_NETIFS=4 source lib.sh @@ -73,14 +74,31 @@ cleanup() vrf_cleanup } +ping_ipv4() +{ + ping_test $h1 192.0.2.2 +} + +ping_ipv6() +{ + ping6_test $h1 2001:db8:1::2 +} + +learning() +{ + learning_test "br0" $swp1 $h1 $h2 +} + +flooding() +{ + flood_test $swp2 $h1 $h2 +} + trap cleanup EXIT setup_prepare setup_wait -ping_test $h1 192.0.2.2 -ping6_test $h1 2001:db8:1::2 -learning_test "br0" $swp1 $h1 $h2 -flood_test $swp2 $h1 $h2 +tests_run exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index a066ca536ac41b72b200a87164febe69ffe32ec5..061c87bbf77ce05c50106c6f798dbcedcd9c18a6 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -477,6 +477,15 @@ matchall_sink_create() action drop } +tests_run() +{ + local current_test + + for current_test in ${TESTS:-$ALL_TESTS}; do + $current_test + done +} + ############################################################################## # Tests diff --git a/tools/testing/selftests/net/forwarding/mirror_gre.sh b/tools/testing/selftests/net/forwarding/mirror_gre.sh index a8abc736f67c85d5f733eb28e26fb59437ade108..c6786d1b2b96a15d124d0c8e95b2d66a432a2244 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre.sh @@ -10,6 +10,14 @@ # traffic. Test that the payload is what is expected (ICMP ping request or # reply, depending on test). +ALL_TESTS=" + test_gretap + test_ip6gretap + test_gretap_mac + test_ip6gretap_mac + test_two_spans +" + NUM_NETIFS=6 source lib.sh source mirror_lib.sh @@ -100,22 +108,36 @@ test_two_spans() log_test "two simultaneously configured mirrors ($tcflags)" } -test_all() +test_gretap() { - slow_path_trap_install $swp1 ingress - slow_path_trap_install $swp1 egress - full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap" - full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap" full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap" +} + +test_ip6gretap() +{ + full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap" full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap" +} +test_gretap_mac() +{ test_span_gre_mac gt4 ingress ip "mirror to gretap" - test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap" test_span_gre_mac gt4 egress ip "mirror to gretap" +} + +test_ip6gretap_mac() +{ + test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap" test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap" +} - test_two_spans +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + tests_run slow_path_trap_uninstall $swp1 egress slow_path_trap_uninstall $swp1 ingress diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_bound.sh b/tools/testing/selftests/net/forwarding/mirror_gre_bound.sh index 3708ac0f400a5687b671362e4f85c2d992ebcc4e..360ca133bead6e6cea2bbdc712e062a391d81c82 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_bound.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_bound.sh @@ -42,6 +42,11 @@ # underlay manner, i.e. with a bound dummy device that marks underlay VRF where # the encapsulated packed should be routed. +ALL_TESTS=" + test_gretap + test_ip6gretap +" + NUM_NETIFS=6 source lib.sh source mirror_lib.sh @@ -178,6 +183,18 @@ cleanup() vrf_cleanup } +test_gretap() +{ + full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap w/ UL" + full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap w/ UL" +} + +test_ip6gretap() +{ + full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap w/ UL" + full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap w/ UL" +} + test_all() { RET=0 @@ -185,11 +202,7 @@ test_all() slow_path_trap_install $swp1 ingress slow_path_trap_install $swp1 egress - full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap w/ UL" - full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap w/ UL" - - full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap w/ UL" - full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap w/ UL" + tests_run slow_path_trap_uninstall $swp1 egress slow_path_trap_uninstall $swp1 ingress diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh index 0ed288ac76d20cdfe9af67caf19b2f4fc671e45e..fdb612f69613326ef9d5c9d1892a4002dabc2c4f 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh @@ -7,6 +7,13 @@ # Test how mirrors to gretap and ip6gretap react to changes to relevant # configuration. +ALL_TESTS=" + test_ttl + test_tun_up + test_egress_up + test_remote_ip +" + NUM_NETIFS=6 source lib.sh source mirror_lib.sh @@ -155,22 +162,36 @@ test_span_gre_remote_ip() log_test "$what: remote address change ($tcflags)" } -test_all() +test_ttl() { - slow_path_trap_install $swp1 ingress - slow_path_trap_install $swp1 egress - test_span_gre_ttl gt4 gretap ip "mirror to gretap" test_span_gre_ttl gt6 ip6gretap ipv6 "mirror to ip6gretap" +} +test_tun_up() +{ test_span_gre_tun_up gt4 "mirror to gretap" test_span_gre_tun_up gt6 "mirror to ip6gretap" +} +test_egress_up() +{ test_span_gre_egress_up gt4 192.0.2.130 "mirror to gretap" test_span_gre_egress_up gt6 2001:db8:2::2 "mirror to ip6gretap" +} +test_remote_ip() +{ test_span_gre_remote_ip gt4 gretap 192.0.2.130 192.0.2.132 "mirror to gretap" test_span_gre_remote_ip gt6 ip6gretap 2001:db8:2::2 2001:db8:2::4 "mirror to ip6gretap" +} + +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + tests_run slow_path_trap_uninstall $swp1 egress slow_path_trap_uninstall $swp1 ingress diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh b/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh index 178a42d771aa64eb892dfd0fbc9e5ae3b597cd28..2e54407d8954cff29bdef8763f1d332cf1286111 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_flower.sh @@ -10,6 +10,11 @@ # this address, mirroring takes place, whereas when pinging the other one, # there's no mirroring. +ALL_TESTS=" + test_gretap + test_ip6gretap +" + NUM_NETIFS=6 source lib.sh source mirror_lib.sh @@ -81,6 +86,18 @@ full_test_span_gre_dir_acl() log_test "$direction $what ($tcflags)" } +test_gretap() +{ + full_test_span_gre_dir_acl gt4 ingress 8 0 192.0.2.4 "ACL mirror to gretap" + full_test_span_gre_dir_acl gt4 egress 0 8 192.0.2.3 "ACL mirror to gretap" +} + +test_ip6gretap() +{ + full_test_span_gre_dir_acl gt6 ingress 8 0 192.0.2.4 "ACL mirror to ip6gretap" + full_test_span_gre_dir_acl gt6 egress 0 8 192.0.2.3 "ACL mirror to ip6gretap" +} + test_all() { RET=0 @@ -88,11 +105,7 @@ test_all() slow_path_trap_install $swp1 ingress slow_path_trap_install $swp1 egress - full_test_span_gre_dir_acl gt4 ingress 8 0 192.0.2.4 "ACL mirror to gretap" - full_test_span_gre_dir_acl gt6 ingress 8 0 192.0.2.4 "ACL mirror to ip6gretap" - - full_test_span_gre_dir_acl gt4 egress 0 8 192.0.2.3 "ACL mirror to gretap" - full_test_span_gre_dir_acl gt6 egress 0 8 192.0.2.3 "ACL mirror to ip6gretap" + tests_run slow_path_trap_uninstall $swp1 egress slow_path_trap_uninstall $swp1 ingress diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh b/tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh index 1ca29ba4f33862d71804b56b4cf894704ff3ac16..fc0508e40fca6818e42190d437bfa6fed46b40aa 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh @@ -9,6 +9,11 @@ # is set up. Later on, the neighbor is deleted and it is expected to be # reinitialized using the usual ARP process, and the mirroring offload updated. +ALL_TESTS=" + test_gretap + test_ip6gretap +" + NUM_NETIFS=6 source lib.sh source mirror_lib.sh @@ -69,15 +74,24 @@ test_span_gre_neigh() log_test "$direction $what: neighbor change ($tcflags)" } -test_all() +test_gretap() { - slow_path_trap_install $swp1 ingress - slow_path_trap_install $swp1 egress - test_span_gre_neigh 192.0.2.130 gt4 ingress "mirror to gretap" test_span_gre_neigh 192.0.2.130 gt4 egress "mirror to gretap" +} + +test_ip6gretap() +{ test_span_gre_neigh 2001:db8:2::2 gt6 ingress "mirror to ip6gretap" test_span_gre_neigh 2001:db8:2::2 gt6 egress "mirror to ip6gretap" +} + +test_all() +{ + slow_path_trap_install $swp1 ingress + slow_path_trap_install $swp1 egress + + tests_run slow_path_trap_uninstall $swp1 egress slow_path_trap_uninstall $swp1 ingress diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh b/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh index 9ac70978541f37c88858b7a0899fe08f38dc1853..a0d1ad46a2bcae68f70cd575c166b40eb2fb9e5a 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh @@ -7,6 +7,11 @@ # Test that gretap and ip6gretap mirroring works when the other tunnel endpoint # is reachable through a next-hop route (as opposed to directly-attached route). +ALL_TESTS=" + test_gretap + test_ip6gretap +" + NUM_NETIFS=6 source lib.sh source mirror_lib.sh @@ -92,8 +97,7 @@ test_all() slow_path_trap_install $swp1 ingress slow_path_trap_install $swp1 egress - test_gretap - test_ip6gretap + tests_run slow_path_trap_uninstall $swp1 egress slow_path_trap_uninstall $swp1 ingress diff --git a/tools/testing/selftests/net/forwarding/router.sh b/tools/testing/selftests/net/forwarding/router.sh index cc6a14abfa87a84a3202ed24755f3da9cb089e1d..a75cb51cc5bd851e838df91c996d673afe6dde6e 100755 --- a/tools/testing/selftests/net/forwarding/router.sh +++ b/tools/testing/selftests/net/forwarding/router.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="ping_ipv4 ping_ipv6" NUM_NETIFS=4 source lib.sh @@ -114,12 +115,21 @@ cleanup() vrf_cleanup } +ping_ipv4() +{ + ping_test $h1 198.51.100.2 +} + +ping_ipv6() +{ + ping6_test $h1 2001:db8:2::2 +} + trap cleanup EXIT setup_prepare setup_wait -ping_test $h1 198.51.100.2 -ping6_test $h1 2001:db8:2::2 +tests_run exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/router_multipath.sh b/tools/testing/selftests/net/forwarding/router_multipath.sh index 2bd3d41354d0955cb366b2597737df2f0c4c429d..6c43762896953aabef9285e6b9c0715c890e70e2 100755 --- a/tools/testing/selftests/net/forwarding/router_multipath.sh +++ b/tools/testing/selftests/net/forwarding/router_multipath.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="ping_ipv4 ping_ipv6 multipath_test" NUM_NETIFS=8 source lib.sh @@ -364,13 +365,21 @@ cleanup() vrf_cleanup } +ping_ipv4() +{ + ping_test $h1 198.51.100.2 +} + +ping_ipv6() +{ + ping6_test $h1 2001:db8:2::2 +} + trap cleanup EXIT setup_prepare setup_wait -ping_test $h1 198.51.100.2 -ping6_test $h1 2001:db8:2::2 -multipath_test +tests_run exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/tc_actions.sh b/tools/testing/selftests/net/forwarding/tc_actions.sh index 3a6385ebd5d0f8d526e152191673c65b120dfe3c..813d02d1939dd2cbbcc3bc55c8f1a71a074edc2f 100755 --- a/tools/testing/selftests/net/forwarding/tc_actions.sh +++ b/tools/testing/selftests/net/forwarding/tc_actions.sh @@ -1,6 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="gact_drop_and_ok_test mirred_egress_redirect_test \ + mirred_egress_mirror_test gact_trap_test" NUM_NETIFS=4 source tc_common.sh source lib.sh @@ -111,6 +113,10 @@ gact_trap_test() { RET=0 + if [[ "$tcflags" != "skip_sw" ]]; then + return 0; + fi + tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \ skip_hw dst_ip 192.0.2.2 action drop tc filter add dev $swp1 ingress protocol ip pref 3 handle 103 flower \ @@ -179,24 +185,29 @@ cleanup() ip link set $swp1 address $swp1origmac } +mirred_egress_redirect_test() +{ + mirred_egress_test "redirect" +} + +mirred_egress_mirror_test() +{ + mirred_egress_test "mirror" +} + trap cleanup EXIT setup_prepare setup_wait -gact_drop_and_ok_test -mirred_egress_test "redirect" -mirred_egress_test "mirror" +tests_run tc_offload_check if [[ $? -ne 0 ]]; then log_info "Could not test offloaded functionality" else tcflags="skip_sw" - gact_drop_and_ok_test - mirred_egress_test "redirect" - mirred_egress_test "mirror" - gact_trap_test + tests_run fi exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/tc_chains.sh b/tools/testing/selftests/net/forwarding/tc_chains.sh index 2fd15226974b22d11449427d7b1bbf3b9f01d7cc..d2c783e94df3d6a5f160215fc11777b6b22b283e 100755 --- a/tools/testing/selftests/net/forwarding/tc_chains.sh +++ b/tools/testing/selftests/net/forwarding/tc_chains.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="unreachable_chain_test gact_goto_chain_test" NUM_NETIFS=2 source tc_common.sh source lib.sh @@ -107,16 +108,14 @@ trap cleanup EXIT setup_prepare setup_wait -unreachable_chain_test -gact_goto_chain_test +tests_run tc_offload_check if [[ $? -ne 0 ]]; then log_info "Could not test offloaded functionality" else tcflags="skip_sw" - unreachable_chain_test - gact_goto_chain_test + tests_run fi exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/tc_flower.sh b/tools/testing/selftests/net/forwarding/tc_flower.sh index 0c54059f1875c7ea227efbbfb3288d7c93ee6374..20d1077e5a3de9cb8ad9186d866837421b84d518 100755 --- a/tools/testing/selftests/net/forwarding/tc_flower.sh +++ b/tools/testing/selftests/net/forwarding/tc_flower.sh @@ -1,6 +1,8 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="match_dst_mac_test match_src_mac_test match_dst_ip_test \ + match_src_ip_test match_ip_flags_test" NUM_NETIFS=2 source tc_common.sh source lib.sh @@ -245,22 +247,14 @@ trap cleanup EXIT setup_prepare setup_wait -match_dst_mac_test -match_src_mac_test -match_dst_ip_test -match_src_ip_test -match_ip_flags_test +tests_run tc_offload_check if [[ $? -ne 0 ]]; then log_info "Could not test offloaded functionality" else tcflags="skip_sw" - match_dst_mac_test - match_src_mac_test - match_dst_ip_test - match_src_ip_test - match_ip_flags_test + tests_run fi exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/forwarding/tc_shblocks.sh b/tools/testing/selftests/net/forwarding/tc_shblocks.sh index 077b98048ef4886c5ff0533ca8e3b459a7b346a0..b5b91720381561efa48d2f664afc3af7b84671c1 100755 --- a/tools/testing/selftests/net/forwarding/tc_shblocks.sh +++ b/tools/testing/selftests/net/forwarding/tc_shblocks.sh @@ -1,6 +1,7 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +ALL_TESTS="shared_block_test" NUM_NETIFS=4 source tc_common.sh source lib.sh @@ -109,14 +110,14 @@ trap cleanup EXIT setup_prepare setup_wait -shared_block_test +tests_run tc_offload_check if [[ $? -ne 0 ]]; then log_info "Could not test offloaded functionality" else tcflags="skip_sw" - shared_block_test + tests_run fi exit $EXIT_STATUS