Skip to contentSkip to conversation

selftests: forwarding: Various fixes

PATCH Applied Ido Schimmel 6 participants 27 messages Aug 8, 2023 – Aug 10, 2023

Subsystems (4)
lore
Share & tools
lore

Ido Schimmel

author maintainer
#0 lore raw

v2 cover selftests: forwarding: Various fixes

Fix various problems with forwarding selftests. See individual patches for problem description and solution.

v2:
* Patch #10: Probe for MAC Merge support.

Ido Schimmel (17):
selftests: forwarding: Skip test when no interfaces are specified
selftests: forwarding: Switch off timeout
selftests: forwarding: bridge_mdb: Check iproute2 version
selftests: forwarding: bridge_mdb_max: Check iproute2 version
selftests: forwarding: Set default IPv6 traceroute utility
selftests: forwarding: Add a helper to skip test when using veth pairs
selftests: forwarding: ethtool: Skip when using veth pairs
selftests: forwarding: ethtool_extended_state: Skip when using veth
pairs
selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs
selftests: forwarding: ethtool_mm: Skip when MAC Merge is not
supported
selftests: forwarding: tc_actions: Use ncat instead of nc
selftests: forwarding: tc_flower: Relax success criterion
selftests: forwarding: tc_tunnel_key: Make filters more specific
selftests: forwarding: tc_flower_l2_miss: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Fix failing test with old libnet
selftests: forwarding: bridge_mdb_max: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Make test more robust

 .../selftests/net/forwarding/bridge_mdb.sh    | 59 +++++++++++--------
 .../net/forwarding/bridge_mdb_max.sh          | 19 ++++--
 .../selftests/net/forwarding/ethtool.sh       |  2 +
 .../net/forwarding/ethtool_extended_state.sh  |  2 +
 .../selftests/net/forwarding/ethtool_mm.sh    | 18 ++++--
 .../net/forwarding/hw_stats_l3_gre.sh         |  2 +
 .../net/forwarding/ip6_forward_instats_vrf.sh |  2 +
 tools/testing/selftests/net/forwarding/lib.sh | 17 ++++++
 .../testing/selftests/net/forwarding/settings |  1 +
 .../selftests/net/forwarding/tc_actions.sh    |  6 +-
 .../selftests/net/forwarding/tc_flower.sh     |  8 +--
 .../net/forwarding/tc_flower_l2_miss.sh       | 13 ++--
 .../selftests/net/forwarding/tc_tunnel_key.sh |  9 ++-
 13 files changed, 109 insertions(+), 49 deletions(-)
 create mode 100644 tools/testing/selftests/net/forwarding/settings
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH v2 1/17 selftests: forwarding: Skip test when no interfaces are specified

As explained in [1], the forwarding selftests are meant to be run with either physical loopbacks or veth pairs. The interfaces are expected to be specified in a user-provided forwarding.config file or as command line arguments. By default, this file is not present and the tests fail:

 # make -C tools/testing/selftests TARGETS=net/forwarding run_tests
 [...]
 TAP version 13
 1..102
 # timeout set to 45
 # selftests: net/forwarding: bridge_igmp.sh
 # Command line is not complete. Try option "help"
 # Failed to create netif
 not ok 1 selftests: net/forwarding: bridge_igmp.sh # exit=1
 [...]

Fix by skipping a test if interfaces are not provided either via the configuration file or command line arguments.

 # make -C tools/testing/selftests TARGETS=net/forwarding run_tests
 [...]
 TAP version 13
 1..102
 # timeout set to 45
 # selftests: net/forwarding: bridge_igmp.sh
 # SKIP: Cannot create interface. Name not specified
 ok 1 selftests: net/forwarding: bridge_igmp.sh # SKIP

[1] tools/testing/selftests/net/forwarding/README

Fixes 81573b18f26d ("selftests/net/forwarding: add Makefile to install tests")
---
 tools/testing/selftests/net/forwarding/lib.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/net/forwarding/lib.sh +5 -0
index 9ddb68dd6a08..975fc5168c63 100755
@@ -225,6 +225,11 @@ create_netif_veth()
 	for ((i = 1; i <= NUM_NETIFS; ++i)); do
 		local j=$((i+1))
 
+		if [ -z ${NETIFS[p$i]} ]; then
+			echo "SKIP: Cannot create interface. Name not specified"
+			exit $ksft_skip
+		fi
+
 		ip link show dev ${NETIFS[p$i]} &> /dev/null
 		if [[ $? -ne 0 ]]; then
 			ip link add ${NETIFS[p$i]} type veth \
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH v2 2/17 selftests: forwarding: Switch off timeout

In reply to Ido Schimmel

The default timeout for selftests is 45 seconds, but it is not enough for forwarding selftests which can takes minutes to finish depending on the number of tests cases:

 # make -C tools/testing/selftests TARGETS=net/forwarding run_tests
 TAP version 13
 1..102
 # timeout set to 45
 # selftests: net/forwarding: bridge_igmp.sh
 # TEST: IGMPv2 report 239.10.10.10                                    [ OK ]
 # TEST: IGMPv2 leave 239.10.10.10                                     [ OK ]
 # TEST: IGMPv3 report 239.10.10.10 is_include                         [ OK ]
 # TEST: IGMPv3 report 239.10.10.10 include -> allow                   [ OK ]
 #
 not ok 1 selftests: net/forwarding: bridge_igmp.sh # TIMEOUT 45 seconds

Fix by switching off the timeout and setting it to 0. A similar change was done for BPF selftests in commit 6fc5916cc256 ("selftests: bpf:
Switch off timeout").

Fixes 81573b18f26d ("selftests/net/forwarding: add Makefile to install tests")
---
 tools/testing/selftests/net/forwarding/settings | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/testing/selftests/net/forwarding/settings
tools/testing/selftests/net/forwarding/settings new file +1 -0
new file mode 100644
index 000000000000..e7b9417537fb
@@ -0,0 +1 @@
+timeout=0
Signature · 1 line
2.40.1
author maintainer
#3 lore raw

PATCH v2 3/17 selftests: forwarding: bridge_mdb: Check iproute2 version

In reply to Ido Schimmel

The selftest relies on iproute2 changes present in version 6.3, but the test does not check for it, resulting in error:

 # ./bridge_mdb.sh

INFO: # Host entries configuration tests
TEST: Common host entries configuration tests (IPv4) [FAIL]
Managed to add IPv4 host entry with a filter mode
TEST: Common host entries configuration tests (IPv6) [FAIL]
Managed to add IPv6 host entry with a filter mode
TEST: Common host entries configuration tests (L2) [FAIL]
Managed to add L2 host entry with a filter mode

INFO: # Port group entries configuration tests - (*, G) Command "replace" is unknown, try "bridge mdb help". [...]

Fix by skipping the test if iproute2 is too old.

---
 tools/testing/selftests/net/forwarding/bridge_mdb.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/net/forwarding/bridge_mdb.sh +5 -0
index ae3f9462a2b6..6f830b5f03c9 100755
@@ -1206,6 +1206,11 @@ ctrl_test()
 	ctrl_mldv2_is_in_test
 }
 
