Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/net: convert fdb_flush.sh to run it in unique namespace

Here is the test result after conversion.
# ./fdb_flush.sh
TEST: vx10: Expected 5 FDB entries, got 5 [ OK ]
TEST: vx20: Expected 5 FDB entries, got 5 [ OK ]
...
TEST: vx10: Expected 5 FDB entries, got 5 [ OK ]
TEST: Test entries with dst 192.0.2.1 [ OK ]

Acked-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20231213060856.4030084-14-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Hangbin Liu and committed by
Jakub Kicinski
b795db18 f6fc5b94

+6 -5
+6 -5
tools/testing/selftests/net/fdb_flush.sh
··· 5 5 # Check that flush works as expected with all the supported arguments and verify 6 6 # some combinations of arguments. 7 7 8 + source lib.sh 9 + 8 10 FLUSH_BY_STATE_TESTS=" 9 11 vxlan_test_flush_by_permanent 10 12 vxlan_test_flush_by_nopermanent ··· 741 739 742 740 setup() 743 741 { 744 - IP="ip -netns ns1" 745 - BRIDGE="bridge -netns ns1" 746 - 747 - ip netns add ns1 742 + setup_ns NS 743 + IP="ip -netns ${NS}" 744 + BRIDGE="bridge -netns ${NS}" 748 745 749 746 $IP link add name vx10 type vxlan id 1000 dstport "$VXPORT" 750 747 $IP link add name vx20 type vxlan id 2000 dstport "$VXPORT" ··· 760 759 $IP link del dev vx20 761 760 $IP link del dev vx10 762 761 763 - ip netns del ns1 762 + cleanup_ns ${NS} 764 763 } 765 764 766 765 ################################################################################