From 1a61725e6ce9bed64d0bd623f692f2db391abe9a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 5 Jan 2024 00:48:33 +0100 Subject: tests: shell: extend coverage for netdevice removal Add two extra tests to exercise netdevice removal path. Signed-off-by: Pablo Neira Ayuso --- .../testcases/chains/netdev_chain_multidev_gone | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tests/shell/testcases/chains/netdev_chain_multidev_gone (limited to 'tests/shell/testcases/chains/netdev_chain_multidev_gone') diff --git a/tests/shell/testcases/chains/netdev_chain_multidev_gone b/tests/shell/testcases/chains/netdev_chain_multidev_gone new file mode 100755 index 00000000..bc5ca7d0 --- /dev/null +++ b/tests/shell/testcases/chains/netdev_chain_multidev_gone @@ -0,0 +1,34 @@ +#!/bin/bash + +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_chain_binding) +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_netdev_chain_multidevice) + +set -e + +iface_cleanup() { + ip link del d0 &>/dev/null || : + ip link del d1 &>/dev/null || : + ip link del d2 &>/dev/null || : +} +trap 'iface_cleanup' EXIT + +ip link add d0 type dummy +ip link add d1 type dummy +ip link add d2 type dummy + +# Test auto-removal of chain hook on device removal +RULESET="table netdev x { + chain x {} + chain w { + ip daddr 8.7.6.0/24 jump { + ip daddr vmap { 8.7.6.3 : jump x, 8.7.6.4 : jump x } + } + } + chain y { + type filter hook ingress devices = { d0, d1, d2 } priority 0; + ip saddr { 1.2.3.4, 2.3.4.5 } counter + ip daddr vmap { 5.4.3.0/24 : jump w, 8.9.0.0/24 : jump x } + } +}" + +$NFT -f - <<< $RULESET -- cgit v1.2.3