+if ! bridge mdb help 2>&1 | grep -q "replace"; then
+	echo "SKIP: iproute2 too old, missing bridge mdb replace support"
+	exit $ksft_skip
+fi
+
 trap cleanup EXIT
 
 setup_prepare
Signature · 1 line
2.40.1
author maintainer
#4 lore raw

PATCH v2 4/17 selftests: forwarding: bridge_mdb_max: Check iproute2 version

In reply to Ido Schimmel

The selftest relies on iproute2 changes present in version 6.3, but the test does not check for it, resulting in errors:

 # ./bridge_mdb_max.sh
  INFO: 802.1d tests
  TEST: cfg4: port: ngroups reporting                                 [FAIL]
          Number of groups was null, now is null, but 5 expected
  TEST: ctl4: port: ngroups reporting                                 [FAIL]
          Number of groups was null, now is null, but 5 expected
  TEST: cfg6: port: ngroups reporting                                 [FAIL]
          Number of groups was null, now is null, but 5 expected
  [...]

Fix by skipping the test if iproute2 is too old.

Fixes 3446dcd7df05 ("selftests: forwarding: bridge_mdb_max: Add a new selftest")
---
 tools/testing/selftests/net/forwarding/bridge_mdb_max.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/testing/selftests/net/forwarding/bridge_mdb_max.sh +5 -0
index ae255b662ba3..fa762b716288 100755
@@ -1328,6 +1328,11 @@ test_8021qvs()
 	switch_destroy
 }
 
+if ! bridge link help 2>&1 | grep -q "mcast_max_groups"; then
+	echo "SKIP: iproute2 too old, missing bridge \"mcast_max_groups\" support"
+	exit $ksft_skip
+fi
+
 trap cleanup EXIT
 
 setup_prepare
Signature · 1 line
2.40.1
author maintainer
#5 lore raw

PATCH v2 5/17 selftests: forwarding: Set default IPv6 traceroute utility

In reply to Ido Schimmel

The test uses the 'TROUTE6' environment variable to encode the name of the IPv6 traceroute utility. By default (without a configuration file), this variable is not set, resulting in failures:

 # ./ip6_forward_instats_vrf.sh
 TEST: ping6                                                         [ OK ]
 TEST: Ip6InTooBigErrors                                             [ OK ]
 TEST: Ip6InHdrErrors                                                [FAIL]
 TEST: Ip6InAddrErrors                                               [ OK ]
 TEST: Ip6InDiscards                                                 [ OK ]

Fix by setting a default utility name and skip the test if the utility is not present.

Fixes 0857d6f8c759 ("ipv6: When forwarding count rx stats on the orig netdev")

---
Cc: [email protected]

---
 .../testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh | 2 ++
 tools/testing/selftests/net/forwarding/lib.sh                   | 1 +
 2 files changed, 3 insertions(+)
tools/testing/selftests/net/forwarding/ip6_forward_instats_vrf.sh +2 -0
index 9f5b3e2e5e95..49fa94b53a1c 100755
@@ -14,6 +14,8 @@ ALL_TESTS="
 NUM_NETIFS=4
 source lib.sh
 
+require_command $TROUTE6
+
 h1_create()
 {
 	simple_if_init $h1 2001:1:1::2/64
tools/testing/selftests/net/forwarding/lib.sh +1 -0
index 975fc5168c63..40a8c1541b7f 100755
@@ -30,6 +30,7 @@ REQUIRE_MZ=${REQUIRE_MZ:=yes}
 REQUIRE_MTOOLS=${REQUIRE_MTOOLS:=no}
 STABLE_MAC_ADDRS=${STABLE_MAC_ADDRS:=no}
 TCPDUMP_EXTRA_FLAGS=${TCPDUMP_EXTRA_FLAGS:=}
+TROUTE6=${TROUTE6:=traceroute6}
 
 relative_path="${BASH_SOURCE%/*}"
 if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
Signature · 1 line
2.40.1
author maintainer
#6 lore raw

PATCH v2 6/17 selftests: forwarding: Add a helper to skip test when using veth pairs

In reply to Ido Schimmel

A handful of tests require physical loopbacks to be used instead of veth pairs. Add a helper that these tests will invoke in order to be skipped when executed with veth pairs.

Fixes 64916b57c0b1 ("selftests: forwarding: Add speed and auto-negotiation test")
---
 tools/testing/selftests/net/forwarding/lib.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/testing/selftests/net/forwarding/lib.sh +11 -0
index 40a8c1541b7f..f69015bf2dea 100755
@@ -164,6 +164,17 @@ check_port_mab_support()
 	fi
 }
 
+skip_on_veth()
+{
+	local kind=$(ip -j -d link show dev ${NETIFS[p1]} |
+		jq -r '.[].linkinfo.info_kind')
+
+	if [[ $kind == veth ]]; then
+		echo "SKIP: Test cannot be run with veth pairs"
+		exit $ksft_skip
+	fi
+}
+
 if [[ "$(id -u)" -ne 0 ]]; then
 	echo "SKIP: need root privileges"
 	exit $ksft_skip
Signature · 1 line
2.40.1
#7 lore raw

Re: [PATCH net v2 06/17] selftests: forwarding: Add a helper to skip test when using veth pairs

Quoted 3 lines · Ido Schimmel

A handful of tests require physical loopbacks to be used instead of veth pairs. Add a helper that these tests will invoke in order to be skipped when executed with veth pairs.

Hi Ido,

How to create physical loopbacks?

Thanks
Hangbin

#8 lore raw

Re: [PATCH net v2 06/17] selftests: forwarding: Add a helper to skip test when using veth pairs

Quoted 8 lines · Hangbin Liu
Quoted 3 lines · Ido Schimmel

A handful of tests require physical loopbacks to be used instead of veth pairs. Add a helper that these tests will invoke in order to be skipped when executed with veth pairs.

Hi Ido,

How to create physical loopbacks?

It's the same concept as veth. Take two physical ports and connect them with a cable.

#9 lore raw

Re: [PATCH net v2 06/17] selftests: forwarding: Add a helper to skip test when using veth pairs

Quoted 6 lines · Ido Schimmel
Quoted 5 lines · Hangbin Liu
Quoted 3 lines · Ido Schimmel

A handful of tests require physical loopbacks to be used instead of veth pairs. Add a helper that these tests will invoke in order to be skipped when executed with veth pairs.

Quoted 6 lines
Quoted 3 lines

Hi Ido,

How to create physical loopbacks?

It's the same concept as veth. Take two physical ports and connect them with a cable.

With a cable.. Thanks, haha!

Hangbin

author maintainer
#10 lore raw

PATCH v2 7/17 selftests: forwarding: ethtool: Skip when using veth pairs

In reply to Ido Schimmel

Auto-negotiation cannot be tested with veth pairs, resulting in failures:

 # ./ethtool.sh
 TEST: force of same speed autoneg off                               [FAIL]
         error in configuration. swp1 speed Not autoneg off
 [...]

Fix by skipping the test when used with veth pairs.

