]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: forwarding: Make VXLAN ECN encap tests more robust
authorIdo Schimmel <idosch@nvidia.com>
Mon, 4 Mar 2024 09:56:11 +0000 (11:56 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 5 Mar 2024 17:18:13 +0000 (09:18 -0800)
These tests sometimes fail on the netdev CI because the expected number
of packets is larger than expected [1].

Make the tests more robust by specifically matching on VXLAN
encapsulated packets and allowing up to five stray packets instead of
just two.

[1]
 [...]
 # TEST: VXLAN: ECN encap: 0x00->0x00                                  [FAIL]
 # v1: Expected to capture 10 packets, got 13.
 # TEST: VXLAN: ECN encap: 0x01->0x01                                  [ OK ]
 # TEST: VXLAN: ECN encap: 0x02->0x02                                  [ OK ]
 # TEST: VXLAN: ECN encap: 0x03->0x02                                  [ OK ]
 [...]

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20240304095612.462900-6-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
tools/testing/selftests/net/forwarding/vxlan_bridge_1d_ipv6.sh

index eb307ca37bfa69df1acd7cccad1435fed0cf166e..6f0a2e452ba1e6ad04e49b83afdfccfe71558f03 100755 (executable)
@@ -495,7 +495,7 @@ vxlan_ping_test()
        local delta=$((t1 - t0))
 
        # Tolerate a couple stray extra packets.
-       ((expect <= delta && delta <= expect + 2))
+       ((expect <= delta && delta <= expect + 5))
        check_err $? "$capture_dev: Expected to capture $expect packets, got $delta."
 }
 
@@ -532,7 +532,7 @@ __test_ecn_encap()
        RET=0
 
        tc filter add dev v1 egress pref 77 prot ip \
-               flower ip_tos $tos action pass
+               flower ip_tos $tos ip_proto udp dst_port $VXPORT action pass
        sleep 1
        vxlan_ping_test $h1 192.0.2.3 "-Q $q" v1 egress 77 10
        tc filter del dev v1 egress pref 77 prot ip
index ac97f07e5ce8267441653e359a5caf16a47cbba7..a0bb4524e1e9c66bed9ff99d08232be8c4f409fc 100755 (executable)
@@ -616,7 +616,7 @@ vxlan_ping_test()
        local delta=$((t1 - t0))
 
        # Tolerate a couple stray extra packets.
-       ((expect <= delta && delta <= expect + 2))
+       ((expect <= delta && delta <= expect + 5))
        check_err $? "$capture_dev: Expected to capture $expect packets, got $delta."
 }
 
@@ -653,7 +653,7 @@ __test_ecn_encap()
        RET=0
 
        tc filter add dev v1 egress pref 77 protocol ipv6 \
-               flower ip_tos $tos action pass
+               flower ip_tos $tos ip_proto udp dst_port $VXPORT action pass
        sleep 1
        vxlan_ping_test $h1 2001:db8:1::3 "-Q $q" v1 egress 77 10
        tc filter del dev v1 egress pref 77 protocol ipv6