Lines Matching +full:1 +full:br +full:- +full:100
5 # set -e
35 devdummy="test-dummy0"
45 if [ $ret -eq 0 ]; then
46 ret=$1
48 [ -n "$2" ] && echo "$2"
51 # same but inverted -- used when command must fail for test to pass
54 if [ $1 -eq 0 ]; then
55 ret=1
63 if [ "$VERBOSE" = "1" ]; then
66 out=$($cmd 2>&1)
68 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
90 local find="$1"; shift
93 if [ "$VERBOSE" = "1" ]; then
94 echo "COMMAND: ${cmd} 2>&1 | grep -q '${find}'"
96 out=$($cmd 2>&1 | grep -q "${find}" 2>&1)
118 [ "${VERBOSE}" = "1" ] && echo
120 if [[ $ret -ne 0 ]] && [[ "${PAUSE_ON_FAIL}" = "yes" ]]; then
146 dev="$1"
150 run_cmd ip -$f netconf show dev "$dev"
153 if [ $ret -ne 0 ] ;then
155 test $r -eq 0 && ret=0
156 return 1
163 devbr="test-br0"
164 vlandev="testbr-vlan1"
170 run_cmd ip link add link "$devbr" name "$vlandev" type vlan id 1
172 run_cmd ip -6 addr add dev "$vlandev" dead:42::1234/64
173 run_cmd ip -d link
179 run_cmd ip -6 addr del dev "$vlandev" dead:42::1234/64
183 if [ $ret -ne 0 ];then
185 return 1
198 run_cmd ip tunnel add $gredev mode gre remote $rem local $loc ttl 1
210 if [ $ret -ne 0 ];then
212 return 1
218 # please see tools/testing/selftests/tc-testing.
224 run_cmd tc qdisc add dev "$dev" root handle 1: htb
225 run_cmd tc class add dev "$dev" parent 1: classid 1:10 htb rate 1mbit
226 run_cmd tc filter add dev "$dev" parent 1:0 prio 5 handle ffe: protocol ip u32 divisor 256
227 run_cmd tc filter add dev "$dev" parent 1:0 prio 5 handle ffd: protocol ip u32 divisor 256
228 run_cmd tc filter add dev "$dev" parent 1:0 prio 5 handle ffc: protocol ip u32 divisor 256
229 … filter add dev "$dev" protocol ip parent 1: prio 5 handle ffe:2:3 u32 ht ffe:2: match ip src 10.0…
230 … filter add dev "$dev" protocol ip parent 1: prio 5 handle ffe:2:2 u32 ht ffe:2: match ip src 10.0…
231 run_cmd tc filter show dev "$dev" parent 1:0
232 run_cmd tc filter del dev "$dev" protocol ip parent 1: prio 5 handle ffe:2:3 u32
233 run_cmd tc filter show dev "$dev" parent 1:0
234 run_cmd tc qdisc del dev "$dev" root handle 1: htb
236 if [ $ret -ne 0 ];then
238 return 1
247 run_cmd ip rule add fwmark 1 lookup 100
248 run_cmd ip route add local 0.0.0.0/0 dev lo table 100
250 run_cmd ip rule del fwmark 1 lookup 100
251 run_cmd ip route del local 0.0.0.0/0 dev lo table 100
253 if [ $ret -ne 0 ];then
255 return 1
262 local hash_policy=$(sysctl -n net.ipv4.fib_multipath_hash_policy)
267 run_cmd ip route get ::1
268 run_cmd ip route get fe80::1 dev "$devdummy"
270 run_cmd ip route get ::1 from ::1 iif lo oif lo tos 0x10 mark 0x1
277 sysctl -wq net.ipv4.fib_multipath_hash_policy=0
279 sysctl -wq net.ipv4.fib_multipath_hash_policy=1
281 sysctl -wq net.ipv4.fib_multipath_hash_policy="$hash_policy"
286 if [ $ret -ne 0 ];then
288 return 1
296 for i in $(seq 10 100) ;do
297 lft=$(((RANDOM%3) + 1))
298 run_cmd ip addr add 10.23.11.$i/32 dev "$devdummy" preferred_lft $lft valid_lft $((lft+1))
303 if [ $? -eq 0 ]; then
304 check_err 1
314 promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
316 sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1
320 ip -f inet addr add $IP/16 brd + dev "$devdummy"
326 [ $promote -eq 0 ] && sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=0
334 run_cmd ip addrlabel add prefix dead::/64 dev lo label 1
335 run_cmd_grep "prefix dead::/64 dev lo label 1" ip addrlabel list
336 run_cmd ip addrlabel del prefix dead::/64 dev lo label 1
337 run_cmd ip addrlabel add prefix dead::/64 label 1
338 run_cmd ip addrlabel del prefix dead::/64 label 1
341 for i in $(seq 1 1000); do
342 ip addrlabel add prefix 1c3::/64 label 12345 2>/dev/null
345 for i in $(seq 1 1000); do
346 ip addrlabel del prefix 1c3::/64 label 12345 2>/dev/null
351 ip addrlabel del prefix 1c3::/64 label 12345 2>/dev/null
353 if [ $ret -ne 0 ];then
355 return 1
368 if [ $ret -ne 0 ]; then
370 return 1
374 if [ -r "$syspathname" ] ; then
378 return 1
389 for i in $(seq 1 100); do
395 # re-add the alias -- kernel should free mem when dummy dev is removed
400 if [ $ret -ne 0 ]; then
402 return 1
410 vrfname="test-vrf"
413 if [ $? -ne 0 ]; then
418 if [ $ret -ne 0 ];then
422 run_cmd_grep "$vrfname" ip -br link show type vrf
423 if [ $ret -ne 0 ];then
425 return 1
432 if [ $ret -ne 0 ];then
434 return 1
443 vxlan="test-vxlan0"
444 vlan="test-vlan0"
445 run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \
447 if [ $? -ne 0 ]; then
452 run_cmd ip -netns "$testns" addr add 10.2.11.49/24 dev "$vxlan"
453 run_cmd ip -netns "$testns" link set up dev "$vxlan"
454 run_cmd ip -netns "$testns" link add link "$vxlan" name "$vlan" type vlan id 1
457 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan vni 43
458 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan group ffe5::5 dev "$devdummy"
459 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan ttl inherit
461 run_cmd ip -netns "$testns" link set dev "$vxlan" type vxlan ttl 64
462 run_cmd ip -netns "$testns" link set dev "$vxlan" type vxlan nolearning
464 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan proxy
465 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan norsc
466 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan l2miss
467 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan l3miss
468 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan external
469 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan udpcsum
470 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan udp6zerocsumtx
471 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan udp6zerocsumrx
472 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan remcsumtx
473 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan remcsumrx
474 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan gbp
475 run_cmd_fail ip -netns "$testns" link set dev "$vxlan" type vxlan gpe
476 run_cmd ip -netns "$testns" link del "$vxlan"
478 if [ $ret -ne 0 ]; then
480 return 1
488 name="test-fou"
490 if [ $? -ne 0 ];then
495 if ! /sbin/modprobe -q -n fou; then
499 /sbin/modprobe -q fou
501 run_cmd ip -netns "$testns" fou add port 7777 ipproto 47
502 if [ $? -ne 0 ];then
504 return 1
506 run_cmd ip -netns "$testns" fou add port 8888 ipproto 4
507 run_cmd_fail ip -netns "$testns" fou del port 9999
508 run_cmd ip -netns "$testns" fou del port 7777
509 if [ $ret -ne 0 ]; then
511 return 1
522 if [ $? -ne 0 ]; then
526 run_cmd ip -netns "$testns" link set lo up
527 run_cmd ip -netns "$testns" link add name "$devdummy" type dummy
528 run_cmd ip -netns "$testns" link set "$devdummy" up
541 if [ $? -ne 0 ]; then
546 if [ $ret -ne 0 ];then
548 return 1
551 run_cmd ip macsec add "$msname" rx port 1234 address "1c:ed:de:ad:be:ef"
552 …run_cmd ip macsec add "$msname" rx port 1234 address "1c:ed:de:ad:be:ef" sa 0 pn 1 on key 00 01234…
556 if [ $ret -ne 0 ];then
558 return 1
564 #-------------------------------------------------------------------
567 # spi 0x07 mode transport reqid 0x07 replay-window 32 \
581 #-------------------------------------------------------------------
602 mode transport reqid 0x07 replay-window 32 \
606 lines=`ip x s list | grep $srcip | grep $dstip | wc -l`
607 run_cmd test $lines -eq 2
608 run_cmd_grep "SAD count 1" ip x s count
610 lines=`ip x s get $ipsecid | grep $srcip | grep $dstip | wc -l`
611 run_cmd test $lines -eq 2
614 lines=`ip x s list | wc -l`
615 run_cmd test $lines -eq 0
623 lines=`ip x p list | grep $srcip | grep $dstip | wc -l`
624 run_cmd test $lines -eq 2
626 run_cmd_grep "SPD IN 0 OUT 1 FWD 0" ip x p count
628 lines=`ip x p get $ipsecsel | grep $srcip | grep $dstip | wc -l`
629 run_cmd test $lines -eq 2
633 lines=`ip x p list | wc -l`
634 run_cmd test $lines -eq 0
638 lines=`wc -l $tmpfile | cut "-d " -f1`
639 run_cmd test $lines -eq 20
640 rm -rf $tmpfile
647 if [ $ret -ne 0 ]; then
649 return 1
654 #-------------------------------------------------------------------
657 # spi 0x07 mode transport reqid 0x07 replay-window 32 \
665 #-------------------------------------------------------------------
677 if ! mount | grep -q debugfs; then
678 mount -t debugfs none /sys/kernel/debug/ &> /dev/null
682 if [ ! -w /sys/bus/netdevsim/new_device ] ; then
683 run_cmd modprobe -q netdevsim
684 if [ $ret -ne 0 ]; then
692 while [ ! -d $sysfsnet ] ; do :; done
698 if [ ! -d $sysfsd ] ; then
700 return 1
702 if [ ! -f $sysfsf ] ; then
704 return 1
727 if [ $ret -ne 0 ]; then
729 return 1
733 lines=`ip x s list | grep -c "crypto offload parameters: dev $dev dir"`
734 if [ $lines -ne 2 ] ; then
735 check_err 1
742 ping -I $dev -c 3 -W 1 -i 0 $dstip >/dev/null
745 run_cmd diff $sysfsf - << EOF
748 sa[0] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1
750 sa[1] rx ipaddr=$srcip
751 sa[1] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1
752 sa[1] key=0x34333231 38373635 32313039 36353433
754 if [ $? -ne 0 ] ; then
756 check_err 1
762 lines=`grep -c "SA count=0" $sysfsf`
763 if [ $lines -ne 1 ] ; then
764 check_err 1
772 if [ $ret -ne 0 ]; then
774 return 1
785 if [ $? -ne 0 ]; then
791 if [ $? -ne 0 ];then
798 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type gretap seq \
802 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
803 run_cmd ip -netns "$testns" link set dev $DEV_NS up
804 run_cmd ip -netns "$testns" link del "$DEV_NS"
807 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type gretap external
808 run_cmd ip -netns "$testns" link del "$DEV_NS"
810 if [ $ret -ne 0 ]; then
813 return 1
826 if [ $? -ne 0 ]; then
832 if [ $? -ne 0 ];then
839 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6gretap seq \
840 key 102 local fc00:100::1 remote fc00:100::2
843 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" fc00:200::1/96
844 run_cmd ip -netns "$testns" link set dev $DEV_NS up
845 run_cmd ip -netns "$testns" link del "$DEV_NS"
848 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6gretap external
849 run_cmd ip -netns "$testns" link del "$DEV_NS"
851 if [ $ret -ne 0 ]; then
854 return 1
866 if [ $? -ne 0 ];then
871 if [ $? -ne 0 ]; then
877 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan seq \
879 erspan_ver 1 erspan 488
882 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
883 run_cmd ip -netns "$testns" link set dev $DEV_NS up
884 run_cmd ip -netns "$testns" link del "$DEV_NS"
887 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan seq \
892 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
893 run_cmd ip -netns "$testns" link set dev $DEV_NS up
894 run_cmd ip -netns "$testns" link del "$DEV_NS"
897 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type erspan external
898 run_cmd ip -netns "$testns" link del "$DEV_NS"
900 if [ $ret -ne 0 ]; then
903 return 1
915 if [ $? -ne 0 ];then
920 if [ $? -ne 0 ]; then
926 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6erspan seq \
927 key 102 local fc00:100::1 remote fc00:100::2 \
928 erspan_ver 1 erspan 488
931 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
932 run_cmd ip -netns "$testns" link set dev $DEV_NS up
933 run_cmd ip -netns "$testns" link del "$DEV_NS"
936 run_cmd ip -netns "$testns" link add dev "$DEV_NS" type ip6erspan seq \
937 key 102 local fc00:100::1 remote fc00:100::2 \
941 run_cmd ip -netns "$testns" addr add dev "$DEV_NS" 10.1.1.100/24
942 run_cmd ip -netns "$testns" link set dev $DEV_NS up
943 run_cmd ip -netns "$testns" link del "$DEV_NS"
946 run_cmd ip -netns "$testns" link add dev "$DEV_NS" \
949 run_cmd ip -netns "$testns" link del "$DEV_NS"
951 if [ $ret -ne 0 ]; then
954 return 1
963 brdev="test-br0"
971 if [ $? -ne 0 ];then
977 if [ $? -ne 0 ]; then
981 IP="ip -netns $testns"
982 BRIDGE="bridge -netns $testns"
990 run_cmd_grep "dev $vxlandev master $brdev" $BRIDGE fdb get $test_mac br "$brdev"
995 if [ $ret -ne 0 ]; then
997 return 1
1007 local brdev="test-br0"
1011 if [ $? -ne 0 ]; then
1017 if [ $? -ne 0 ]; then
1021 IP="ip -netns $testns"
1022 BRIDGE="bridge -netns $testns"
1024 run_cmd $IP link add name $brdev type bridge vlan_filtering 1
1026 run_cmd $BRIDGE fdb add $test_mac dev $dummydev master static vlan 1
1027 run_cmd $BRIDGE vlan del vid 1 dev $dummydev
1028 run_cmd $BRIDGE fdb get $test_mac br $brdev vlan 1
1029 run_cmd $BRIDGE fdb del $test_mac dev $dummydev master vlan 1
1030 run_cmd_fail $BRIDGE fdb get $test_mac br $brdev vlan 1
1034 if [ $ret -ne 0 ]; then
1036 return 1
1050 if [ $? -ne 0 ];then
1075 if [ $ret -ne 0 ];then
1077 return 1
1089 if [ ! -w /sys/bus/netdevsim/new_device ] ; then
1090 run_cmd modprobe -q netdevsim
1091 if [ $ret -ne 0 ]; then
1098 echo "10 1" > /sys/bus/netdevsim/new_device
1099 while [ ! -d ${sysfsnet}10 ] ; do :; done
1100 echo "20 1" > /sys/bus/netdevsim/new_device
1101 while [ ! -d ${sysfsnet}20 ] ; do :; done
1105 run_cmd ip link add name test-bond0 type bond mode 802.3ad
1106 run_cmd ip link set dev $dev10 master test-bond0
1107 run_cmd ip link set dev $dev20 master test-bond0
1108 run_cmd ip link add name test-br0 type bridge
1109 run_cmd ip link set dev test-bond0 master test-br0
1112 ip link del dev test-br0
1113 ip link del dev test-bond0
1118 if [ $ret -ne 0 ]; then
1120 return 1
1127 local addr=$1; shift
1129 ip -N -j address show dev "$devdummy" |
1130 jq -e -r --arg addr "${addr%/*}" \
1136 ip -N -j address show dev "$devdummy" "$@" |
1137 jq -e -r '[.[].addr_info[] | .local | select(. != null)] | length'
1142 local what=$1; shift
1143 local addr=$1; shift
1182 (( count == 1 )) # just $addr3
1192 (( count == 1 )) # just $addr3
1199 if [ $ret -ne 0 ]; then
1201 return 1
1213 do_test_address_proto IPv6 2001:db8:1::1/64
1225 if [ $? -ne 0 ]; then
1230 run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr
1231 run_cmd ip -netns $testns link add dev $devdummy type dummy
1232 run_cmd ip -netns $testns link set dev $devdummy up
1233 run_cmd ip -netns $testns link set dev $devdummy master $bond down
1234 if [ $ret -ne 0 ]; then
1237 return 1
1246 # 1. Every `temporary` address must have a matching `mngtmpaddr`
1252 local dev=$1
1254 local addr_list=$(ip -j -n $testns addr show dev ${dev})
1256 jq -r '.[].addr_info[] | select(.temporary == true) | .local')
1258 jq -r '.[].addr_info[] | select(.mngtmpaddr == true) | .local' | \
1259 cut -d: -f1-4 | tr '\n' ' ')
1261 jq -r '.[].addr_info[] | select(.temporary == true and .deprecated != true) | .local' | \
1262 cut -d: -f1-4 | tr '\n' ' ')
1264 # 1. All temporary addresses (temp and dep) must have a matching mngtmpaddr
1266 prefix=$(echo ${address} | cut -d: -f1-4)
1268 check_err 1 "FAIL: Temporary $address with no matching mngtmpaddr!";
1276 check_err 1 "FAIL: No undeprecated temporary in $prefix!";
1281 return 1
1289 if [ $? -ne 0 ]; then
1294 # 1. Create a dummy Ethernet interface
1295 run_cmd ip -n $testns link add ${devdummy} type dummy
1296 run_cmd ip -n $testns link set ${devdummy} up
1297 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.use_tempaddr=1
1298 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.temp_prefered_lft=10
1299 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.temp_valid_lft=25
1300 run_cmd ip netns exec $testns sysctl -w net.ipv6.conf.${devdummy}.max_desync_factor=1
1305 for i in $(seq 1 9); do
1306 run_cmd ip -n $testns addr add 2001:db8:7e57:${i}::1/64 mngtmpaddr dev ${devdummy}
1314 # deleting and merely un-mngtmpaddr-ing), and confirm that the other
1316 for i in $(seq 1 9); do
1319 run_cmd ip -n $testns addr del 2001:db8:7e57:${i}::1/64 $mng_flag dev ${devdummy}
1321 run_cmd ip -n $testns addr change 2001:db8:7e57:${i}::1/64 dev ${devdummy}
1327 if [ $ret -ne 0 ]; then
1343 if [ $ret -ne 0 ];then
1345 return 1
1348 for current_test in ${TESTS:-$ALL_TESTS}; do
1362 -t <test> Test(s) to run (default: all)
1364 -v Verbose mode (show commands and output)
1365 -P Pause after every test
1366 -p Pause after every failing test before cleanup (for debugging)
1371 if [ "$(id -u)" -ne 0 ];then
1377 $x -Version 2>/dev/null >/dev/null
1378 if [ $? -ne 0 ];then
1387 v) VERBOSE=1;;
1391 *) usage; exit 1;;