Commit 3a0f3367 authored by Hangbin Liu's avatar Hangbin Liu Committed by Paolo Abeni

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

Here is the test result after conversion.

2 tests also failed without this patch

]# ./arp_ndisc_untracked_subnets.sh
    TEST: test_arp:  accept_arp=0                                       [ OK ]
    TEST: test_arp:  accept_arp=1                                       [ OK ]
    TEST: test_arp:  accept_arp=2  same_subnet=0                        [ OK ]
    TEST: test_arp:  accept_arp=2  same_subnet=1                        [ OK ]
    TEST: test_ndisc:  accept_untracked_na=0                            [ OK ]
    TEST: test_ndisc:  accept_untracked_na=1                            [ OK ]
    TEST: test_ndisc:  accept_untracked_na=2  same_subnet=0             [ OK ]
    TEST: test_ndisc:  accept_untracked_na=2  same_subnet=1             [ OK ]
Acked-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 7f770d28
...@@ -5,16 +5,14 @@ ...@@ -5,16 +5,14 @@
# garp to the router. Router accepts or ignores based on its arp_accept # garp to the router. Router accepts or ignores based on its arp_accept
# or accept_untracked_na configuration. # or accept_untracked_na configuration.
source lib.sh
TESTS="arp ndisc" TESTS="arp ndisc"
ROUTER_NS="ns-router"
ROUTER_NS_V6="ns-router-v6"
ROUTER_INTF="veth-router" ROUTER_INTF="veth-router"
ROUTER_ADDR="10.0.10.1" ROUTER_ADDR="10.0.10.1"
ROUTER_ADDR_V6="2001:db8:abcd:0012::1" ROUTER_ADDR_V6="2001:db8:abcd:0012::1"
HOST_NS="ns-host"
HOST_NS_V6="ns-host-v6"
HOST_INTF="veth-host" HOST_INTF="veth-host"
HOST_ADDR="10.0.10.2" HOST_ADDR="10.0.10.2"
HOST_ADDR_V6="2001:db8:abcd:0012::2" HOST_ADDR_V6="2001:db8:abcd:0012::2"
...@@ -23,13 +21,11 @@ SUBNET_WIDTH=24 ...@@ -23,13 +21,11 @@ SUBNET_WIDTH=24
PREFIX_WIDTH_V6=64 PREFIX_WIDTH_V6=64
cleanup() { cleanup() {
ip netns del ${HOST_NS} cleanup_ns ${HOST_NS} ${ROUTER_NS}
ip netns del ${ROUTER_NS}
} }
cleanup_v6() { cleanup_v6() {
ip netns del ${HOST_NS_V6} cleanup_ns ${HOST_NS_V6} ${ROUTER_NS_V6}
ip netns del ${ROUTER_NS_V6}
} }
setup() { setup() {
...@@ -37,8 +33,7 @@ setup() { ...@@ -37,8 +33,7 @@ setup() {
local arp_accept=$1 local arp_accept=$1
# Set up two namespaces # Set up two namespaces
ip netns add ${ROUTER_NS} setup_ns HOST_NS ROUTER_NS
ip netns add ${HOST_NS}
# Set up interfaces veth0 and veth1, which are pairs in separate # Set up interfaces veth0 and veth1, which are pairs in separate
# namespaces. veth0 is veth-router, veth1 is veth-host. # namespaces. veth0 is veth-router, veth1 is veth-host.
...@@ -72,8 +67,7 @@ setup_v6() { ...@@ -72,8 +67,7 @@ setup_v6() {
local accept_untracked_na=$1 local accept_untracked_na=$1
# Set up two namespaces # Set up two namespaces
ip netns add ${ROUTER_NS_V6} setup_ns HOST_NS_V6 ROUTER_NS_V6
ip netns add ${HOST_NS_V6}
# Set up interfaces veth0 and veth1, which are pairs in separate # Set up interfaces veth0 and veth1, which are pairs in separate
# namespaces. veth0 is veth-router, veth1 is veth-host. # namespaces. veth0 is veth-router, veth1 is veth-host.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment