Lines Matching +full:pass +full:- +full:1
5 # set -e
37 devdummy="test-dummy0"
47 if [ $ret -eq 0 ]; then
48 ret=$1
50 [ -n "$2" ] && echo "$2"
53 # same but inverted -- used when command must fail for test to pass
56 if [ $1 -eq 0 ]; then
57 ret=1
65 if [ "$VERBOSE" = "1" ]; then
68 out=$($cmd 2>&1)
70 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
92 local find="$1"; shift
95 if [ "$VERBOSE" = "1" ]; then
96 echo "COMMAND: ${cmd} 2>&1 | grep -q '${find}'"
98 out=$($cmd 2>&1 | grep -q "${find}" 2>&1)
120 [ "${VERBOSE}" = "1" ] && echo
122 if [[ $ret -ne 0 ]] && [[ "${PAUSE_ON_FAIL}" = "yes" ]]; then
148 dev="$1"
152 run_cmd ip -$f netconf show dev "$dev"
155 if [ $ret -ne 0 ] ;then
157 test $r -eq 0 && ret=0
158 return 1
165 devbr="test-br0"
166 vlandev="testbr-vlan1"
172 run_cmd ip link add link "$devbr" name "$vlandev" type vlan id 1
174 run_cmd ip -6 addr add dev "$vlandev" dead:42::1234/64
175 run_cmd ip -d link
181 run_cmd ip -6 addr del dev "$vlandev" dead:42::1234/64
185 if [ $ret -ne 0 ];then
187 return 1
189 end_test "PASS: bridge setup"
200 run_cmd ip tunnel add $gredev mode gre remote $rem local $loc ttl 1
212 if [ $ret -ne 0 ];then
214 return 1
216 end_test "PASS: gre tunnel endpoint"
220 # please see tools/testing/selftests/tc-testing.
226 run_cmd tc qdisc add dev "$dev" root handle 1: htb
227 run_cmd tc class add dev "$dev" parent 1: classid 1:10 htb rate 1mbit
228 run_cmd tc filter add dev "$dev" parent 1:0 prio 5 handle ffe: protocol ip u32 divisor 256
229 run_cmd tc filter add dev "$dev" parent 1:0 prio 5 handle ffd: protocol ip u32 divisor 256
230 run_cmd tc filter add dev "$dev" parent 1:0 prio 5 handle ffc: protocol ip u32 divisor 256
231 run_cmd tc filter add dev "$dev" protocol ip parent 1: prio 5 handle ffe:2:3 u32 ht ffe:2: match ip src 10.0.0.3 flowid 1:10
232 run_cmd tc filter add dev "$dev" protocol ip parent 1: prio 5 handle ffe:2:2 u32 ht ffe:2: match ip src 10.0.0.2 flowid 1:10
233 run_cmd tc filter show dev "$dev" parent 1:0
234 run_cmd tc filter del dev "$dev" protocol ip parent 1: prio 5 handle ffe:2:3 u32
235 run_cmd tc filter show dev "$dev" parent 1:0
236 run_cmd tc qdisc del dev "$dev" root handle 1: htb
238 if [ $ret -ne 0 ];then
240 return 1
242 end_test "PASS: tc htb hierarchy"
249 run_cmd ip rule add fwmark 1 lookup 100
252 run_cmd ip rule del fwmark 1 lookup 100
255 if [ $ret -ne 0 ];then
257 return 1
259 end_test "PASS: policy routing"
264 local hash_policy=$(sysctl -n net.ipv4.fib_multipath_hash_policy)
269 run_cmd ip route get ::1
270 run_cmd ip route get fe80::1 dev "$devdummy"
272 run_cmd ip route get ::1 from ::1 iif lo oif lo tos 0x10 mark 0x1
279 sysctl -wq net.ipv4.fib_multipath_hash_policy=0
281 sysctl -wq net.ipv4.fib_multipath_hash_policy=1
283 sysctl -wq net.ipv4.fib_multipath_hash_policy="$hash_policy"
288 if [ $ret -ne 0 ];then
290 return 1
293 end_test "PASS: route get"
298 dev=$1
300 if ip addr show dev $dev | grep -q $addr; then
301 return 1
310 lft=$(((RANDOM%3) + 1))
311 run_cmd ip addr add 10.23.11.$i/32 dev "$devdummy" preferred_lft $lft valid_lft $((lft+1))
315 if [ $? -eq 1 ]; then
318 check_err 1
323 end_test "PASS: preferred_lft addresses have expired"
329 if [ $ret -ne 0 ]; then
333 promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
335 sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1
339 ip -f inet addr add $IP/16 brd + dev "$devdummy"
345 [ $promote -eq 0 ] && sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=0
347 end_test "PASS: promote_secondaries complete"
353 run_cmd ip addrlabel add prefix dead::/64 dev lo label 1
354 run_cmd_grep "prefix dead::/64 dev lo label 1" ip addrlabel list
355 run_cmd ip addrlabel del prefix dead::/64 dev lo label 1
356 run_cmd ip addrlabel add prefix dead::/64 label 1
357 run_cmd ip addrlabel del prefix dead::/64 label 1
360 for i in $(seq 1 1000); do
361 ip addrlabel add prefix 1c3::/64 label 12345 2>/dev/null
364 for i in $(seq 1 1000); do
365 ip addrlabel del prefix 1c3::/64 label 12345 2>/dev/null
370 ip addrlabel del prefix 1c3::/64 label 12345 2>/dev/null
372 if [ $ret -ne 0 ];then
374 return 1
377 end_test "PASS: ipv6 addrlabel"
387 if [ $ret -ne 0 ]; then
389 return 1
393 if [ -r "$syspathname" ] ; then
397 return 1
408 for i in $(seq 1 100); do
414 # re-add the alias -- kernel should free mem when dummy dev is removed
419 if [ $ret -ne 0 ]; then
421 return 1
424 end_test "PASS: set ifalias $namewant for $devdummy"
429 vrfname="test-vrf"
432 if [ $? -ne 0 ]; then
437 if [ $ret -ne 0 ];then
441 run_cmd_grep "$vrfname" ip -br link show type vrf
442 if [ $ret -ne 0 ];then
444 return 1
451 if [ $ret -ne 0 ];then
453 return 1
456 end_test "PASS: vrf"
462 vxlan="test-vxlan0"
463 vlan="test-vlan0"
464 run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \
466 if [ $? -ne 0 ]; then
471 run_cmd ip -netns "$testns" addr add 10.2.11.49/24 dev "$vxlan"
472 run_cmd ip -netns "$testns" link set up dev "$vxlan"
473 run_cmd ip -netns "$testns" link add link "$vxlan" name "$vlan" type vlan id 1
476 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan vni 43
477 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan group ffe5::5 dev "$devdummy"
478 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan ttl inherit
480 run_cmd ip -netns "$testns" link set dev "$vxlan" type vxlan ttl 64
481 run_cmd ip -netns "$testns" link set dev "$vxlan" type vxlan nolearning
483 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan proxy
484 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan norsc
485 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan l2miss
486 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan l3miss
487 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan external
488 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan udpcsum
489 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan udp6zerocsumtx
490 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan udp6zerocsumrx
491 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan remcsumtx
492 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan remcsumrx
493 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan gbp
494 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan gpe
495 run_cmd ip -netns "$testns" link del "$vxlan"
497 if [ $ret -ne 0 ]; then
499 return 1
501 end_test "PASS: vxlan"
507 name="test-fou"
509 if [ $? -ne 0 ];then
514 if ! /sbin/modprobe -q -n fou; then
518 /sbin/modprobe -q fou
520 run_cmd ip -netns "$testns" fou add port 7777 ipproto 47
521 if [ $? -ne 0 ];then
523 return 1
525 run_cmd ip -netns "$testns" fou add port 8888 ipproto 4
526 run_cmd_fail ip -netns "$testns" fou del port 9999
527 run_cmd ip -netns "$testns" fou del port 7777
528 if [ $ret -ne 0 ]; then
530 return 1
533 end_test "PASS: fou"
541 if [ $? -ne 0 ]; then
545 run_cmd ip -netns "$testns" link set lo up
546 run_cmd ip -netns "$testns" link add name "$devdummy" type dummy
547 run_cmd ip -netns "$testns" link set "$devdummy" up
560 if [ $? -ne 0 ]; then
565 if [ $ret -ne 0 ];then
567 return 1
570 run_cmd ip macsec add "$msname" rx port 1234 address "1c:ed:de:ad:be:ef"
571 run_cmd ip macsec add "$msname" rx port 1234 address "1c:ed:de:ad:be:ef" sa 0 pn 1 on key 00 0123456789abcdef0123456789abcdef
575 if [ $ret -ne 0 ];then
577 return 1
580 end_test "PASS: macsec"
593 if [ $? -ne 0 ]; then
598 if [ $ret -ne 0 ];then
600 return 1
604 ip link add link "$msname" name "$vlanname" type vlan id 1
610 if [ $ret -ne 0 ];then
612 return 1
615 end_test "PASS: macsec_vlan"
618 #-------------------------------------------------------------------
621 # spi 0x07 mode transport reqid 0x07 replay-window 32 \
635 #-------------------------------------------------------------------
656 mode transport reqid 0x07 replay-window 32 \
660 lines=`ip x s list | grep $srcip | grep $dstip | wc -l`
661 run_cmd test $lines -eq 2
662 run_cmd_grep "SAD count 1" ip x s count
664 lines=`ip x s get $ipsecid | grep $srcip | grep $dstip | wc -l`
665 run_cmd test $lines -eq 2
668 lines=`ip x s list | wc -l`
669 run_cmd test $lines -eq 0
677 lines=`ip x p list | grep $srcip | grep $dstip | wc -l`
678 run_cmd test $lines -eq 2
680 run_cmd_grep "SPD IN 0 OUT 1 FWD 0" ip x p count
682 lines=`ip x p get $ipsecsel | grep $srcip | grep $dstip | wc -l`
683 run_cmd test $lines -eq 2
687 lines=`ip x p list | wc -l`
688 run_cmd test $lines -eq 0
692 lines=`wc -l $tmpfile | cut "-d " -f1`
693 run_cmd test $lines -eq 20
694 rm -rf $tmpfile
701 if [ $ret -ne 0 ]; then
703 return 1
705 end_test "PASS: ipsec"
708 #-------------------------------------------------------------------
711 # spi 0x07 mode transport reqid 0x07 replay-window 32 \
719 #-------------------------------------------------------------------
732 if lsmod | grep -q esp4_offload; then
736 if ! mount | grep -q debugfs; then
737 mount -t debugfs none /sys/kernel/debug/ &> /dev/null
741 if [ ! -w /sys/bus/netdevsim/new_device ] ; then
742 run_cmd modprobe -q netdevsim
743 if [ $ret -ne 0 ]; then
751 while [ ! -d $sysfsnet ] ; do :; done
757 if [ ! -d $sysfsd ] ; then
759 return 1
761 if [ ! -f $sysfsf ] ; then
763 return 1
786 if [ $ret -ne 0 ]; then
788 return 1
792 lines=`ip x s list | grep -c "crypto offload parameters: dev $dev dir"`
793 if [ $lines -ne 2 ] ; then
794 check_err 1
801 ping -I $dev -c 3 -W 1 -i 0 $dstip >/dev/null
804 run_cmd diff $sysfsf - << EOF
807 sa[0] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1
809 sa[1] rx ipaddr=$srcip
810 sa[1] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1
811 sa[1] key=0x34333231 38373635 32313039 36353433
813 if [ $? -ne 0 ] ; then
815 check_err 1
821 lines=`grep -c "SA count=0" $sysfsf`
822 if [ $lines -ne 1 ] ; then
823 check_err 1
828 ! "$esp4_offload_probed_default" && lsmod | grep -q esp4_offload && rmmod esp4_offload
832 if [ $ret -ne 0 ]; then
834 return 1
836 end_test "PASS: ipsec_offload"
845 if [ $? -ne 0 ]; then
851 if [ $? -ne 0 ];then
858 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type gretap seq \
862 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
863 run_cmd ip -netns "$testns" link set dev $DEV_NS up
864 run_cmd ip -netns "$testns" link del "$DEV_NS"
867 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type gretap external
868 run_cmd ip -netns "$testns" link del "$DEV_NS"
870 if [ $ret -ne 0 ]; then
873 return 1
875 end_test "PASS: gretap"
886 if [ $? -ne 0 ]; then
892 if [ $? -ne 0 ];then
899 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6gretap seq \
900 key 102 local fc00:100::1 remote fc00:100::2
903 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" fc00:200::1/96
904 run_cmd ip -netns "$testns" link set dev $DEV_NS up
905 run_cmd ip -netns "$testns" link del "$DEV_NS"
908 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6gretap external
909 run_cmd ip -netns "$testns" link del "$DEV_NS"
911 if [ $ret -ne 0 ]; then
914 return 1
916 end_test "PASS: ip6gretap"
926 if [ $? -ne 0 ];then
931 if [ $? -ne 0 ]; then
937 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan seq \
939 erspan_ver 1 erspan 488
942 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
943 run_cmd ip -netns "$testns" link set dev $DEV_NS up
944 run_cmd ip -netns "$testns" link del "$DEV_NS"
947 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan seq \
952 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
953 run_cmd ip -netns "$testns" link set dev $DEV_NS up
954 run_cmd ip -netns "$testns" link del "$DEV_NS"
957 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan external
958 run_cmd ip -netns "$testns" link del "$DEV_NS"
960 if [ $ret -ne 0 ]; then
963 return 1
965 end_test "PASS: erspan"
975 if [ $? -ne 0 ];then
980 if [ $? -ne 0 ]; then
986 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6erspan seq \
987 key 102 local fc00:100::1 remote fc00:100::2 \
988 erspan_ver 1 erspan 488
991 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
992 run_cmd ip -netns "$testns" link set dev $DEV_NS up
993 run_cmd ip -netns "$testns" link del "$DEV_NS"
996 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6erspan seq \
997 key 102 local fc00:100::1 remote fc00:100::2 \
1001 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
1002 run_cmd ip -netns "$testns" link set dev $DEV_NS up
1003 run_cmd ip -netns "$testns" link del "$DEV_NS"
1006 run_cmd ip -netns "$testns" link add dev "$DEV_NS" \
1009 run_cmd ip -netns "$testns" link del "$DEV_NS"
1011 if [ $ret -ne 0 ]; then
1014 return 1
1016 end_test "PASS: ip6erspan"
1023 brdev="test-br0"
1031 if [ $? -ne 0 ];then
1037 if [ $? -ne 0 ]; then
1041 IP="ip -netns $testns"
1042 BRIDGE="bridge -netns $testns"
1055 if [ $ret -ne 0 ]; then
1057 return 1
1060 end_test "PASS: bridge fdb get"
1067 local brdev="test-br0"
1071 if [ $? -ne 0 ]; then
1077 if [ $? -ne 0 ]; then
1081 IP="ip -netns $testns"
1082 BRIDGE="bridge -netns $testns"
1084 run_cmd $IP link add name $brdev type bridge vlan_filtering 1
1086 run_cmd $BRIDGE fdb add $test_mac dev $dummydev master static vlan 1
1087 run_cmd $BRIDGE vlan del vid 1 dev $dummydev
1088 run_cmd $BRIDGE fdb get $test_mac br $brdev vlan 1
1089 run_cmd $BRIDGE fdb del $test_mac dev $dummydev master vlan 1
1090 run_cmd_fail $BRIDGE fdb get $test_mac br $brdev vlan 1
1094 if [ $ret -ne 0 ]; then
1096 return 1
1099 end_test "PASS: bridge fdb del"
1110 if [ $? -ne 0 ];then
1135 if [ $ret -ne 0 ];then
1137 return 1
1140 end_test "PASS: neigh get"
1149 if [ ! -w /sys/bus/netdevsim/new_device ] ; then
1150 run_cmd modprobe -q netdevsim
1151 if [ $ret -ne 0 ]; then
1158 echo "10 1" > /sys/bus/netdevsim/new_device
1159 while [ ! -d ${sysfsnet}10 ] ; do :; done
1160 echo "20 1" > /sys/bus/netdevsim/new_device
1161 while [ ! -d ${sysfsnet}20 ] ; do :; done
1165 run_cmd ip link add name test-bond0 type bond mode 802.3ad
1166 run_cmd ip link set dev $dev10 master test-bond0
1167 run_cmd ip link set dev $dev20 master test-bond0
1168 run_cmd ip link add name test-br0 type bridge
1169 run_cmd ip link set dev test-bond0 master test-br0
1172 ip link del dev test-br0
1173 ip link del dev test-bond0
1178 if [ $ret -ne 0 ]; then
1180 return 1
1182 end_test "PASS: bridge_parent_id"
1187 local addr=$1; shift
1189 ip -N -j address show dev "$devdummy" |
1190 jq -e -r --arg addr "${addr%/*}" \
1196 ip -N -j address show dev "$devdummy" "$@" |
1197 jq -e -r '[.[].addr_info[] | .local | select(. != null)] | length'
1202 local what=$1; shift
1203 local addr=$1; shift
1212 if [ $? -ne 0 ];then
1248 (( count == 1 )) # just $addr3
1258 (( count == 1 )) # just $addr3
1265 if [ $ret -ne 0 ]; then
1267 return 1
1269 end_test "PASS: address proto $what"
1279 do_test_address_proto IPv6 2001:db8:1::1/64
1291 if [ $? -ne 0 ]; then
1296 run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr
1297 run_cmd ip -netns $testns link add dev $devdummy type dummy
1298 run_cmd ip -netns $testns link set dev $devdummy up
1299 run_cmd ip -netns $testns link set dev $devdummy master $bond down
1300 if [ $ret -ne 0 ]; then
1303 return 1
1306 end_test "PASS: enslave interface in a bond"
1312 # 1. Every `temporary` address must have a matching `mngtmpaddr`
1318 local dev=$1
1320 local addr_list=$(ip -j -n $testns addr show dev ${dev})
1322 jq -r '.[].addr_info[] | select(.temporary == true) | .local')
1324 jq -r '.[].addr_info[] | select(.mngtmpaddr == true) | .local' | \
1325 cut -d: -f1-4 | tr '\n' ' ')
1327 jq -r '.[].addr_info[] | select(.temporary == true and .deprecated != true) | .local' | \
1328 cut -d: -f1-4 | tr '\n' ' ')
1330 # 1. All temporary addresses (temp and dep) must have a matching mngtmpaddr
1332 prefix=$(echo ${address} | cut -d: -f1-4)
1334 check_err 1 "FAIL: Temporary $address with no matching mngtmpaddr!";
1342 check_err 1 "FAIL: No undeprecated temporary in $prefix!";
1347 return 1
1355 if [ $? -ne 0 ]; then
1360 # 1. Create a dummy Ethernet interface
1361 run_cmd ip -n $testns link add ${devdummy} type dummy
1362 run_cmd ip -n $testns link set ${devdummy} up
1363 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.use_tempaddr=1
1364 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.temp_prefered_lft=10
1365 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.temp_valid_lft=25
1366 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.max_desync_factor=1
1371 for i in $(seq 1 9); do
1372 run_cmd ip -n $testns addr add 2001:db8:7e57:${i}::1/64 mngtmpaddr dev ${devdummy}
1380 # deleting and merely un-mngtmpaddr-ing), and confirm that the other
1382 for i in $(seq 1 9); do
1385 run_cmd ip -n $testns addr del 2001:db8:7e57:${i}::1/64 $mng_flag dev ${devdummy}
1387 run_cmd ip -n $testns addr change 2001:db8:7e57:${i}::1/64 dev ${devdummy}
1393 if [ $ret -ne 0 ]; then
1396 end_test "PASS: mngtmpaddr add/remove correctly"
1428 if [ "$ret" -ne 0 ]; then
1430 return 1
1433 end_test "PASS: operstate"
1442 if [ $ret -ne 0 ];then
1444 return 1
1447 for current_test in ${TESTS:-$ALL_TESTS}; do
1461 -t <test> Test(s) to run (default: all)
1463 -v Verbose mode (show commands and output)
1464 -P Pause after every test
1465 -p Pause after every failing test before cleanup (for debugging)
1470 if [ "$(id -u)" -ne 0 ];then
1476 $x -Version 2>/dev/null >/dev/null
1477 if [ $? -ne 0 ];then
1486 v) VERBOSE=1;;
1490 *) usage; exit 1;;