]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
selftests: net: fix setup_ns usage in rtnetlink.sh
authorPaolo Abeni <pabeni@redhat.com>
Thu, 1 Feb 2024 18:42:39 +0000 (19:42 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 3 Feb 2024 05:11:07 +0000 (21:11 -0800)
The setup_ns helper marks the testns global variable as
readonly. Later attempts to set such variable are unsuccessful,
causing a couple test failures.

Avoid completely the variable re-initialization and let the
function access the global value.

Fixes: e9ce7ededf14 ("selftests: rtnetlink: use setup_ns in bonding test")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/6e7c937c8ff73ca52a21a4a536a13a76ec0173a8.1706812005.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/rtnetlink.sh

index 4667d74579d135eb74d701d79baa3036c88f2635..874a2952aa8ee16b1841bdd7e2930e54a1c99303 100755 (executable)
@@ -440,7 +440,6 @@ kci_test_encap_vxlan()
        local ret=0
        vxlan="test-vxlan0"
        vlan="test-vlan0"
-       testns="$1"
        run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \
                dev "$devdummy" dstport 4789
        if [ $? -ne 0 ]; then
@@ -485,7 +484,6 @@ kci_test_encap_fou()
 {
        local ret=0
        name="test-fou"
-       testns="$1"
        run_cmd_grep 'Usage: ip fou' ip fou help
        if [ $? -ne 0 ];then
                end_test "SKIP: fou: iproute2 too old"
@@ -526,8 +524,8 @@ kci_test_encap()
        run_cmd ip -netns "$testns" link set lo up
        run_cmd ip -netns "$testns" link add name "$devdummy" type dummy
        run_cmd ip -netns "$testns" link set "$devdummy" up
-       run_cmd kci_test_encap_vxlan "$testns"
-       run_cmd kci_test_encap_fou "$testns"
+       run_cmd kci_test_encap_vxlan
+       run_cmd kci_test_encap_fou
 
        ip netns del "$testns"
        return $ret