Fixes 64916b57c0b1 ("selftests: forwarding: Add speed and auto-negotiation test")
---
 tools/testing/selftests/net/forwarding/ethtool.sh | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/net/forwarding/ethtool.sh +2 -0
index dbb9fcf759e0..aa2eafb7b243 100755
@@ -286,6 +286,8 @@ different_speeds_autoneg_on()
 	ethtool -s $h1 autoneg on
 }
 
+skip_on_veth
+
 trap cleanup EXIT
 
 setup_prepare
Signature · 1 line
2.40.1
author maintainer
#11 lore raw

PATCH v2 8/17 selftests: forwarding: ethtool_extended_state: Skip when using veth pairs

In reply to Ido Schimmel

Ethtool extended state cannot be tested with veth pairs, resulting in failures:

 # ./ethtool_extended_state.sh
 TEST: Autoneg, No partner detected                                  [FAIL]
         Expected "Autoneg", got "Link detected: no"
 [...]

Fix by skipping the test when used with veth pairs.

Fixes 7d10bcce98cd ("selftests: forwarding: Add tests for ethtool extended state")
---
 .../testing/selftests/net/forwarding/ethtool_extended_state.sh  | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/net/forwarding/ethtool_extended_state.sh +2 -0
index 072faa77f53b..17f89c3b7c02 100755
@@ -108,6 +108,8 @@ no_cable()
 	ip link set dev $swp3 down
 }
 
+skip_on_veth
+
 setup_prepare
 
 tests_run
Signature · 1 line
2.40.1
author maintainer
#12 lore raw

PATCH v2 9/17 selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs

In reply to Ido Schimmel

Layer 3 hardware stats cannot be used when the underlying interfaces are veth pairs, resulting in failures:

 # ./hw_stats_l3_gre.sh
 TEST: ping gre flat                                                 [ OK ]
 TEST: Test rx packets:                                              [FAIL]
         Traffic not reflected in the counter: 0 -> 0
 TEST: Test tx packets:                                              [FAIL]
         Traffic not reflected in the counter: 0 -> 0

Fix by skipping the test when used with veth pairs.

Fixes 813f97a26860 ("selftests: forwarding: Add a tunnel-based test for L3 HW stats")
---
 tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh +2 -0
index eb9ec4a68f84..7594bbb49029 100755
@@ -99,6 +99,8 @@ test_stats_rx()
 	test_stats g2a rx
 }
 
+skip_on_veth
+
 trap cleanup EXIT
 
 setup_prepare
Signature · 1 line
2.40.1
#13 lore raw

Re: [PATCH net v2 09/17] selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs

Quoted 27 lines · Ido Schimmel

Layer 3 hardware stats cannot be used when the underlying interfaces are veth pairs, resulting in failures:

 # ./hw_stats_l3_gre.sh
 TEST: ping gre flat                                                 [ OK ]
 TEST: Test rx packets:                                              [FAIL]
         Traffic not reflected in the counter: 0 -> 0
 TEST: Test tx packets:                                              [FAIL]
         Traffic not reflected in the counter: 0 -> 0

Fix by skipping the test when used with veth pairs.

Fixes 813f97a26860 ("selftests: forwarding: Add a tunnel-based test for L3 HW stats")
---
 tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh +0 -0
index eb9ec4a68f84..7594bbb49029 100755

tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh test_stats_rx() · line 106

Quoted 8 lines
tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh +2 -0
@@ -99,6 +99,8 @@ test_stats_rx()
 	test_stats g2a rx
 }
 
+skip_on_veth
+
 trap cleanup EXIT
 
 setup_prepare

Petr has been add a veth check for this script in a9fda7a0b033 ("selftests:
forwarding: hw_stats_l3: Detect failure to install counters"). I think we can remove it with your patch?

Thanks
Hangbin

#14 lore raw

Re: [PATCH net v2 09/17] selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs

Quoted 35 lines · Hangbin Liu
Quoted 34 lines · Ido Schimmel

Layer 3 hardware stats cannot be used when the underlying interfaces are veth pairs, resulting in failures:

 # ./hw_stats_l3_gre.sh
 TEST: ping gre flat                                                 [ OK ]
 TEST: Test rx packets:                                              [FAIL]
         Traffic not reflected in the counter: 0 -> 0
 TEST: Test tx packets:                                              [FAIL]
         Traffic not reflected in the counter: 0 -> 0

Fix by skipping the test when used with veth pairs.

Fixes 813f97a26860 ("selftests: forwarding: Add a tunnel-based test for L3 HW stats")
---
 tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh +2 -0
index eb9ec4a68f84..7594bbb49029 100755
@@ -99,6 +99,8 @@ test_stats_rx()
 	test_stats g2a rx
 }
 
+skip_on_veth
+
 trap cleanup EXIT
 
Quoted 5 lines

tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh test_stats_rx() · line 106

Quoted 1 line
tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh +0 -0
 setup_prepare

