~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/net/netns-name.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/net/netns-name.sh (Architecture sparc) and /tools/testing/selftests/net/netns-name.sh (Architecture sparc64)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3                                                     3 
  4 source lib.sh                                       4 source lib.sh
  5 set -o pipefail                                     5 set -o pipefail
  6                                                     6 
  7 DEV=dummy-dev0                                      7 DEV=dummy-dev0
  8 DEV2=dummy-dev1                                     8 DEV2=dummy-dev1
  9 ALT_NAME=some-alt-name                              9 ALT_NAME=some-alt-name
 10                                                    10 
 11 RET_CODE=0                                         11 RET_CODE=0
 12                                                    12 
 13 cleanup() {                                        13 cleanup() {
 14     cleanup_ns $NS $test_ns                        14     cleanup_ns $NS $test_ns
 15 }                                                  15 }
 16                                                    16 
 17 trap cleanup EXIT                                  17 trap cleanup EXIT
 18                                                    18 
 19 fail() {                                           19 fail() {
 20     echo "ERROR: ${1:-unexpected return code}      20     echo "ERROR: ${1:-unexpected return code} (ret: $_)" >&2
 21     RET_CODE=1                                     21     RET_CODE=1
 22 }                                                  22 }
 23                                                    23 
 24 setup_ns NS test_ns                                24 setup_ns NS test_ns
 25                                                    25 
 26 #                                                  26 #
 27 # Test basic move without a rename                 27 # Test basic move without a rename
 28 #                                                  28 #
 29 ip -netns $NS link add name $DEV type dummy ||     29 ip -netns $NS link add name $DEV type dummy || fail
 30 ip -netns $NS link set dev $DEV netns $test_ns     30 ip -netns $NS link set dev $DEV netns $test_ns ||
 31     fail "Can't perform a netns move"              31     fail "Can't perform a netns move"
 32 ip -netns $test_ns link show dev $DEV >> /dev/     32 ip -netns $test_ns link show dev $DEV >> /dev/null || fail "Device not found after move"
 33 ip -netns $test_ns link del $DEV || fail           33 ip -netns $test_ns link del $DEV || fail
 34                                                    34 
 35 #                                                  35 #
 36 # Test move with a conflict                        36 # Test move with a conflict
 37 #                                                  37 #
 38 ip -netns $test_ns link add name $DEV type dum     38 ip -netns $test_ns link add name $DEV type dummy
 39 ip -netns $NS link add name $DEV type dummy ||     39 ip -netns $NS link add name $DEV type dummy || fail
 40 ip -netns $NS link set dev $DEV netns $test_ns     40 ip -netns $NS link set dev $DEV netns $test_ns 2> /dev/null &&
 41     fail "Performed a netns move with a name c     41     fail "Performed a netns move with a name conflict"
 42 ip -netns $test_ns link show dev $DEV >> /dev/     42 ip -netns $test_ns link show dev $DEV >> /dev/null || fail "Device not found after move"
 43 ip -netns $NS link del $DEV || fail                43 ip -netns $NS link del $DEV || fail
 44 ip -netns $test_ns link del $DEV || fail           44 ip -netns $test_ns link del $DEV || fail
 45                                                    45 
 46 #                                                  46 #
 47 # Test move with a conflict and rename             47 # Test move with a conflict and rename
 48 #                                                  48 #
 49 ip -netns $test_ns link add name $DEV type dum     49 ip -netns $test_ns link add name $DEV type dummy
 50 ip -netns $NS link add name $DEV type dummy ||     50 ip -netns $NS link add name $DEV type dummy || fail
 51 ip -netns $NS link set dev $DEV netns $test_ns     51 ip -netns $NS link set dev $DEV netns $test_ns name $DEV2 ||
 52     fail "Can't perform a netns move with rena     52     fail "Can't perform a netns move with rename"
 53 ip -netns $test_ns link del $DEV2 || fail          53 ip -netns $test_ns link del $DEV2 || fail
 54 ip -netns $test_ns link del $DEV || fail           54 ip -netns $test_ns link del $DEV || fail
 55                                                    55 
 56 #                                                  56 #
 57 # Test dup alt-name with netns move                57 # Test dup alt-name with netns move
 58 #                                                  58 #
 59 ip -netns $test_ns link add name $DEV type dum     59 ip -netns $test_ns link add name $DEV type dummy || fail
 60 ip -netns $test_ns link property add dev $DEV      60 ip -netns $test_ns link property add dev $DEV altname $ALT_NAME || fail
 61 ip -netns $NS link add name $DEV2 type dummy |     61 ip -netns $NS link add name $DEV2 type dummy || fail
 62 ip -netns $NS link property add dev $DEV2 altn     62 ip -netns $NS link property add dev $DEV2 altname $ALT_NAME || fail
 63                                                    63 
 64 ip -netns $NS link set dev $DEV2 netns $test_n     64 ip -netns $NS link set dev $DEV2 netns $test_ns 2> /dev/null &&
 65     fail "Moved with alt-name dup"                 65     fail "Moved with alt-name dup"
 66                                                    66 
 67 ip -netns $test_ns link del $DEV || fail           67 ip -netns $test_ns link del $DEV || fail
 68 ip -netns $NS link del $DEV2 || fail               68 ip -netns $NS link del $DEV2 || fail
 69                                                    69 
 70 #                                                  70 #
 71 # Test creating alt-name in one net-ns and usi     71 # Test creating alt-name in one net-ns and using in another
 72 #                                                  72 #
 73 ip -netns $NS link add name $DEV type dummy ||     73 ip -netns $NS link add name $DEV type dummy || fail
 74 ip -netns $NS link property add dev $DEV altna     74 ip -netns $NS link property add dev $DEV altname $ALT_NAME || fail
 75 ip -netns $NS link set dev $DEV netns $test_ns     75 ip -netns $NS link set dev $DEV netns $test_ns || fail
 76 ip -netns $test_ns link show dev $ALT_NAME >>      76 ip -netns $test_ns link show dev $ALT_NAME >> /dev/null || fail "Can't find alt-name after move"
 77 ip -netns $NS link show dev $ALT_NAME 2> /dev/     77 ip -netns $NS link show dev $ALT_NAME 2> /dev/null &&
 78     fail "Can still find alt-name after move"      78     fail "Can still find alt-name after move"
 79 ip -netns $test_ns link del $DEV || fail           79 ip -netns $test_ns link del $DEV || fail
 80                                                    80 
 81 echo -ne "$(basename $0) \t\t\t\t"                 81 echo -ne "$(basename $0) \t\t\t\t"
 82 if [ $RET_CODE -eq 0 ]; then                       82 if [ $RET_CODE -eq 0 ]; then
 83     echo "[  OK  ]"                                83     echo "[  OK  ]"
 84 else                                               84 else
 85     echo "[ FAIL ]"                                85     echo "[ FAIL ]"
 86 fi                                                 86 fi
 87 exit $RET_CODE                                     87 exit $RET_CODE
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php