]> git.feebdaed.xyz Git - 0xmirror/xdp-tools.git/commitdiff
xdp-forward: Add test for attaching to a high ifindex
authorToke Høiland-Jørgensen <toke@redhat.com>
Wed, 5 Mar 2025 12:26:11 +0000 (13:26 +0100)
committerToke Høiland-Jørgensen <toke@toke.dk>
Thu, 6 Mar 2025 08:59:36 +0000 (09:59 +0100)
Add a test that creates an interface with a high ifindex and verify that
xdp-forward can attach to it.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
xdp-forward/tests/test-xdp-forward.sh

index 602131964fec83bc90f69e829d71c3ac51ca4105..3aa7eadbeb82f6ccdbf5cf69a47f013d7cdbf28b 100644 (file)
@@ -1,6 +1,6 @@
 XDP_LOADER=${XDP_LOADER:-./xdp-loader}
 XDP_FORWARD=${XDP_FORWARD:-./xdp-forward}
-ALL_TESTS="test_ping test_load test_fwd_full test_fwd_direct test_flowtable"
+ALL_TESTS="test_ping test_load test_load_high_ifindex test_fwd_full test_fwd_direct test_flowtable"
 
 test_ping()
 {
@@ -21,6 +21,19 @@ test_load()
     check_run $XDP_FORWARD unload ${NS_NAMES[@]}
 }
 
+test_load_high_ifindex()
+{
+    # Add a bunch of interfaces to run up the ifindex counter
+    for i in $(seq 64); do
+        ip link add dev veth-forw-test type veth
+        ip link del dev veth-forw-test
+    done
+
+    ip link add dev veth-forw-test type veth
+    check_run $XDP_FORWARD load veth-forw-test
+    check_run $XDP_FORWARD unload veth-forw-test
+}
+
 test_fwd_full()
 {
     # veth NAPI GRO support added this symbol; forwarding won't work without it
@@ -137,5 +150,6 @@ cleanup_tests()
         $XDP_LOADER unload $NS --all
         check_run ip netns exec ${NS_NAMES[-1]} nft flush ruleset
         check_run nft flush ruleset
+        ip link del dev veth-forw-test
     } >/dev/null 2>&1
 }