Petr has been add a veth check for this script in a9fda7a0b033 ("selftests:
forwarding: hw_stats_l3: Detect failure to install counters"). I think we can remove it with your patch?

Yes, I plan to remove it in net-next.

author maintainer
#15 lore raw

PATCH v2 10/17 selftests: forwarding: ethtool_mm: Skip when MAC Merge is not supported

In reply to Ido Schimmel

MAC Merge cannot be tested with veth pairs, resulting in failures:

 # ./ethtool_mm.sh
 [...]
 TEST: Manual configuration with verification: swp1 to swp2          [FAIL]
         Verification did not succeed

Fix by skipping the test when the interfaces do not support MAC Merge.

Fixes e6991384ace5 ("selftests: forwarding: add a test for MAC Merge layer")

---
Cc: [email protected]
v2:
Probe for MAC Merge support.

---
 .../selftests/net/forwarding/ethtool_mm.sh     | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
tools/testing/selftests/net/forwarding/ethtool_mm.sh +13 -5
index c580ad623848..39e736f30322 100755
@@ -258,11 +258,6 @@ h2_destroy()
 
 setup_prepare()
 {
-	check_ethtool_mm_support
-	check_tc_fp_support
-	require_command lldptool
-	bail_on_lldpad "autoconfigure the MAC Merge layer" "configure it manually"
-
 	h1=${NETIFS[p1]}
 	h2=${NETIFS[p2]}
 
@@ -278,6 +273,19 @@ cleanup()
 	h1_destroy
 }
 
+check_ethtool_mm_support
+check_tc_fp_support
+require_command lldptool
+bail_on_lldpad "autoconfigure the MAC Merge layer" "configure it manually"
+
+for netif in ${NETIFS[@]}; do
+	ethtool --show-mm $netif 2>&1 &> /dev/null
+	if [[ $? -ne 0 ]]; then
+		echo "SKIP: $netif does not support MAC Merge"
+		exit $ksft_skip
+	fi
+done
+
 trap cleanup EXIT
 
 setup_prepare
Signature · 1 line
2.40.1
Reviewed-by Tested-by on v2 10/17
#16 lore raw

Re: [PATCH net v2 10/17] selftests: forwarding: ethtool_mm: Skip when MAC Merge is not supported

Quoted 13 lines · Ido Schimmel

MAC Merge cannot be tested with veth pairs, resulting in failures:

 # ./ethtool_mm.sh
 [...]
 TEST: Manual configuration with verification: swp1 to swp2          [FAIL]
         Verification did not succeed

Fix by skipping the test when the interfaces do not support MAC Merge.

Fixes e6991384ace5 ("selftests: forwarding: add a test for MAC Merge layer")
Quoted 5 lines

---
Cc: [email protected]
v2:
Probe for MAC Merge support.
---

author maintainer
#17 lore raw

PATCH v2 11/17 selftests: forwarding: tc_actions: Use ncat instead of nc

In reply to Ido Schimmel

The test relies on 'nc' being the netcat version from the nmap project. While this seems to be the case on Fedora, it is not the case on Ubuntu, resulting in failures such as [1].

Fix by explicitly using the 'ncat' utility from the nmap project and the skip the test in case it is not installed.

[1]

 # timeout set to 0
 # selftests: net/forwarding: tc_actions.sh
 # TEST: gact drop and ok (skip_hw)                                    [ OK ]
 # TEST: mirred egress flower redirect (skip_hw)                       [ OK ]
 # TEST: mirred egress flower mirror (skip_hw)                         [ OK ]
 # TEST: mirred egress matchall mirror (skip_hw)                       [ OK ]
 # TEST: mirred_egress_to_ingress (skip_hw)                            [ OK ]
 # nc: invalid option -- '-'
 # usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
 #         [-m minttl] [-O length] [-P proxy_username] [-p source_port]
 #         [-q seconds] [-s sourceaddr] [-T keyword] [-V rtable] [-W recvlimit]
 #         [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]]
 #         [destination] [port]
 # nc: invalid option -- '-'
 # usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
 #         [-m minttl] [-O length] [-P proxy_username] [-p source_port]
 #         [-q seconds] [-s sourceaddr] [-T keyword] [-V rtable] [-W recvlimit]
 #         [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]]
 #         [destination] [port]
 # TEST: mirred_egress_to_ingress_tcp (skip_hw)                        [FAIL]
 #       server output check failed
 # INFO: Could not test offloaded functionality
 not ok 80 selftests: net/forwarding: tc_actions.sh # exit=1
Fixes ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")

---
Cc: [email protected]

---
 tools/testing/selftests/net/forwarding/tc_actions.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/selftests/net/forwarding/tc_actions.sh +4 -2
index a96cff8e7219..b0f5e55d2d0b 100755
@@ -9,6 +9,8 @@ NUM_NETIFS=4
 source tc_common.sh
 source lib.sh
 
+require_command ncat
+
 tcflags="skip_hw"
 
 h1_create()
@@ -220,9 +222,9 @@ mirred_egress_to_ingress_tcp_test()
 		ip_proto icmp \
 			action drop
 
-	ip vrf exec v$h1 nc --recv-only -w10 -l -p 12345 -o $mirred_e2i_tf2  &
+	ip vrf exec v$h1 ncat --recv-only -w10 -l -p 12345 -o $mirred_e2i_tf2 &
 	local rpid=$!
-	ip vrf exec v$h1 nc -w1 --send-only 192.0.2.2 12345 <$mirred_e2i_tf1
+	ip vrf exec v$h1 ncat -w1 --send-only 192.0.2.2 12345 <$mirred_e2i_tf1
 	wait -n $rpid
 	cmp -s $mirred_e2i_tf1 $mirred_e2i_tf2
 	check_err $? "server output check failed"
Signature · 1 line
2.40.1
author maintainer
#18 lore raw

PATCH v2 12/17 selftests: forwarding: tc_flower: Relax success criterion

In reply to Ido Schimmel

The test checks that filters that match on source or destination MAC were only hit once. A host can send more than one packet with a given source or destination MAC, resulting in failures.

Fix by relaxing the success criterion and instead check that the filters were not hit zero times. Using tc_check_at_least_x_packets() is also an option, but it is not available in older kernels.

Fixes 07e5c75184a1 ("selftests: forwarding: Introduce tc flower matching tests")
---
 tools/testing/selftests/net/forwarding/tc_flower.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/net/forwarding/tc_flower.sh +4 -4
index 683711f41aa9..b1daad19b01e 100755
@@ -52,8 +52,8 @@ match_dst_mac_test()
 	tc_check_packets "dev $h2 ingress" 101 1
 	check_fail $? "Matched on a wrong filter"
 
-	tc_check_packets "dev $h2 ingress" 102 1
-	check_err $? "Did not match on correct filter"
+	tc_check_packets "dev $h2 ingress" 102 0
+	check_fail $? "Did not match on correct filter"
 
 	tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
 	tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
@@ -78,8 +78,8 @@ match_src_mac_test()
 	tc_check_packets "dev $h2 ingress" 101 1
 	check_fail $? "Matched on a wrong filter"
 
-	tc_check_packets "dev $h2 ingress" 102 1
-	check_err $? "Did not match on correct filter"
+	tc_check_packets "dev $h2 ingress" 102 0
+	check_fail $? "Did not match on correct filter"
 
 	tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
 	tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
Signature · 1 line
2.40.1
author maintainer
#19 lore raw

PATCH v2 13/17 selftests: forwarding: tc_tunnel_key: Make filters more specific

In reply to Ido Schimmel

The test installs filters that match on various IP fragments (e.g., no fragment, first fragment) and expects a certain amount of packets to hit each filter. This is problematic as the filters are not specific enough and can match IP packets (e.g., IGMP) generated by the stack, resulting in failures [1].

Fix by making the filters more specific and match on more fields in the IP header: Source IP, destination IP and protocol.

[1]

 # timeout set to 0
 # selftests: net/forwarding: tc_tunnel_key.sh
 # TEST: tunnel_key nofrag (skip_hw)                                   [FAIL]
 #       packet smaller than MTU was not tunneled
 # INFO: Could not test offloaded functionality
 not ok 89 selftests: net/forwarding: tc_tunnel_key.sh # exit=1

---
Cc: [email protected]

---
 tools/testing/selftests/net/forwarding/tc_tunnel_key.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tools/testing/selftests/net/forwarding/tc_tunnel_key.sh +6 -3
index 5ac184d51809..5a5dd9034819 100755
@@ -104,11 +104,14 @@ tunnel_key_nofrag_test()
 	local i
 
 	tc filter add dev $swp1 ingress protocol ip pref 100 handle 100 \
-		flower ip_flags nofrag action drop
+		flower src_ip 192.0.2.1 dst_ip 192.0.2.2 ip_proto udp \
+		ip_flags nofrag action drop
 	tc filter add dev $swp1 ingress protocol ip pref 101 handle 101 \
-		flower ip_flags firstfrag action drop
+		flower src_ip 192.0.2.1 dst_ip 192.0.2.2 ip_proto udp \
+		ip_flags firstfrag action drop
 	tc filter add dev $swp1 ingress protocol ip pref 102 handle 102 \
-		flower ip_flags nofirstfrag action drop
+		flower src_ip 192.0.2.1 dst_ip 192.0.2.2 ip_proto udp \
+		ip_flags nofirstfrag action drop
 
 	# test 'nofrag' set
 	tc filter add dev h1-et egress protocol all pref 1 handle 1 matchall $tcflags \
Signature · 1 line
2.40.1
author maintainer
#20 lore raw

PATCH v2 14/17 selftests: forwarding: tc_flower_l2_miss: Fix failing test with old libnet

In reply to Ido Schimmel

As explained in commit 8bcfb4ae4d97 ("selftests: forwarding: Fix failing tests with old libnet"), old versions of libnet (used by mausezahn) do not use the "SO_BINDTODEVICE" socket option. For IP unicast packets, this can be solved by prefixing mausezahn invocations with "ip vrf exec". However, IP multicast packets do not perform routing and simply egress the bound device, which does not exist in this case.

Fix by specifying the source and destination MAC of the packet which will cause mausezahn to use a packet socket instead of an IP socket.

Fixes 8c33266ae26a ("selftests: forwarding: Add layer 2 miss test cases")
---
 .../selftests/net/forwarding/tc_flower_l2_miss.sh   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
tools/testing/selftests/net/forwarding/tc_flower_l2_miss.sh +8 -5
index e22c2d28b6eb..20a7cb7222b8 100755
@@ -127,6 +127,7 @@ test_l2_miss_multicast_common()
 	local proto=$1; shift
 	local sip=$1; shift
 	local dip=$1; shift
+	local dmac=$1; shift
 	local mode=$1; shift
 	local name=$1; shift
 
@@ -142,7 +143,7 @@ test_l2_miss_multicast_common()
 	   action pass
 
 	# Before adding MDB entry.
-	$MZ $mode $h1 -t ip -A $sip -B $dip -c 1 -p 100 -q
+	$MZ $mode $h1 -a own -b $dmac -t ip -A $sip -B $dip -c 1 -p 100 -q
 
 	tc_check_packets "dev $swp2 egress" 101 1
 	check_err $? "Unregistered multicast filter was not hit before adding MDB entry"
@@ -153,7 +154,7 @@ test_l2_miss_multicast_common()
 	# Adding MDB entry.
 	bridge mdb replace dev br1 port $swp2 grp $dip permanent
 
-	$MZ $mode $h1 -t ip -A $sip -B $dip -c 1 -p 100 -q
+	$MZ $mode $h1 -a own -b $dmac -t ip -A $sip -B $dip -c 1 -p 100 -q
 
 	tc_check_packets "dev $swp2 egress" 101 1
 	check_err $? "Unregistered multicast filter was hit after adding MDB entry"
@@ -164,7 +165,7 @@ test_l2_miss_multicast_common()
 	# Deleting MDB entry.
 	bridge mdb del dev br1 port $swp2 grp $dip
 
-	$MZ $mode $h1 -t ip -A $sip -B $dip -c 1 -p 100 -q
+	$MZ $mode $h1 -a own -b $dmac -t ip -A $sip -B $dip -c 1 -p 100 -q
 
 	tc_check_packets "dev $swp2 egress" 101 2
 	check_err $? "Unregistered multicast filter was not hit after deleting MDB entry"
@@ -183,10 +184,11 @@ test_l2_miss_multicast_ipv4()
 	local proto="ipv4"
 	local sip=192.0.2.1
 	local dip=239.1.1.1
+	local dmac=01:00:5e:01:01:01
 	local mode="-4"
 	local name="IPv4"
 
-	test_l2_miss_multicast_common $proto $sip $dip $mode $name
+	test_l2_miss_multicast_common $proto $sip $dip $dmac $mode $name
 }
 
 test_l2_miss_multicast_ipv6()
