Lines Matching +full:no +full:- +full:loopback +full:- +full:test

2 # SPDX-License-Identifier: GPL-2.0
9 # 2. client, server, no-server
13 # 6. VRF and non-VRF permutations
16 # ns-A | ns-B
17 # No VRF case:
18 # [ lo ] [ eth1 ]---|---[ eth1 ] [ lo ]
21 # [ red ]---[ eth1 ]---|---[ eth1 ] [ lo ]
23 # ns-A:
30 # ns-B:
35 # ns-A to ns-C connection - only for VRF and same config
36 # as ns-A to ns-B
38 # server / client nomenclature relative to ns-A
74 NSA=ns-A
75 NSB=ns-B
76 NSC=ns-C
95 if [ ${rc} -eq ${expected} ]; then
97 printf "TEST: %-70s [ OK ]\n" "${msg}"
100 printf "TEST: %-70s [FAIL]\n" "${msg}"
128 log_test $rc $expected "$msg - ${astr}"
150 # make sure we have no test instances running
193 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
222 if [ $rc -ne 0 ]; then
244 if [ $rc -ne 0 ]; then
266 if [ $rc -ne 0 ]; then
281 # set sysctl values in NS-A
286 run_cmd sysctl -q -w $*
295 127.0.0.1) echo "loopback";;
296 ::1) echo "IPv6 loopback";;
298 ${NSA_IP}) echo "ns-A IP";;
299 ${NSA_IP6}) echo "ns-A IPv6";;
300 ${NSA_LO_IP}) echo "ns-A loopback IP";;
301 ${NSA_LO_IP6}) echo "ns-A loopback IPv6";;
302 ${NSA_LINKIP6}|${NSA_LINKIP6}%*) echo "ns-A IPv6 LLA";;
304 ${NSB_IP}) echo "ns-B IP";;
305 ${NSB_IP6}) echo "ns-B IPv6";;
306 ${NSB_LO_IP}) echo "ns-B loopback IP";;
307 ${NSB_LO_IP6}) echo "ns-B loopback IPv6";;
308 ${NSB_LINKIP6}|${NSB_LINKIP6}%*) echo "ns-B IPv6 LLA";;
325 addr=$(ip -netns ${ns} -6 -br addr show dev ${dev} | \
335 [ -z "$addr" ] && return 1
353 ip -netns ${ns} link add ${vrf} type vrf table ${table}
354 ip -netns ${ns} link set ${vrf} up
355 ip -netns ${ns} route add vrf ${vrf} unreachable default metric 8192
356 ip -netns ${ns} -6 route add vrf ${vrf} unreachable default metric 8192
358 ip -netns ${ns} addr add 127.0.0.1/8 dev ${vrf}
359 ip -netns ${ns} -6 addr add ::1 dev ${vrf} nodad
360 if [ "${addr}" != "-" ]; then
361 ip -netns ${ns} addr add dev ${vrf} ${addr}
363 if [ "${addr6}" != "-" ]; then
364 ip -netns ${ns} -6 addr add dev ${vrf} ${addr6}
367 ip -netns ${ns} ru del pref 0
368 ip -netns ${ns} ru add pref 32765 from all lookup local
369 ip -netns ${ns} -6 ru del pref 0
370 ip -netns ${ns} -6 ru add pref 32765 from all lookup local
381 ip -netns ${ns} link set lo up
382 if [ "${addr}" != "-" ]; then
383 ip -netns ${ns} addr add dev lo ${addr}
385 if [ "${addr6}" != "-" ]; then
386 ip -netns ${ns} -6 addr add dev lo ${addr6}
389 ip -netns ${ns} ro add unreachable default metric 8192
390 ip -netns ${ns} -6 ro add unreachable default metric 8192
392 ip netns exec ${ns} sysctl -qw net.ipv4.ip_forward=1
393 ip netns exec ${ns} sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1
394 ip netns exec ${ns} sysctl -qw net.ipv6.conf.all.forwarding=1
395 ip netns exec ${ns} sysctl -qw net.ipv6.conf.default.forwarding=1
410 ip -netns ${ns1} li add ${ns1_dev} type veth peer name tmp
411 ip -netns ${ns1} li set ${ns1_dev} up
412 ip -netns ${ns1} li set tmp netns ${ns2} name ${ns2_dev}
413 ip -netns ${ns2} li set ${ns2_dev} up
415 if [ "${ns1_addr}" != "-" ]; then
416 ip -netns ${ns1} addr add dev ${ns1_dev} ${ns1_addr}
417 ip -netns ${ns2} addr add dev ${ns2_dev} ${ns2_addr}
420 if [ "${ns1_addr6}" != "-" ]; then
421 ip -netns ${ns1} addr add dev ${ns1_dev} ${ns1_addr6}
422 ip -netns ${ns2} addr add dev ${ns2_dev} ${ns2_addr6}
429 ip netns | grep -q ${NSA}
430 if [ $? -eq 0 ]; then
431 ip -netns ${NSA} link delete ${VRF}
432 ip -netns ${NSA} ro flush table ${VRF_TABLE}
434 ip -netns ${NSA} addr flush dev ${NSA_DEV}
435 ip -netns ${NSA} -6 addr flush dev ${NSA_DEV}
436 ip -netns ${NSA} link set dev ${NSA_DEV} down
437 ip -netns ${NSA} link del dev ${NSA_DEV}
455 set -e
465 # tell ns-A how to get to remote addresses of ns-B
469 ip -netns ${NSA} link set dev ${NSA_DEV} vrf ${VRF}
470 ip -netns ${NSA} ro add vrf ${VRF} ${NSB_LO_IP}/32 via ${NSB_IP} dev ${NSA_DEV}
471 ip -netns ${NSA} -6 ro add vrf ${VRF} ${NSB_LO_IP6}/128 via ${NSB_IP6} dev ${NSA_DEV}
473 ip -netns ${NSB} ro add ${VRF_IP}/32 via ${NSA_IP} dev ${NSB_DEV}
474 ip -netns ${NSB} -6 ro add ${VRF_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV}
476 # some VRF tests use ns-C which has the same config as
477 # ns-B but for a device NOT in the VRF
478 create_ns ${NSC} "-" "-"
482 ip -netns ${NSA} ro add ${NSB_LO_IP}/32 via ${NSB_IP} dev ${NSA_DEV}
483 ip -netns ${NSA} ro add ${NSB_LO_IP6}/128 via ${NSB_IP6} dev ${NSA_DEV}
487 # tell ns-B how to get to remote addresses of ns-A
488 ip -netns ${NSB} ro add ${NSA_LO_IP}/32 via ${NSA_IP} dev ${NSB_DEV}
489 ip -netns ${NSB} ro add ${NSA_LO_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV}
503 set -e
505 create_ns ${NSA} "-" "-"
506 create_ns ${NSB} "-" "-"
507 create_ns ${NSC} "-" "-"
508 connect_ns ${NSA} ${NSA_DEV} "-" "-" \
509 ${NSB} ${NSB_DEV} "-" "-"
510 connect_ns ${NSA} ${NSA_DEV2} "-" "-" \
511 ${NSC} ${NSC_DEV} "-" "-"
517 create_vrf ${NSA} ${VRF} ${VRF_TABLE} "-" "-"
518 ip -netns ${NSA} link set dev ${NSA_DEV} vrf ${VRF}
519 ip -netns ${NSA} link set dev ${NSA_DEV2} vrf ${VRF}
539 run_cmd ping -c1 -w1 ${a}
543 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
547 run_cmd ping -c1 -w1 -I ${NSA_LO_IP} ${a}
557 run_cmd_nsb ping -c1 -w1 ${a}
567 run_cmd ping -c1 -w1 ${a}
577 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
580 # loopback addresses not reachable from device bind
586 show_hint "Fails since address on loopback device is out of device scope"
587 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
601 run_cmd ping -c1 -w1 ${a}
607 # run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
612 run_cmd_nsb ping -c1 -w1 ${a}
629 run_cmd ping -c1 -w1 ${a}
635 # run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
640 run_cmd_nsb ping -c1 -w1 ${a}
650 run_cmd ping -c1 -w1 ${a}
656 # run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
672 run_cmd ping -c1 -w1 -I ${VRF} ${a}
676 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
680 run_cmd ip vrf exec ${VRF} ping -c1 -w1 -I ${NSA_IP} ${a}
684 run_cmd ip vrf exec ${VRF} ping -c1 -w1 -I ${VRF_IP} ${a}
694 run_cmd_nsb ping -c1 -w1 ${a}
705 run_cmd ping -c1 -w1 -I ${VRF} ${a}
715 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
723 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
735 run_cmd ping -c1 -w1 -I ${VRF} ${a}
739 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
745 run_cmd_nsb ping -c1 -w1 ${a}
759 run_cmd ping -c1 -w1 -I ${VRF} ${a}
763 run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
769 run_cmd_nsb ping -c1 -w1 ${a}
777 log_subsection "No VRF"
804 run_cmd nettest -s -M ${MD5_PW} -r ${NSB_IP} &
806 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
812 run_cmd nettest -s &
814 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
815 log_test $? 2 "MD5: Server no config, client uses password"
820 run_cmd nettest -s -M ${MD5_PW} -r ${NSB_IP} &
822 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
828 run_cmd nettest -s -M ${MD5_PW} -r ${NSB_LO_IP} &
830 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
834 # MD5 extension - prefix length
839 run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} &
841 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
847 run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} &
849 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
855 run_cmd nettest -s -M ${MD5_PW} -m ${NS_NET} &
857 run_cmd_nsb nettest -l ${NSB_LO_IP} -r ${NSA_IP} -M ${MD5_PW}
872 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP} &
874 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
880 run_cmd nettest -s -d ${VRF} &
882 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
883 log_test $? 2 "MD5: VRF: Server no config, client uses password"
888 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP} &
890 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
896 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -r ${NSB_LO_IP} &
898 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
902 # MD5 extension - prefix length
907 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET} &
909 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
915 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET} &
917 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
923 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET} &
925 run_cmd_nsb nettest -l ${NSB_LO_IP} -r ${NSA_IP} -M ${MD5_PW}
933 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP} &
934 run_cmd nettest -s -M ${MD5_WRONG_PW} -r ${NSB_IP} &
936 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
940 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP} &
941 run_cmd nettest -s -M ${MD5_WRONG_PW} -r ${NSB_IP} &
943 run_cmd_nsc nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
948 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP} &
949 run_cmd nettest -s -M ${MD5_WRONG_PW} -r ${NSB_IP} &
951 run_cmd_nsc nettest -r ${NSA_IP} -M ${MD5_PW}
956 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP} &
957 run_cmd nettest -s -M ${MD5_WRONG_PW} -r ${NSB_IP} &
959 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
963 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET} &
964 run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} &
966 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_PW}
970 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET} &
971 run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} &
973 run_cmd_nsc nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
978 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET} &
979 run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} &
981 run_cmd_nsc nettest -r ${NSA_IP} -M ${MD5_PW}
986 run_cmd nettest -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET} &
987 run_cmd nettest -s -M ${MD5_WRONG_PW} -m ${NS_NET} &
989 run_cmd_nsb nettest -r ${NSA_IP} -M ${MD5_WRONG_PW}
996 run_cmd nettest -s -d ${NSA_DEV} -M ${MD5_PW} -r ${NSB_IP}
997 log_test $? 1 "MD5: VRF: Device must be a VRF - single address"
1000 run_cmd nettest -s -d ${NSA_DEV} -M ${MD5_PW} -m ${NS_NET}
1001 log_test $? 1 "MD5: VRF: Device must be a VRF - prefix"
1015 run_cmd nettest -s &
1017 run_cmd_nsb nettest -r ${a}
1023 run_cmd nettest -s -d ${NSA_DEV} &
1025 run_cmd_nsb nettest -r ${a}
1032 show_hint "Should fail 'Connection refused' since there is no server"
1033 run_cmd_nsb nettest -r ${a}
1034 log_test_addr ${a} $? 1 "No server"
1043 run_cmd_nsb nettest -s &
1045 run_cmd nettest -r ${a} -0 ${NSA_IP}
1049 run_cmd_nsb nettest -s &
1051 run_cmd nettest -r ${a} -d ${NSA_DEV}
1056 run_cmd nettest -r ${a}
1057 log_test_addr ${a} $? 1 "No server, unbound client"
1061 run_cmd nettest -r ${a} -d ${NSA_DEV}
1062 log_test_addr ${a} $? 1 "No server, device client"
1071 run_cmd nettest -s &
1073 run_cmd nettest -r ${a} -0 ${a} -1 ${a}
1079 run_cmd nettest -s -d ${NSA_DEV} &
1081 run_cmd nettest -r ${a} -0 ${a}
1087 show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope"
1088 run_cmd nettest -s -d ${NSA_DEV} &
1090 run_cmd nettest -r ${a}
1096 run_cmd nettest -s &
1098 run_cmd nettest -r ${a} -0 ${a} -d ${NSA_DEV}
1104 show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope"
1105 run_cmd nettest -s &
1107 run_cmd nettest -r ${a} -d ${NSA_DEV}
1113 run_cmd nettest -s -d ${NSA_DEV} -2 ${NSA_DEV} &
1115 run_cmd nettest -d ${NSA_DEV} -r ${a} -0 ${a}
1120 run_cmd nettest -d ${NSA_DEV} -r ${a}
1121 log_test_addr ${a} $? 1 "No server, device client, local conn"
1142 run_cmd nettest -s &
1144 run_cmd_nsb nettest -r ${a}
1148 run_cmd nettest -s -d ${VRF} -2 ${VRF} &
1150 run_cmd_nsb nettest -r ${a}
1154 run_cmd nettest -s -d ${NSA_DEV} -2 ${NSA_DEV} &
1156 run_cmd_nsb nettest -r ${a}
1161 show_hint "Should fail 'Connection refused' since there is no server"
1162 run_cmd_nsb nettest -r ${a}
1163 log_test_addr ${a} $? 1 "No server"
1171 run_cmd nettest -s &
1173 run_cmd nettest -r ${a} -d ${NSA_DEV}
1189 run_cmd nettest -s -2 ${VRF} &
1191 run_cmd_nsb nettest -r ${a}
1196 run_cmd nettest -s -d ${VRF} -2 ${VRF} &
1198 run_cmd_nsb nettest -r ${a}
1204 run_cmd_nsb nettest -r ${a}
1205 log_test_addr ${a} $? 1 "No server"
1211 run_cmd nettest -s -d ${NSA_DEV} -2 ${NSA_DEV} &
1213 run_cmd_nsb nettest -r ${a}
1221 run_cmd nettest -s -d ${VRF} &
1223 run_cmd nettest -r ${a}
1233 run_cmd_nsb nettest -s &
1235 run_cmd nettest -r ${a} -d ${VRF}
1239 run_cmd_nsb nettest -s &
1241 run_cmd nettest -r ${a} -d ${NSA_DEV}
1246 run_cmd nettest -r ${a} -d ${VRF}
1247 log_test_addr ${a} $? 1 "No server, VRF client"
1251 run_cmd nettest -r ${a} -d ${NSA_DEV}
1252 log_test_addr ${a} $? 1 "No server, device client"
1258 run_cmd nettest -s -d ${VRF} -2 ${VRF} &
1260 run_cmd nettest -r ${a} -d ${VRF} -0 ${a}
1266 run_cmd nettest -s -d ${VRF} -2 ${VRF} &
1268 run_cmd nettest -r ${a} -d ${NSA_DEV} -0 ${a}
1272 show_hint "Should fail 'No route to host' since client is out of VRF scope"
1273 run_cmd nettest -s -d ${VRF} &
1275 run_cmd nettest -r ${a}
1279 run_cmd nettest -s -d ${NSA_DEV} -2 ${NSA_DEV} &
1281 run_cmd nettest -r ${a} -d ${VRF} -0 ${a}
1285 run_cmd nettest -s -d ${NSA_DEV} -2 ${NSA_DEV} &
1287 run_cmd nettest -r ${a} -d ${NSA_DEV} -0 ${a}
1294 log_subsection "No VRF"
1297 # tcp_l3mdev_accept should have no affect without VRF;
1324 run_cmd nettest -D -s -2 ${NSA_DEV} &
1326 run_cmd_nsb nettest -D -r ${a}
1330 show_hint "Should fail 'Connection refused' since there is no server"
1331 run_cmd_nsb nettest -D -r ${a}
1332 log_test_addr ${a} $? 1 "No server"
1337 run_cmd nettest -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
1339 run_cmd_nsb nettest -D -r ${a}
1348 run_cmd_nsb nettest -D -s &
1350 run_cmd nettest -D -r ${a} -0 ${NSA_IP}
1354 run_cmd_nsb nettest -D -s &
1356 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -0 ${NSA_IP}
1360 run_cmd_nsb nettest -D -s &
1362 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -C -0 ${NSA_IP}
1366 run_cmd_nsb nettest -D -s &
1368 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP}
1373 run_cmd nettest -D -r ${a}
1374 log_test_addr ${a} $? 1 "No server, unbound client"
1378 run_cmd nettest -D -r ${a} -d ${NSA_DEV}
1379 log_test_addr ${a} $? 1 "No server, device client"
1388 run_cmd nettest -D -s &
1390 run_cmd nettest -D -r ${a} -0 ${a} -1 ${a}
1396 run_cmd nettest -s -D -d ${NSA_DEV} -2 ${NSA_DEV} &
1398 run_cmd nettest -D -r ${a}
1405 run_cmd nettest -s -D -d ${NSA_DEV} &
1407 run_cmd nettest -D -r ${a}
1413 run_cmd nettest -s -D &
1415 run_cmd nettest -D -d ${NSA_DEV} -r ${a}
1419 run_cmd nettest -s -D &
1421 run_cmd nettest -D -d ${NSA_DEV} -C -r ${a}
1425 run_cmd nettest -s -D &
1427 run_cmd nettest -D -d ${NSA_DEV} -S -r ${a}
1430 # IPv4 with device bind has really weird behavior - it overrides the
1436 show_hint "Should fail since addresses on loopback are out of device scope"
1437 run_cmd nettest -D -s &
1439 run_cmd nettest -D -r ${a} -d ${NSA_DEV}
1443 show_hint "Should fail since addresses on loopback are out of device scope"
1444 run_cmd nettest -D -s &
1446 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -C
1450 show_hint "Should fail since addresses on loopback are out of device scope"
1451 run_cmd nettest -D -s &
1453 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S
1459 run_cmd nettest -D -s -d ${NSA_DEV} -2 ${NSA_DEV} &
1461 run_cmd nettest -D -d ${NSA_DEV} -r ${a} -0 ${a}
1465 run_cmd nettest -D -d ${NSA_DEV} -r ${a}
1466 log_test_addr ${a} $? 2 "No server, device client, local conn"
1484 run_cmd nettest -D -s &
1486 run_cmd_nsb nettest -D -r ${a}
1490 run_cmd nettest -D -d ${VRF} -s -2 ${NSA_DEV} &
1492 run_cmd_nsb nettest -D -r ${a}
1496 run_cmd nettest -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
1498 run_cmd_nsb nettest -D -r ${a}
1502 show_hint "Should fail 'Connection refused' since there is no server"
1503 run_cmd_nsb nettest -D -r ${a}
1504 log_test_addr ${a} $? 1 "No server"
1508 run_cmd nettest -D -s &
1510 run_cmd nettest -D -d ${VRF} -r ${a}
1516 run_cmd nettest -s -D -d ${VRF} -2 ${NSA_DEV} &
1518 run_cmd nettest -D -d ${VRF} -r ${a}
1522 run_cmd nettest -s -D -d ${VRF} -2 ${NSA_DEV} &
1524 run_cmd nettest -D -d ${NSA_DEV} -r ${a}
1529 run_cmd nettest -s -D -d ${NSA_DEV} -2 ${NSA_DEV} &
1531 run_cmd nettest -D -d ${VRF} -r ${a}
1535 run_cmd nettest -s -D -d ${NSA_DEV} -2 ${NSA_DEV} &
1537 run_cmd nettest -D -d ${NSA_DEV} -r ${a}
1550 run_cmd nettest -D -s -2 ${NSA_DEV} &
1552 run_cmd_nsb nettest -D -r ${a}
1556 run_cmd nettest -D -d ${VRF} -s -2 ${NSA_DEV} &
1558 run_cmd_nsb nettest -D -r ${a}
1562 run_cmd nettest -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
1564 run_cmd_nsb nettest -D -r ${a}
1569 run_cmd_nsb nettest -D -r ${a}
1570 log_test_addr ${a} $? 1 "No server"
1577 run_cmd_nsb nettest -D -s &
1579 run_cmd nettest -d ${VRF} -D -r ${NSB_IP} -1 ${NSA_IP}
1583 run_cmd_nsb nettest -D -s &
1585 run_cmd nettest -d ${NSA_DEV} -D -r ${NSB_IP} -1 ${NSA_IP}
1588 # negative test - should fail
1591 run_cmd nettest -D -d ${VRF} -r ${NSB_IP}
1592 log_test $? 1 "No server, VRF client"
1596 run_cmd nettest -D -d ${NSA_DEV} -r ${NSB_IP}
1597 log_test $? 1 "No server, enslaved device client"
1604 run_cmd nettest -D -s -2 ${NSA_DEV} &
1606 run_cmd nettest -D -d ${VRF} -r ${a}
1610 run_cmd nettest -s -D -d ${VRF} -2 ${NSA_DEV} &
1612 run_cmd nettest -D -d ${VRF} -r ${a}
1616 run_cmd nettest -s -D -d ${VRF} -2 ${NSA_DEV} &
1618 run_cmd nettest -D -d ${NSA_DEV} -r ${a}
1622 run_cmd nettest -s -D -d ${NSA_DEV} -2 ${NSA_DEV} &
1624 run_cmd nettest -D -d ${VRF} -r ${a}
1628 run_cmd nettest -s -D -d ${NSA_DEV} -2 ${NSA_DEV} &
1630 run_cmd nettest -D -d ${NSA_DEV} -r ${a}
1636 run_cmd nettest -D -s -2 ${VRF} &
1638 run_cmd nettest -D -d ${VRF} -r ${a}
1645 run_cmd nettest -s -D -d ${VRF} -2 ${VRF} &
1647 run_cmd nettest -D -d ${VRF} -r ${a}
1651 # negative test - should fail
1657 run_cmd nettest -D -d ${VRF} -r ${a}
1658 log_test_addr ${a} $? 1 "No server, VRF client, local conn"
1665 log_subsection "No VRF"
1669 # udp_l3mdev_accept should have no affect without VRF;
1696 run_cmd nettest -s -R -P icmp -l ${a} -b
1700 run_cmd nettest -s -R -P icmp -l ${a} -d ${NSA_DEV} -b
1709 run_cmd nettest -l ${a} -r ${NSB_IP} -t1 -b
1713 run_cmd nettest -l ${a} -r ${NSB_IP} -d ${NSA_DEV} -t1 -b
1718 # is that the address is valid in the L3 domain. So this test
1723 #run_cmd nettest -s -l ${a} -d ${NSA_DEV} -t1 -b
1735 run_cmd nettest -s -R -P icmp -l ${a} -b
1739 run_cmd nettest -s -R -P icmp -l ${a} -d ${NSA_DEV} -b
1742 run_cmd nettest -s -R -P icmp -l ${a} -d ${VRF} -b
1748 show_hint "Address on loopback is out of VRF scope"
1749 run_cmd nettest -s -R -P icmp -l ${a} -d ${VRF} -b
1758 run_cmd nettest -s -l ${a} -d ${VRF} -t1 -b
1762 run_cmd nettest -s -l ${a} -d ${NSA_DEV} -t1 -b
1768 show_hint "Address on loopback out of scope for VRF"
1769 run_cmd nettest -s -l ${a} -d ${VRF} -t1 -b
1773 show_hint "Address on loopback out of scope for device in VRF"
1774 run_cmd nettest -s -l ${a} -d ${NSA_DEV} -t1 -b
1782 log_subsection "No VRF"
1807 run_cmd nettest ${varg} -s &
1809 run_cmd_nsb nettest ${varg} -r ${a} &
1821 run_cmd nettest ${varg} -s -d ${VRF} &
1823 run_cmd_nsb nettest ${varg} -r ${a} &
1834 run_cmd nettest ${varg} -s -d ${NSA_DEV} &
1836 run_cmd_nsb nettest ${varg} -r ${a} &
1845 # client test
1848 run_cmd_nsb nettest ${varg} -s &
1850 run_cmd nettest ${varg} -d ${VRF} -r ${NSB_IP} &
1859 run_cmd_nsb nettest ${varg} -s &
1861 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${NSB_IP} &
1875 run_cmd nettest ${varg} -s &
1877 run_cmd nettest ${varg} -d ${VRF} -r ${a} &
1889 run_cmd nettest ${varg} -d ${VRF} -s &
1891 run_cmd nettest ${varg} -d ${VRF} -r ${a} &
1902 run_cmd nettest ${varg} -s &
1904 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} &
1913 run_cmd nettest ${varg} -d ${VRF} -s &
1915 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} &
1924 run_cmd nettest ${varg} -d ${NSA_DEV} -s &
1926 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} &
1941 run_cmd_nsb ping -f ${a} &
1945 log_test_addr ${a} 0 0 "Device delete with active traffic - ping in"
1952 run_cmd ping -f -I ${VRF} ${a} &
1956 log_test_addr ${a} 0 0 "Device delete with active traffic - ping out"
1961 log_section "Run time tests - ipv4"
1967 ipv4_rt "TCP active socket" "-n -1"
1970 ipv4_rt "TCP passive socket" "-i"
1989 run_cmd ${ping6} -c1 -w1 ${a}
1996 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2000 run_cmd ${ping6} -c1 -w1 -I ${NSA_LO_IP6} ${a}
2001 log_test_addr ${a} $? 0 "ping out, loopback address bind"
2010 run_cmd_nsb ${ping6} -c1 -w1 ${a}
2020 run_cmd ${ping6} -c1 -w1 ${a}
2021 log_test_addr ${a} $? 0 "ping local, no bind"
2027 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2034 show_hint "Fails since address on loopback is out of device scope"
2035 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2043 setup_cmd ip -6 rule add pref 32765 from all lookup local
2044 setup_cmd ip -6 rule del pref 0 from all lookup local
2045 setup_cmd ip -6 rule add pref 50 to ${NSB_LO_IP6} prohibit
2046 setup_cmd ip -6 rule add pref 51 from ${NSB_IP6} prohibit
2049 run_cmd ${ping6} -c1 -w1 ${a}
2053 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2059 run_cmd_nsb ${ping6} -c1 -w1 ${a}
2062 setup_cmd ip -6 rule add pref 0 from all lookup local
2063 setup_cmd ip -6 rule del pref 32765 from all lookup local
2064 setup_cmd ip -6 rule del pref 50 to ${NSB_LO_IP6} prohibit
2065 setup_cmd ip -6 rule del pref 51 from ${NSB_IP6} prohibit
2071 setup_cmd ip -6 route del ${NSB_LO_IP6}
2072 setup_cmd ip -6 route add unreachable ${NSB_LO_IP6} metric 10
2073 setup_cmd ip -6 route add unreachable ${NSB_IP6} metric 10
2076 run_cmd ${ping6} -c1 -w1 ${a}
2080 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2086 run_cmd_nsb ${ping6} -c1 -w1 ${a}
2094 setup_cmd ip -6 ro del unreachable ${NSB_LO_IP6}
2095 setup_cmd ip -6 ro del unreachable ${NSB_IP6}
2098 run_cmd ${ping6} -c1 -w1 ${a}
2102 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2119 run_cmd ${ping6} -c1 -w1 -I ${VRF} ${a}
2127 run_cmd ${ping6} -c1 -w1 ${a}
2134 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2141 run_cmd ip vrf exec ${VRF} ${ping6} -c1 -w1 -I ${VRF_IP6} ${a}
2151 run_cmd_nsb ${ping6} -c1 -w1 ${a}
2157 show_hint "Fails since loopback address is out of VRF scope"
2158 run_cmd_nsb ${ping6} -c1 -w1 ${a}
2168 run_cmd ${ping6} -c1 -w1 -I ${VRF} ${a}
2175 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2179 # LLA to GUA - remove ipv6 global addresses from ns-B
2180 setup_cmd_nsb ip -6 addr del ${NSB_IP6}/64 dev ${NSB_DEV}
2181 setup_cmd_nsb ip -6 addr del ${NSB_LO_IP6}/128 dev lo
2182 setup_cmd_nsb ip -6 ro add ${NSA_IP6}/128 via ${NSA_LINKIP6} dev ${NSB_DEV}
2187 run_cmd_nsb ${ping6} -c1 -w1 ${NSA_IP6}
2191 setup_cmd_nsb ip -6 ro del ${NSA_IP6}/128 via ${NSA_LINKIP6} dev ${NSB_DEV}
2192 setup_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV}
2193 setup_cmd_nsb ip -6 addr add ${NSB_LO_IP6}/128 dev lo
2199 setup_cmd ip -6 rule add pref 50 to ${NSB_LO_IP6} prohibit
2200 setup_cmd ip -6 rule add pref 51 from ${NSB_IP6} prohibit
2203 run_cmd ${ping6} -c1 -w1 ${a}
2207 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2213 run_cmd_nsb ${ping6} -c1 -w1 ${a}
2217 setup_cmd ip -6 rule del pref 50 to ${NSB_LO_IP6} prohibit
2218 setup_cmd ip -6 rule del pref 51 from ${NSB_IP6} prohibit
2224 setup_cmd ip -6 ro del ${NSB_LO_IP6} vrf ${VRF}
2227 run_cmd ${ping6} -c1 -w1 ${a}
2231 run_cmd ${ping6} -c1 -w1 -I ${NSA_DEV} ${a}
2234 ip -netns ${NSB} -6 ro del ${NSA_LO_IP6}
2237 run_cmd_nsb ${ping6} -c1 -w1 ${a}
2245 log_subsection "No VRF"
2268 run_cmd nettest -6 -s -M ${MD5_PW} -r ${NSB_IP6} &
2270 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2276 run_cmd nettest -6 -s &
2278 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2279 log_test $? 2 "MD5: Server no config, client uses password"
2284 run_cmd nettest -6 -s -M ${MD5_PW} -r ${NSB_IP6} &
2286 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2292 run_cmd nettest -6 -s -M ${MD5_PW} -r ${NSB_LO_IP6} &
2294 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2298 # MD5 extension - prefix length
2303 run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} &
2305 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2311 run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} &
2313 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2319 run_cmd nettest -6 -s -M ${MD5_PW} -m ${NS_NET6} &
2321 run_cmd_nsb nettest -6 -l ${NSB_LO_IP6} -r ${NSA_IP6} -M ${MD5_PW}
2336 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP6} &
2338 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2344 run_cmd nettest -6 -s -d ${VRF} &
2346 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2347 log_test $? 2 "MD5: VRF: Server no config, client uses password"
2352 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP6} &
2354 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2360 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -r ${NSB_LO_IP6} &
2362 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2366 # MD5 extension - prefix length
2371 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET6} &
2373 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2379 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET6} &
2381 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2387 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET6} &
2389 run_cmd_nsb nettest -6 -l ${NSB_LO_IP6} -r ${NSA_IP6} -M ${MD5_PW}
2397 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP6} &
2398 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -r ${NSB_IP6} &
2400 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2404 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP6} &
2405 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -r ${NSB_IP6} &
2407 run_cmd_nsc nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2412 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP6} &
2413 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -r ${NSB_IP6} &
2415 run_cmd_nsc nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2420 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -r ${NSB_IP6} &
2421 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -r ${NSB_IP6} &
2423 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2427 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET6} &
2428 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} &
2430 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2434 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET6} &
2435 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} &
2437 run_cmd_nsc nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2442 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET6} &
2443 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} &
2445 run_cmd_nsc nettest -6 -r ${NSA_IP6} -M ${MD5_PW}
2450 run_cmd nettest -6 -s -d ${VRF} -M ${MD5_PW} -m ${NS_NET6} &
2451 run_cmd nettest -6 -s -M ${MD5_WRONG_PW} -m ${NS_NET6} &
2453 run_cmd_nsb nettest -6 -r ${NSA_IP6} -M ${MD5_WRONG_PW}
2460 run_cmd nettest -6 -s -d ${NSA_DEV} -M ${MD5_PW} -r ${NSB_IP6}
2461 log_test $? 1 "MD5: VRF: Device must be a VRF - single address"
2464 run_cmd nettest -6 -s -d ${NSA_DEV} -M ${MD5_PW} -m ${NS_NET6}
2465 log_test $? 1 "MD5: VRF: Device must be a VRF - prefix"
2479 run_cmd nettest -6 -s &
2481 run_cmd_nsb nettest -6 -r ${a}
2490 run_cmd_nsb nettest -6 -r ${a}
2491 log_test_addr ${a} $? 1 "No server"
2500 run_cmd_nsb nettest -6 -s &
2502 run_cmd nettest -6 -r ${a}
2509 run_cmd_nsb nettest -6 -s &
2511 run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
2519 run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
2520 log_test_addr ${a} $? 1 "No server, device client"
2529 run_cmd nettest -6 -s &
2531 run_cmd nettest -6 -r ${a}
2537 run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
2539 run_cmd nettest -6 -r ${a} -0 ${a}
2545 show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope"
2546 run_cmd nettest -6 -s -d ${NSA_DEV} &
2548 run_cmd nettest -6 -r ${a}
2554 run_cmd nettest -6 -s &
2556 run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a}
2562 show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope"
2563 run_cmd nettest -6 -s &
2565 run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
2572 run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
2574 run_cmd nettest -6 -d ${NSA_DEV} -r ${a}
2582 run_cmd nettest -6 -d ${NSA_DEV} -r ${a}
2583 log_test_addr ${a} $? 1 "No server, device client, local conn"
2605 run_cmd nettest -6 -s &
2607 run_cmd_nsb nettest -6 -r ${a}
2614 run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
2616 run_cmd_nsb nettest -6 -r ${a}
2623 run_cmd nettest -6 -s -d ${VRF} -2 ${NSA_DEV} &
2625 run_cmd_nsb nettest -6 -r ${a}
2631 run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
2633 run_cmd_nsb nettest -6 -r ${a}
2642 run_cmd_nsb nettest -6 -r ${a}
2643 log_test_addr ${a} $? 1 "No server"
2650 run_cmd nettest -6 -s &
2652 run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
2667 run_cmd nettest -6 -s -2 ${VRF} &
2669 run_cmd_nsb nettest -6 -r ${a}
2676 run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
2678 run_cmd_nsb nettest -6 -r ${a}
2685 run_cmd nettest -6 -s -2 ${NSA_DEV} &
2687 run_cmd_nsb nettest -6 -r ${a}
2691 run_cmd nettest -6 -s -d ${VRF} -2 ${NSA_DEV} &
2693 run_cmd_nsb nettest -6 -r ${a}
2699 run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
2701 run_cmd_nsb nettest -6 -r ${a}
2710 run_cmd_nsb nettest -6 -r ${a}
2711 log_test_addr ${a} $? 1 "No server"
2719 run_cmd nettest -6 -s -d ${VRF} &
2721 run_cmd nettest -6 -r ${a}
2732 run_cmd_nsb nettest -6 -s &
2734 run_cmd nettest -6 -r ${a} -d ${VRF}
2741 run_cmd_nsb nettest -6 -s &
2743 run_cmd nettest -6 -r ${a} -d ${VRF}
2749 run_cmd_nsb nettest -6 -s &
2751 run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
2759 run_cmd nettest -6 -r ${a} -d ${VRF}
2760 log_test_addr ${a} $? 1 "No server, VRF client"
2767 run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
2768 log_test_addr ${a} $? 1 "No server, device client"
2774 run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
2776 run_cmd nettest -6 -r ${a} -d ${VRF} -0 ${a}
2782 run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
2784 run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a}
2790 run_cmd nettest -6 -s -d ${VRF} &
2792 run_cmd nettest -6 -r ${a}
2796 run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
2798 run_cmd nettest -6 -r ${a} -d ${VRF} -0 ${a}
2804 run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
2806 run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a}
2814 log_subsection "No VRF"
2817 # tcp_l3mdev_accept should have no affect without VRF;
2844 run_cmd nettest -6 -D -s -2 ${NSA_DEV} &
2846 run_cmd_nsb nettest -6 -D -r ${a}
2850 run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
2852 run_cmd_nsb nettest -6 -D -r ${a}
2858 run_cmd nettest -6 -D -s -2 ${NSA_DEV} &
2860 run_cmd_nsb nettest -6 -D -r ${a}
2863 # should fail since loopback address is out of scope for a device
2864 # bound server, but it does not - hence this is more documenting
2867 #show_hint "Should fail since loopback address is out of scope"
2868 #run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
2870 #run_cmd_nsb nettest -6 -D -r ${a}
2873 # negative test - should fail
2877 show_hint "Should fail 'Connection refused' since there is no server"
2878 run_cmd_nsb nettest -6 -D -r ${a}
2879 log_test_addr ${a} $? 1 "No server"
2888 run_cmd_nsb nettest -6 -D -s &
2890 run_cmd nettest -6 -D -r ${a} -0 ${NSA_IP6}
2894 run_cmd_nsb nettest -6 -D -s &
2896 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -0 ${NSA_IP6}
2900 run_cmd_nsb nettest -6 -D -s &
2902 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -C -0 ${NSA_IP6}
2906 run_cmd_nsb nettest -6 -D -s &
2908 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP6}
2913 run_cmd nettest -6 -D -r ${a}
2914 log_test_addr ${a} $? 1 "No server, unbound client"
2918 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV}
2919 log_test_addr ${a} $? 1 "No server, device client"
2928 run_cmd nettest -6 -D -s &
2930 run_cmd nettest -6 -D -r ${a} -0 ${a} -1 ${a}
2936 run_cmd nettest -6 -s -D -d ${NSA_DEV} -2 ${NSA_DEV} &
2938 run_cmd nettest -6 -D -r ${a}
2945 run_cmd nettest -6 -s -D -d ${NSA_DEV} &
2947 run_cmd nettest -6 -D -r ${a}
2953 run_cmd nettest -6 -s -D &
2955 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
2959 run_cmd nettest -6 -s -D &
2961 run_cmd nettest -6 -D -d ${NSA_DEV} -C -r ${a}
2965 run_cmd nettest -6 -s -D &
2967 run_cmd nettest -6 -D -d ${NSA_DEV} -S -r ${a}
2973 show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope"
2974 run_cmd nettest -6 -D -s &
2976 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV}
2980 show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope"
2981 run_cmd nettest -6 -D -s &
2983 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -C
2987 show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope"
2988 run_cmd nettest -6 -D -s &
2990 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S
2996 run_cmd nettest -6 -D -s -d ${NSA_DEV} -2 ${NSA_DEV} &
2998 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a} -0 ${a}
3003 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3004 log_test_addr ${a} $? 1 "No server, device client, local conn"
3007 run_cmd_nsb ip -6 addr del ${NSB_IP6}/64 dev ${NSB_DEV}
3008 run_cmd_nsb ip -6 ro add ${NSA_IP6}/128 dev ${NSB_DEV}
3010 run_cmd nettest -6 -s -D &
3012 run_cmd_nsb nettest -6 -D -r ${NSA_IP6}
3013 log_test $? 0 "UDP in - LLA to GUA"
3015 run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV}
3016 run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} nodad
3034 run_cmd nettest -6 -D -s &
3036 run_cmd_nsb nettest -6 -D -r ${a}
3043 run_cmd nettest -6 -D -d ${VRF} -s -2 ${NSA_DEV} &
3045 run_cmd_nsb nettest -6 -D -r ${a}
3052 run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
3054 run_cmd_nsb nettest -6 -D -r ${a}
3058 # negative test - should fail
3062 show_hint "Should fail 'Connection refused' since there is no server"
3063 run_cmd_nsb nettest -6 -D -r ${a}
3064 log_test_addr ${a} $? 1 "No server"
3074 run_cmd nettest -6 -D -s &
3076 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3083 run_cmd nettest -6 -D -d ${VRF} -s &
3085 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3092 run_cmd nettest -6 -D -s &
3094 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3098 run_cmd nettest -6 -D -d ${VRF} -s -2 ${NSA_DEV} &
3100 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3104 run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
3106 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3110 run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
3112 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3125 run_cmd nettest -6 -D -s -2 ${NSA_DEV} &
3127 run_cmd_nsb nettest -6 -D -r ${a}
3134 run_cmd nettest -6 -D -d ${VRF} -s -2 ${NSA_DEV} &
3136 run_cmd_nsb nettest -6 -D -r ${a}
3143 run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
3145 run_cmd_nsb nettest -6 -D -r ${a}
3149 # negative test - should fail
3153 run_cmd_nsb nettest -6 -D -r ${a}
3154 log_test_addr ${a} $? 1 "No server"
3161 run_cmd_nsb nettest -6 -D -s &
3163 run_cmd nettest -6 -D -d ${VRF} -r ${NSB_IP6}
3166 # negative test - should fail
3168 run_cmd nettest -6 -D -d ${VRF} -r ${NSB_IP6}
3169 log_test $? 1 "No server, VRF client"
3172 run_cmd_nsb nettest -6 -D -s &
3174 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSB_IP6}
3177 # negative test - should fail
3179 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSB_IP6}
3180 log_test $? 1 "No server, enslaved device client"
3187 run_cmd nettest -6 -D -s -2 ${NSA_DEV} &
3189 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3193 run_cmd nettest -6 -D -d ${VRF} -s -2 ${NSA_DEV} &
3195 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3201 run_cmd nettest -6 -D -s -2 ${VRF} &
3203 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3207 run_cmd nettest -6 -D -d ${VRF} -s -2 ${VRF} &
3209 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3212 # negative test - should fail
3216 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3217 log_test_addr ${a} $? 1 "No server, VRF client, local conn"
3223 run_cmd nettest -6 -D -s -2 ${NSA_DEV} &
3225 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3229 run_cmd nettest -6 -D -d ${VRF} -s -2 ${NSA_DEV} &
3231 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3235 run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
3237 run_cmd nettest -6 -D -d ${VRF} -r ${a}
3241 run_cmd nettest -6 -D -d ${NSA_DEV} -s -2 ${NSA_DEV} &
3243 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3247 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${a}
3248 log_test_addr ${a} $? 1 "No server, device client, local conn"
3253 run_cmd nettest -6 -D -s &
3255 run_cmd_nsb nettest -6 -D -d ${NSB_DEV} -r ${NSA_LINKIP6}
3259 run_cmd_nsb nettest -6 -D -d ${NSB_DEV} -r ${NSA_LINKIP6}
3260 log_test $? 1 "No server, linklocal IP"
3264 run_cmd_nsb nettest -6 -D -s &
3266 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSB_LINKIP6}
3270 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSB_LINKIP6}
3271 log_test $? 1 "No server, device client, peer linklocal IP"
3275 run_cmd nettest -6 -D -s &
3277 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSA_LINKIP6}
3278 log_test $? 0 "Enslaved device client, local conn - linklocal IP"
3281 run_cmd nettest -6 -D -d ${NSA_DEV} -r ${NSA_LINKIP6}
3282 log_test $? 1 "No server, device client, local conn - linklocal IP"
3285 run_cmd_nsb ip -6 addr del ${NSB_IP6}/64 dev ${NSB_DEV}
3286 run_cmd_nsb ip -6 ro add ${NSA_IP6}/128 dev ${NSB_DEV}
3288 run_cmd nettest -6 -s -D &
3290 run_cmd_nsb nettest -6 -D -r ${NSA_IP6}
3291 log_test $? 0 "UDP in - LLA to GUA"
3293 run_cmd_nsb ip -6 ro del ${NSA_IP6}/128 dev ${NSB_DEV}
3294 run_cmd_nsb ip -6 addr add ${NSB_IP6}/64 dev ${NSB_DEV} nodad
3303 log_subsection "No VRF"
3306 # udp_l3mdev_accept should have no affect without VRF;
3331 run_cmd nettest -6 -s -R -P ipv6-icmp -l ${a} -b
3335 run_cmd nettest -6 -s -R -P ipv6-icmp -l ${a} -d ${NSA_DEV} -b
3344 run_cmd nettest -6 -s -l ${a} -t1 -b
3348 run_cmd nettest -6 -s -l ${a} -d ${NSA_DEV} -t1 -b
3354 run_cmd nettest -6 -s -l ${a} -d ${NSA_DEV} -t1 -b
3366 run_cmd nettest -6 -s -R -P ipv6-icmp -l ${a} -d ${VRF} -b
3370 run_cmd nettest -6 -s -R -P ipv6-icmp -l ${a} -d ${NSA_DEV} -b
3376 show_hint "Address on loopback is out of VRF scope"
3377 run_cmd nettest -6 -s -R -P ipv6-icmp -l ${a} -d ${VRF} -b
3387 run_cmd nettest -6 -s -l ${a} -d ${VRF} -t1 -b
3393 run_cmd nettest -6 -s -l ${a} -d ${NSA_DEV} -t1 -b
3398 run_cmd nettest -6 -s -l ${a} -d ${NSA_DEV} -t1 -b
3403 show_hint "Address on loopback out of scope for VRF"
3404 run_cmd nettest -6 -s -l ${a} -d ${VRF} -t1 -b
3408 show_hint "Address on loopback out of scope for device in VRF"
3409 run_cmd nettest -6 -s -l ${a} -d ${NSA_DEV} -t1 -b
3418 log_subsection "No VRF"
3433 local varg="-6 $2"
3443 run_cmd nettest ${varg} -s &
3445 run_cmd_nsb nettest ${varg} -r ${a} &
3457 run_cmd nettest ${varg} -d ${VRF} -s &
3459 run_cmd_nsb nettest ${varg} -r ${a} &
3471 run_cmd nettest ${varg} -d ${NSA_DEV} -s &
3473 run_cmd_nsb nettest ${varg} -r ${a} &
3483 # client test
3486 run_cmd_nsb nettest ${varg} -s &
3488 run_cmd nettest ${varg} -d ${VRF} -r ${NSB_IP6} &
3497 run_cmd_nsb nettest ${varg} -s &
3499 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${NSB_IP6} &
3514 run_cmd nettest ${varg} -s &
3516 run_cmd nettest ${varg} -d ${VRF} -r ${a} &
3528 run_cmd nettest ${varg} -d ${VRF} -s &
3530 run_cmd nettest ${varg} -d ${VRF} -r ${a} &
3541 run_cmd nettest ${varg} -s &
3543 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} &
3552 run_cmd nettest ${varg} -d ${VRF} -s &
3554 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} &
3563 run_cmd nettest ${varg} -d ${NSA_DEV} -s &
3565 run_cmd nettest ${varg} -d ${NSA_DEV} -r ${a} &
3579 run_cmd_nsb ${ping6} -f ${a} &
3583 log_test_addr ${a} 0 0 "Device delete with active traffic - ping in"
3588 run_cmd ${ping6} -f ${NSB_IP6} -I ${VRF} &
3592 log_test_addr ${a} 0 0 "Device delete with active traffic - ping out"
3597 log_section "Run time tests - ipv6"
3603 ipv6_rt "TCP active socket" "-n -1"
3606 ipv6_rt "TCP passive socket" "-i"
3609 ipv6_rt "UDP active socket" "-D -n -1"
3622 run_cmd nettest -s &
3624 run_cmd_nsb nettest -r ${a}
3625 log_test_addr ${a} $? 1 "Global server, reject with TCP-reset on Rx"
3635 [ "${stype}" = "UDP" ] && arg="-D"
3640 run_cmd nettest ${arg} -s &
3642 run_cmd_nsb nettest ${arg} -r ${a}
3643 log_test_addr ${a} $? 1 "Global ${stype} server, Rx reject icmp-port-unreach"
3653 run_cmd iptables -A INPUT -p tcp --dport 12345 -j REJECT --reject-with tcp-reset
3661 run_cmd iptables -F
3662 run_cmd iptables -A INPUT -p tcp --dport 12345 -j REJECT --reject-with icmp-port-unreachable
3663 run_cmd iptables -A INPUT -p udp --dport 12345 -j REJECT --reject-with icmp-port-unreachable
3669 iptables -F
3679 run_cmd nettest -6 -s &
3681 run_cmd_nsb nettest -6 -r ${a}
3682 log_test_addr ${a} $? 1 "Global server, reject with TCP-reset on Rx"
3692 [ "${stype}" = "UDP" ] && arg="$arg -D"
3697 run_cmd nettest -6 -s ${arg} &
3699 run_cmd_nsb nettest -6 ${arg} -r ${a}
3700 log_test_addr ${a} $? 1 "Global ${stype} server, Rx reject icmp-port-unreach"
3710 run_cmd ip6tables -A INPUT -p tcp --dport 12345 -j REJECT --reject-with tcp-reset
3717 run_cmd ip6tables -F
3718 run_cmd ip6tables -A INPUT -p tcp --dport 12345 -j REJECT --reject-with icmp6-port-unreachable
3719 run_cmd ip6tables -A INPUT -p udp --dport 12345 -j REJECT --reject-with icmp6-port-unreachable
3725 ip6tables -F
3732 # ns-A device enslaved to bridge. Verify traffic with and without
3740 setup_cmd ip -6 addr del dev ${NSA_DEV} ${NSA_IP6}/64
3744 setup_cmd ip -6 addr add dev br0 ${NSA_IP6}/64 nodad
3755 run_cmd ping -c1 -w1 -I br0 ${NSB_IP}
3756 log_test $? 0 "Bridge into VRF - IPv4 ping out"
3759 run_cmd ${ping6} -c1 -w1 -I br0 ${NSB_IP6}
3760 log_test $? 0 "Bridge into VRF - IPv6 ping out"
3763 run_cmd_nsb ping -c1 -w1 ${NSA_IP}
3764 log_test $? 0 "Bridge into VRF - IPv4 ping in"
3767 run_cmd_nsb ${ping6} -c1 -w1 ${NSA_IP6}
3768 log_test $? 0 "Bridge into VRF - IPv6 ping in"
3771 if [ $? -eq 0 ]; then
3773 run_cmd ping -c1 -w1 -I br0 ${NSB_IP}
3774 log_test $? 0 "Bridge into VRF with br_netfilter - IPv4 ping out"
3777 run_cmd ${ping6} -c1 -w1 -I br0 ${NSB_IP6}
3778 log_test $? 0 "Bridge into VRF with br_netfilter - IPv6 ping out"
3781 run_cmd_nsb ping -c1 -w1 ${NSA_IP}
3782 log_test $? 0 "Bridge into VRF with br_netfilter - IPv4 ping in"
3785 run_cmd_nsb ${ping6} -c1 -w1 ${NSA_IP6}
3786 log_test $? 0 "Bridge into VRF with br_netfilter - IPv6 ping in"
3793 setup_cmd ip -6 addr add dev br0.100 2001:db8:101::1/64 nodad
3797 setup_cmd_nsb ip -6 addr add dev vlan100 2001:db8:101::2/64 nodad
3804 run_cmd ping -c1 -w1 -I br0.100 172.16.101.2
3805 log_test $? 0 "Bridge vlan into VRF - IPv4 ping out"
3808 run_cmd ${ping6} -c1 -w1 -I br0.100 2001:db8:101::2
3809 log_test $? 0 "Bridge vlan into VRF - IPv6 ping out"
3812 run_cmd_nsb ping -c1 -w1 172.16.101.1
3813 log_test $? 0 "Bridge vlan into VRF - IPv4 ping in"
3816 run_cmd_nsb ${ping6} -c1 -w1 2001:db8:101::1
3817 log_test $? 0 "Bridge vlan into VRF - IPv6 ping in"
3820 if [ $? -eq 0 ]; then
3822 run_cmd ping -c1 -w1 -I br0.100 172.16.101.2
3823 log_test $? 0 "Bridge vlan into VRF with br_netfilter - IPv4 ping out"
3826 run_cmd ${ping6} -c1 -w1 -I br0.100 2001:db8:101::2
3827 log_test $? 0 "Bridge vlan into VRF with br_netfilter - IPv6 ping out"
3830 run_cmd_nsb ping -c1 -w1 172.16.101.1
3831 log_test $? 0 "Bridge vlan into VRF - IPv4 ping in"
3834 run_cmd_nsb ${ping6} -c1 -w1 2001:db8:101::1
3835 log_test $? 0 "Bridge vlan into VRF - IPv6 ping in"
3843 # ns-A device is connected to both ns-B and ns-C on a single VRF but only has
3848 # only want reply from ns-A
3849 setup_cmd_nsb sysctl -qw net.ipv6.icmp.echo_ignore_multicast=1
3850 setup_cmd_nsc sysctl -qw net.ipv6.icmp.echo_ignore_multicast=1
3853 run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV}
3854 log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Pre cycle, ping out ns-B"
3856 run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV}
3857 log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Pre cycle, ping out ns-C"
3859 # cycle/flap the first ns-A interface
3865 run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV}
3866 log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV}, ping out ns-B"
3867 run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV}
3868 log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV}, ping out ns-C"
3870 # cycle/flap the second ns-A interface
3876 run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV}
3877 log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV2}, ping out ns-B"
3878 run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV}
3879 log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV2}, ping out ns-C"
3899 -4 IPv4 tests only
3900 -6 IPv6 tests only
3901 -t <test> Test name/set to run
3902 -p Pause on fail
3903 -P Pause after each test
3904 -v Be verbose
3915 PAUSE_ON_FAIL=no
3916 PAUSE=no
3933 [ "${PAUSE}" = "yes" ] && PAUSE_ON_FAIL=no
3936 # show user test config
3938 if [ -z "$TESTS" ]; then
3947 if [ $? -ne 0 ]; then
3952 declare -i nfail=0
3953 declare -i nsuccess=0
3978 help) echo "Test names: $TESTS"; exit 0;;