tests: shell: move device to different namespace
Pablo Neira Ayuso
maintainerPATCH 1/1 tests: shell: move device to different namespace
This actually triggers a UNREGISTER event, it is similar to existing tests, but add this test to improve coverage for this scenario.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- .../shell/testcases/chains/netdev_move_device | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 tests/shell/testcases/chains/netdev_move_device
tests/shell/testcases/chains/netdev_move_device new file +39 -0
@@ -0,0 +1,39 @@ +#!/bin/bash + +set -e + +rnd=$(mktemp -u XXXXXXXX) +ns1="nft1-$rnd" + +cleanup() { + ip netns del "$ns1" + ip link del d0 &>/dev/null || : +} +trap 'cleanup' EXIT + +RULESET="table netdev x { + chain x {} + chain w { + ip daddr 8.7.6.0/24 counter + } + chain y { + type filter hook ingress device d0 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 } + } +}" + +ip netns add $ns1 +ip link add d0 type dummy +$NFT -f - <<< $RULESET + +# move device to $ns1 triggers UNREGISTER event +ip link set d0 netns $ns1 + +$NFT delete table netdev x + +# a simple test that also triggers UNREGISTER event +ip netns add $ns1 +ip -netns $ns1 link add d0 type dummy +ip netns exec $ns1 $NFT -f - <<< $RULESET +cleanup
Signature · 1 line
2.30.2