@@ -194,10 +196,11 @@ test_l2_miss_multicast_ipv6()
 	local proto="ipv6"
 	local sip=2001:db8:1::1
 	local dip=ff0e::1
+	local dmac=33:33:00:00:00:01
 	local mode="-6"
 	local name="IPv6"
 
-	test_l2_miss_multicast_common $proto $sip $dip $mode $name
+	test_l2_miss_multicast_common $proto $sip $dip $dmac $mode $name
 }
 
 test_l2_miss_multicast()
Signature · 1 line
2.40.1
author maintainer
#21 lore raw

PATCH v2 15/17 selftests: forwarding: bridge_mdb: Fix failing test with old libnet

In reply to Ido Schimmel

As explained in commit 8bcfb4ae4d97 ("selftests: forwarding: Fix failing tests with old libnet"), old versions of libnet (used by mausezahn) do not use the "SO_BINDTODEVICE" socket option. For IP unicast packets, this can be solved by prefixing mausezahn invocations with "ip vrf exec". However, IP multicast packets do not perform routing and simply egress the bound device, which does not exist in this case.

Fix by specifying the source and destination MAC of the packet which will cause mausezahn to use a packet socket instead of an IP socket.

---
 .../selftests/net/forwarding/bridge_mdb.sh    | 46 ++++++++++---------
 1 file changed, 24 insertions(+), 22 deletions(-)
tools/testing/selftests/net/forwarding/bridge_mdb.sh +24 -22
index 6f830b5f03c9..4853b8e4f8d3 100755
@@ -850,6 +850,7 @@ cfg_test()
 __fwd_test_host_ip()
 {
 	local grp=$1; shift
+	local dmac=$1; shift
 	local src=$1; shift
 	local mode=$1; shift
 	local name
@@ -872,27 +873,27 @@ __fwd_test_host_ip()
 	# Packet should only be flooded to multicast router ports when there is
 	# no matching MDB entry. The bridge is not configured as a multicast
 	# router port.
-	$MZ $mode $h1.10 -c 1 -p 128 -A $src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $src -B $grp -t udp -q
 	tc_check_packets "dev br0 ingress" 1 0
 	check_err $? "Packet locally received after flood"
 
 	# Install a regular port group entry and expect the packet to not be
 	# locally received.
 	bridge mdb add dev br0 port $swp2 grp $grp temp vid 10
-	$MZ $mode $h1.10 -c 1 -p 128 -A $src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $src -B $grp -t udp -q
 	tc_check_packets "dev br0 ingress" 1 0
 	check_err $? "Packet locally received after installing a regular entry"
 
 	# Add a host entry and expect the packet to be locally received.
 	bridge mdb add dev br0 port br0 grp $grp temp vid 10
-	$MZ $mode $h1.10 -c 1 -p 128 -A $src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $src -B $grp -t udp -q
 	tc_check_packets "dev br0 ingress" 1 1
 	check_err $? "Packet not locally received after adding a host entry"
 
 	# Remove the host entry and expect the packet to not be locally
 	# received.
 	bridge mdb del dev br0 port br0 grp $grp vid 10
-	$MZ $mode $h1.10 -c 1 -p 128 -A $src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $src -B $grp -t udp -q
 	tc_check_packets "dev br0 ingress" 1 1
 	check_err $? "Packet locally received after removing a host entry"
 
@@ -905,8 +906,8 @@ __fwd_test_host_ip()
 
 fwd_test_host_ip()
 {
-	__fwd_test_host_ip "239.1.1.1" "192.0.2.1" "-4"
-	__fwd_test_host_ip "ff0e::1" "2001:db8:1::1" "-6"
+	__fwd_test_host_ip "239.1.1.1" "01:00:5e:01:01:01" "192.0.2.1" "-4"
+	__fwd_test_host_ip "ff0e::1" "33:33:00:00:00:01" "2001:db8:1::1" "-6"
 }
 
 fwd_test_host_l2()
@@ -966,6 +967,7 @@ fwd_test_host()
 __fwd_test_port_ip()
 {
 	local grp=$1; shift
+	local dmac=$1; shift
 	local valid_src=$1; shift
 	local invalid_src=$1; shift
 	local mode=$1; shift
@@ -999,43 +1001,43 @@ __fwd_test_port_ip()
 		vlan_ethtype $eth_type vlan_id 10 dst_ip $grp \
 		src_ip $invalid_src action drop
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $valid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $valid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 1 0
 	check_err $? "Packet from valid source received on H2 before adding entry"
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 2 0
 	check_err $? "Packet from invalid source received on H2 before adding entry"
 
 	bridge mdb add dev br0 port $swp2 grp $grp vid 10 \
 		filter_mode $filter_mode source_list $src_list
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $valid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $valid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 1 1
 	check_err $? "Packet from valid source not received on H2 after adding entry"
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 2 0
 	check_err $? "Packet from invalid source received on H2 after adding entry"
 
 	bridge mdb replace dev br0 port $swp2 grp $grp vid 10 \
 		filter_mode exclude
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $valid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $valid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 1 2
 	check_err $? "Packet from valid source not received on H2 after allowing all sources"
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 2 1
 	check_err $? "Packet from invalid source not received on H2 after allowing all sources"
 
 	bridge mdb del dev br0 port $swp2 grp $grp vid 10
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $valid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $valid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 1 2
 	check_err $? "Packet from valid source received on H2 after deleting entry"
 
-	$MZ $mode $h1.10 -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
+	$MZ $mode $h1.10 -a own -b $dmac -c 1 -p 128 -A $invalid_src -B $grp -t udp -q
 	tc_check_packets "dev $h2 ingress" 2 1
 	check_err $? "Packet from invalid source received on H2 after deleting entry"
 
@@ -1047,11 +1049,11 @@ __fwd_test_port_ip()
 
 fwd_test_port_ip()
 {
-	__fwd_test_port_ip "239.1.1.1" "192.0.2.1" "192.0.2.2" "-4" "exclude"
-	__fwd_test_port_ip "ff0e::1" "2001:db8:1::1" "2001:db8:1::2" "-6" \
+	__fwd_test_port_ip "239.1.1.1" "01:00:5e:01:01:01" "192.0.2.1" "192.0.2.2" "-4" "exclude"
+	__fwd_test_port_ip "ff0e::1" "33:33:00:00:00:01" "2001:db8:1::1" "2001:db8:1::2" "-6" \
 		"exclude"
-	__fwd_test_port_ip "239.1.1.1" "192.0.2.1" "192.0.2.2" "-4" "include"
-	__fwd_test_port_ip "ff0e::1" "2001:db8:1::1" "2001:db8:1::2" "-6" \
+	__fwd_test_port_ip "239.1.1.1" "01:00:5e:01:01:01" "192.0.2.1" "192.0.2.2" "-4" "include"
+	__fwd_test_port_ip "ff0e::1" "33:33:00:00:00:01" "2001:db8:1::1" "2001:db8:1::2" "-6" \
 		"include"
 }
 
@@ -1127,7 +1129,7 @@ ctrl_igmpv3_is_in_test()
 		filter_mode include source_list 192.0.2.1
 
 	# IS_IN ( 192.0.2.2 )
-	$MZ $h1.10 -c 1 -A 192.0.2.1 -B 239.1.1.1 \
+	$MZ $h1.10 -c 1 -a own -b 01:00:5e:01:01:01 -A 192.0.2.1 -B 239.1.1.1 \
 		-t ip proto=2,p=$(igmpv3_is_in_get 239.1.1.1 192.0.2.2) -q
 
 	bridge -d mdb show dev br0 vid 10 | grep 239.1.1.1 | grep -q 192.0.2.2
@@ -1140,7 +1142,7 @@ ctrl_igmpv3_is_in_test()
 		filter_mode include source_list 192.0.2.1
 
 	# IS_IN ( 192.0.2.2 )
-	$MZ $h1.10 -c 1 -A 192.0.2.1 -B 239.1.1.1 \
+	$MZ $h1.10 -a own -b 01:00:5e:01:01:01 -c 1 -A 192.0.2.1 -B 239.1.1.1 \
 		-t ip proto=2,p=$(igmpv3_is_in_get 239.1.1.1 192.0.2.2) -q
 
 	bridge -d mdb show dev br0 vid 10 | grep 239.1.1.1 | grep -v "src" | \
@@ -1167,7 +1169,7 @@ ctrl_mldv2_is_in_test()
 
 	# IS_IN ( 2001:db8:1::2 )
 	local p=$(mldv2_is_in_get fe80::1 ff0e::1 2001:db8:1::2)
-	$MZ -6 $h1.10 -c 1 -A fe80::1 -B ff0e::1 \
+	$MZ -6 $h1.10 -a own -b 33:33:00:00:00:01 -c 1 -A fe80::1 -B ff0e::1 \
 		-t ip hop=1,next=0,p="$p" -q
 
 	bridge -d mdb show dev br0 vid 10 | grep ff0e::1 | \
@@ -1181,7 +1183,7 @@ ctrl_mldv2_is_in_test()
 		filter_mode include source_list 2001:db8:1::1
 
 	# IS_IN ( 2001:db8:1::2 )
-	$MZ -6 $h1.10 -c 1 -A fe80::1 -B ff0e::1 \
+	$MZ -6 $h1.10 -a own -b 33:33:00:00:00:01 -c 1 -A fe80::1 -B ff0e::1 \
 		-t ip hop=1,next=0,p="$p" -q
 
 	bridge -d mdb show dev br0 vid 10 | grep ff0e::1 | grep -v "src" | \
Signature · 1 line
2.40.1
author maintainer
#22 lore raw

PATCH v2 16/17 selftests: forwarding: bridge_mdb_max: Fix failing test with old libnet

In reply to Ido Schimmel

As explained in commit 8bcfb4ae4d97 ("selftests: forwarding: Fix failing tests with old libnet"), old versions of libnet (used by mausezahn) do not use the "SO_BINDTODEVICE" socket option. For IP unicast packets, this can be solved by prefixing mausezahn invocations with "ip vrf exec". However, IP multicast packets do not perform routing and simply egress the bound device, which does not exist in this case.

Fix by specifying the source and destination MAC of the packet which will cause mausezahn to use a packet socket instead of an IP socket.

Fixes 3446dcd7df05 ("selftests: forwarding: bridge_mdb_max: Add a new selftest")
---
 .../selftests/net/forwarding/bridge_mdb_max.sh     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
tools/testing/selftests/net/forwarding/bridge_mdb_max.sh +10 -4
index fa762b716288..3da9d93ab36f 100755
@@ -252,7 +252,8 @@ ctl4_entries_add()
 	local IPs=$(seq -f 192.0.2.%g 1 $((n - 1)))
 	local peer=$(locus_dev_peer $locus)
 	local GRP=239.1.1.${grp}
-	$MZ $peer -c 1 -A 192.0.2.1 -B $GRP \
+	local dmac=01:00:5e:01:01:$(printf "%02x" $grp)
+	$MZ $peer -a own -b $dmac -c 1 -A 192.0.2.1 -B $GRP \
 		-t ip proto=2,p=$(igmpv3_is_in_get $GRP $IPs) -q
 	sleep 1
 
@@ -272,7 +273,8 @@ ctl4_entries_del()
 
 	local peer=$(locus_dev_peer $locus)
 	local GRP=239.1.1.${grp}
-	$MZ $peer -c 1 -A 192.0.2.1 -B 224.0.0.2 \
+	local dmac=01:00:5e:00:00:02
+	$MZ $peer -a own -b $dmac -c 1 -A 192.0.2.1 -B 224.0.0.2 \
 		-t ip proto=2,p=$(igmpv2_leave_get $GRP) -q
 	sleep 1
 	! bridge mdb show dev br0 | grep -q $GRP
@@ -289,8 +291,10 @@ ctl6_entries_add()
 	local peer=$(locus_dev_peer $locus)
 	local SIP=fe80::1
 	local GRP=ff0e::${grp}
+	local dmac=33:33:00:00:00:$(printf "%02x" $grp)
 	local p=$(mldv2_is_in_get $SIP $GRP $IPs)
-	$MZ -6 $peer -c 1 -A $SIP -B $GRP -t ip hop=1,next=0,p="$p" -q
+	$MZ -6 $peer -a own -b $dmac -c 1 -A $SIP -B $GRP \
+		-t ip hop=1,next=0,p="$p" -q
 	sleep 1
 
 	local nn=$(bridge mdb show dev br0 | grep $GRP | wc -l)
@@ -310,8 +314,10 @@ ctl6_entries_del()
 	local peer=$(locus_dev_peer $locus)
 	local SIP=fe80::1
 	local GRP=ff0e::${grp}
+	local dmac=33:33:00:00:00:$(printf "%02x" $grp)
 	local p=$(mldv1_done_get $SIP $GRP)
-	$MZ -6 $peer -c 1 -A $SIP -B $GRP -t ip hop=1,next=0,p="$p" -q
+	$MZ -6 $peer -a own -b $dmac -c 1 -A $SIP -B $GRP \
+		-t ip hop=1,next=0,p="$p" -q
 	sleep 1
 	! bridge mdb show dev br0 | grep -q $GRP
 }
Signature · 1 line
2.40.1
author maintainer
#23 lore raw

PATCH v2 17/17 selftests: forwarding: bridge_mdb: Make test more robust

In reply to Ido Schimmel

Some test cases check that the group timer is (or isn't) 0. Instead of grepping for "0.00" grep for " 0.00" as the former can also match "260.00" which is the default group membership interval.

---
 tools/testing/selftests/net/forwarding/bridge_mdb.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/net/forwarding/bridge_mdb.sh +4 -4
index 4853b8e4f8d3..d0c6c499d5da 100755
@@ -617,7 +617,7 @@ __cfg_test_port_ip_sg()
 		grep -q "permanent"
 	check_err $? "Entry not added as \"permanent\" when should"
 	bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \
-		grep -q "0.00"
+		grep -q " 0.00"
 	check_err $? "\"permanent\" entry has a pending group timer"
 	bridge mdb del dev br0 port $swp1 $grp_key vid 10
 
@@ -626,7 +626,7 @@ __cfg_test_port_ip_sg()
 		grep -q "temp"
 	check_err $? "Entry not added as \"temp\" when should"
 	bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \
-		grep -q "0.00"
+		grep -q " 0.00"
 	check_fail $? "\"temp\" entry has an unpending group timer"
 	bridge mdb del dev br0 port $swp1 $grp_key vid 10
 
@@ -659,7 +659,7 @@ __cfg_test_port_ip_sg()
 		grep -q "permanent"
 	check_err $? "Entry not marked as \"permanent\" after replace"
 	bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \
-		grep -q "0.00"
+		grep -q " 0.00"
 	check_err $? "Entry has a pending group timer after replace"
 
 	bridge mdb replace dev br0 port $swp1 $grp_key vid 10 temp
@@ -667,7 +667,7 @@ __cfg_test_port_ip_sg()
 		grep -q "temp"
 	check_err $? "Entry not marked as \"temp\" after replace"
 	bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \
-		grep -q "0.00"
+		grep -q " 0.00"
 	check_fail $? "Entry has an unpending group timer after replace"
 	bridge mdb del dev br0 port $swp1 $grp_key vid 10
 
Signature · 1 line
2.40.1
Reviewed-by on the v2 series
#24 lore raw
In reply to Ido Schimmel
Quoted 2 lines · Ido Schimmel

Fix various problems with forwarding selftests. See individual patches for problem description and solution.

Quoted 46 lines

v2:
* Patch #10: Probe for MAC Merge support.

Ido Schimmel (17):
selftests: forwarding: Skip test when no interfaces are specified
selftests: forwarding: Switch off timeout
selftests: forwarding: bridge_mdb: Check iproute2 version
selftests: forwarding: bridge_mdb_max: Check iproute2 version
selftests: forwarding: Set default IPv6 traceroute utility
selftests: forwarding: Add a helper to skip test when using veth pairs
selftests: forwarding: ethtool: Skip when using veth pairs
selftests: forwarding: ethtool_extended_state: Skip when using veth
pairs
selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs
selftests: forwarding: ethtool_mm: Skip when MAC Merge is not
supported
selftests: forwarding: tc_actions: Use ncat instead of nc
selftests: forwarding: tc_flower: Relax success criterion
selftests: forwarding: tc_tunnel_key: Make filters more specific
selftests: forwarding: tc_flower_l2_miss: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Fix failing test with old libnet
selftests: forwarding: bridge_mdb_max: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Make test more robust

 .../selftests/net/forwarding/bridge_mdb.sh    | 59 +++++++++++--------
 .../net/forwarding/bridge_mdb_max.sh          | 19 ++++--
 .../selftests/net/forwarding/ethtool.sh       |  2 +
 .../net/forwarding/ethtool_extended_state.sh  |  2 +
 .../selftests/net/forwarding/ethtool_mm.sh    | 18 ++++--
 .../net/forwarding/hw_stats_l3_gre.sh         |  2 +
 .../net/forwarding/ip6_forward_instats_vrf.sh |  2 +
 tools/testing/selftests/net/forwarding/lib.sh | 17 ++++++
 .../testing/selftests/net/forwarding/settings |  1 +
 .../selftests/net/forwarding/tc_actions.sh    |  6 +-
 .../selftests/net/forwarding/tc_flower.sh     |  8 +--
 .../net/forwarding/tc_flower_l2_miss.sh       | 13 ++--
 .../selftests/net/forwarding/tc_tunnel_key.sh |  9 ++-
 13 files changed, 109 insertions(+), 49 deletions(-)
 create mode 100644 tools/testing/selftests/net/forwarding/settings
Signature · 1 line
2.40.1
Acked-by on the v2 series
#25 lore raw
In reply to Ido Schimmel
Quoted 6 lines · Ido Schimmel

Fix various problems with forwarding selftests. See individual patches for problem description and solution.

v2:
* Patch #10: Probe for MAC Merge support.

Nice! Thanks for taking the time to fix all these.

Quoted 39 lines

Ido Schimmel (17):
selftests: forwarding: Skip test when no interfaces are specified
selftests: forwarding: Switch off timeout
selftests: forwarding: bridge_mdb: Check iproute2 version
selftests: forwarding: bridge_mdb_max: Check iproute2 version
selftests: forwarding: Set default IPv6 traceroute utility
selftests: forwarding: Add a helper to skip test when using veth pairs
selftests: forwarding: ethtool: Skip when using veth pairs
selftests: forwarding: ethtool_extended_state: Skip when using veth
pairs
selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs
selftests: forwarding: ethtool_mm: Skip when MAC Merge is not
supported
selftests: forwarding: tc_actions: Use ncat instead of nc
selftests: forwarding: tc_flower: Relax success criterion
selftests: forwarding: tc_tunnel_key: Make filters more specific
selftests: forwarding: tc_flower_l2_miss: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Fix failing test with old libnet
selftests: forwarding: bridge_mdb_max: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Make test more robust

  .../selftests/net/forwarding/bridge_mdb.sh    | 59 +++++++++++--------
  .../net/forwarding/bridge_mdb_max.sh          | 19 ++++--
  .../selftests/net/forwarding/ethtool.sh       |  2 +
  .../net/forwarding/ethtool_extended_state.sh  |  2 +
  .../selftests/net/forwarding/ethtool_mm.sh    | 18 ++++--
  .../net/forwarding/hw_stats_l3_gre.sh         |  2 +
  .../net/forwarding/ip6_forward_instats_vrf.sh |  2 +
  tools/testing/selftests/net/forwarding/lib.sh | 17 ++++++
  .../testing/selftests/net/forwarding/settings |  1 +
  .../selftests/net/forwarding/tc_actions.sh    |  6 +-
  .../selftests/net/forwarding/tc_flower.sh     |  8 +--
  .../net/forwarding/tc_flower_l2_miss.sh       | 13 ++--
  .../selftests/net/forwarding/tc_tunnel_key.sh |  9 ++-
  13 files changed, 109 insertions(+), 49 deletions(-)

create mode 100644 tools/testing/selftests/net/forwarding/settings

#26 lore raw
In reply to Ido Schimmel
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 29 lines · On Tue, 8 Aug 2023 17:14:46 +0300 you wrote:

Fix various problems with forwarding selftests. See individual patches for problem description and solution.

v2:
* Patch #10: Probe for MAC Merge support.

Ido Schimmel (17):
selftests: forwarding: Skip test when no interfaces are specified
selftests: forwarding: Switch off timeout
selftests: forwarding: bridge_mdb: Check iproute2 version
selftests: forwarding: bridge_mdb_max: Check iproute2 version
selftests: forwarding: Set default IPv6 traceroute utility
selftests: forwarding: Add a helper to skip test when using veth pairs
selftests: forwarding: ethtool: Skip when using veth pairs
selftests: forwarding: ethtool_extended_state: Skip when using veth
pairs
selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs
selftests: forwarding: ethtool_mm: Skip when MAC Merge is not
supported
selftests: forwarding: tc_actions: Use ncat instead of nc
selftests: forwarding: tc_flower: Relax success criterion
selftests: forwarding: tc_tunnel_key: Make filters more specific
selftests: forwarding: tc_flower_l2_miss: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Fix failing test with old libnet
selftests: forwarding: bridge_mdb_max: Fix failing test with old
libnet
selftests: forwarding: bridge_mdb: Make test more robust

Quoted 1 line

[...]

Here is the summary with links:
- [net,v2,01/17] selftests: forwarding: Skip test when no interfaces are specified

    https://git.kernel.org/netdev/net/c/d72c83b1e4b4
  - [net,v2,02/17] selftests: forwarding: Switch off timeout
    https://git.kernel.org/netdev/net/c/0529883ad102
  - [net,v2,03/17] selftests: forwarding: bridge_mdb: Check iproute2 version
    https://git.kernel.org/netdev/net/c/ab2eda04e2c2
  - [net,v2,04/17] selftests: forwarding: bridge_mdb_max: Check iproute2 version
    https://git.kernel.org/netdev/net/c/6bdf3d9765f4
  - [net,v2,05/17] selftests: forwarding: Set default IPv6 traceroute utility
    https://git.kernel.org/netdev/net/c/38f7c44d6e76
  - [net,v2,06/17] selftests: forwarding: Add a helper to skip test when using veth pairs
    https://git.kernel.org/netdev/net/c/66e131861ab7
  - [net,v2,07/17] selftests: forwarding: ethtool: Skip when using veth pairs
    https://git.kernel.org/netdev/net/c/60a36e21915c
  - [net,v2,08/17] selftests: forwarding: ethtool_extended_state: Skip when using veth pairs
    https://git.kernel.org/netdev/net/c/b3d9305e60d1
  - [net,v2,09/17] selftests: forwarding: hw_stats_l3_gre: Skip when using veth pairs
    https://git.kernel.org/netdev/net/c/9a711cde07c2
  - [net,v2,10/17] selftests: forwarding: ethtool_mm: Skip when MAC Merge is not supported
    https://git.kernel.org/netdev/net/c/23fb886a1ced
  - [net,v2,11/17] selftests: forwarding: tc_actions: Use ncat instead of nc
    https://git.kernel.org/netdev/net/c/5e8670610b93
  - [net,v2,12/17] selftests: forwarding: tc_flower: Relax success criterion
    https://git.kernel.org/netdev/net/c/9ee37e53e768
  - [net,v2,13/17] selftests: forwarding: tc_tunnel_key: Make filters more specific
    https://git.kernel.org/netdev/net/c/11604178fdc3
  - [net,v2,14/17] selftests: forwarding: tc_flower_l2_miss: Fix failing test with old libnet
    https://git.kernel.org/netdev/net/c/21a72166abb9
  - [net,v2,15/17] selftests: forwarding: bridge_mdb: Fix failing test with old libnet
    https://git.kernel.org/netdev/net/c/e98e195d90cc
  - [net,v2,16/17] selftests: forwarding: bridge_mdb_max: Fix failing test with old libnet
    https://git.kernel.org/netdev/net/c/cb034948ac29
  - [net,v2,17/17] selftests: forwarding: bridge_mdb: Make test more robust
    https://git.kernel.org/netdev/net/c/8b5ff3709777

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html