Lines Matching +full:single +full:- +full:link
2 # SPDX-License-Identifier: GPL-2.0
8 # Kselftest framework requirement - SKIP code is 4.
11 # all tests in this script. Can be overridden with -t option
17 IP="ip -netns ns1"
28 if [ ${rc} -eq ${expected} ]; then
29 printf " TEST: %-60s [ OK ]\n" "${msg}"
34 printf " TEST: %-60s [FAIL]\n" "${msg}"
53 set -e
56 $IP link set dev lo up
57 ip netns exec ns1 sysctl -qw net.ipv4.ip_forward=1
58 ip netns exec ns1 sysctl -qw net.ipv6.conf.all.forwarding=1
60 $IP link add dummy0 type dummy
61 $IP link set dev dummy0 up
63 $IP -6 address add 2001:db8:1::1/64 dev dummy0
70 $IP link del dev dummy0 &> /dev/null
80 addr=$($IP -6 -br addr show dev ${dev} | \
90 [ -z "$addr" ] && return 1
100 echo "Single path route test"
107 $IP -6 route get fibmatch 2001:db8:1::2 &> /dev/null
110 set -e
111 $IP link del dev dummy0
116 log_test $? 2 "IPv4 fibmatch - no route"
117 $IP -6 route get fibmatch 2001:db8:1::2 &> /dev/null
118 log_test $? 2 "IPv6 fibmatch - no route"
131 set -e
132 $IP link add dummy1 type dummy
133 $IP link set dev dummy1 up
135 $IP -6 address add 2001:db8:2::1/64 dev dummy1
140 $IP -6 route add 2001:db8:3::/64 \
148 $IP -6 route get fibmatch 2001:db8:3::1 &> /dev/null
151 set -e
152 $IP link del dev dummy0
157 log_test $? 2 "IPv4 - multipath route removed on delete"
159 $IP -6 route get fibmatch 2001:db8:3::1 &> /dev/null
161 log_test $? 0 "IPv6 - multipath down to single path"
163 set -e
164 $IP link del dev dummy1
168 $IP -6 route get fibmatch 2001:db8:3::1 &> /dev/null
169 log_test $? 2 "IPv6 - no route"
183 echo "Single path, admin down"
190 $IP -6 route get fibmatch 2001:db8:1::2 &> /dev/null
193 set -e
194 $IP link set dev dummy0 down
200 $IP -6 route get fibmatch 2001:db8:1::2 &> /dev/null
214 $IP -6 route get fibmatch 2001:db8:3::1 \
221 $IP -6 route get fibmatch 2001:db8:3::1 \
226 grep $down_dev | grep -q "dead linkdown"
228 $IP -6 route get fibmatch 2001:db8:3::1 | \
229 grep $down_dev | grep -q "dead linkdown"
233 grep $up_dev | grep -q "dead linkdown"
235 $IP -6 route get fibmatch 2001:db8:3::1 | \
236 grep $up_dev | grep -q "dead linkdown"
247 set -e
248 $IP link add dummy1 type dummy
249 $IP link set dev dummy1 up
252 $IP -6 address add 2001:db8:2::1/64 dev dummy1
257 $IP -6 route add 2001:db8:3::/64 \
266 $IP -6 route get fibmatch 2001:db8:3::1 &> /dev/null
269 set -e
270 $IP link set dev dummy0 down
276 set -e
277 $IP link set dev dummy0 up
278 $IP link set dev dummy1 down
284 set -e
285 $IP link set dev dummy0 down
291 $IP -6 route get fibmatch 2001:db8:3::1 &> /dev/null
294 $IP link del dev dummy1
308 echo "Local carrier tests - single path"
312 set -e
313 $IP link set dev dummy0 carrier on
319 $IP -6 route get fibmatch 2001:db8:1::1 &> /dev/null
323 grep -q "linkdown"
324 log_test $? 1 "IPv4 - no linkdown flag"
325 $IP -6 route get fibmatch 2001:db8:1::1 | \
326 grep -q "linkdown"
327 log_test $? 1 "IPv6 - no linkdown flag"
329 set -e
330 $IP link set dev dummy0 carrier off
337 $IP -6 route get fibmatch 2001:db8:1::1 &> /dev/null
341 grep -q "linkdown"
342 log_test $? 1 "IPv4 - linkdown flag set"
343 $IP -6 route get fibmatch 2001:db8:1::1 | \
344 grep -q "linkdown"
345 log_test $? 1 "IPv6 - linkdown flag set"
347 set -e
349 $IP -6 address add 2001:db8:2::1/64 dev dummy0
355 $IP -6 route get fibmatch 2001:db8:2::1 &> /dev/null
359 grep -q "linkdown"
361 $IP -6 route get fibmatch 2001:db8:2::1 | \
362 grep -q "linkdown"
373 echo "Single path route carrier test"
377 set -e
378 $IP link set dev dummy0 carrier on
384 $IP -6 route get fibmatch 2001:db8:1::2 &> /dev/null
388 grep -q "linkdown"
390 $IP -6 route get fibmatch 2001:db8:1::2 | \
391 grep -q "linkdown"
394 set -e
395 $IP link set dev dummy0 carrier off
402 $IP -6 route get fibmatch 2001:db8:1::2 &> /dev/null
406 grep -q "linkdown"
408 $IP -6 route get fibmatch 2001:db8:1::2 | \
409 grep -q "linkdown"
412 set -e
414 $IP -6 address add 2001:db8:2::1/64 dev dummy0
420 $IP -6 route get fibmatch 2001:db8:2::2 &> /dev/null
424 grep -q "linkdown"
426 $IP -6 route get fibmatch 2001:db8:2::2 | \
427 grep -q "linkdown"
446 set -e
450 ip -netns ns2 link set dev lo up
452 $IP link add name veth1 type veth peer name veth2
453 $IP link set dev veth2 netns ns2
455 ip -netns ns2 address add 192.0.2.1/24 dev veth2
456 $IP link set dev veth1 up
457 ip -netns ns2 link set dev veth2 up
459 $IP link set dev lo address 52:54:00:6a:c7:5e
460 $IP link set dev veth1 address 52:54:00:6a:c7:5e
461 ip -netns ns2 link set dev lo address 52:54:00:6a:c7:5e
462 ip -netns ns2 link set dev veth2 address 52:54:00:6a:c7:5e
492 $NS_EXEC sysctl -qw net.ipv4.conf.all.rp_filter=1
493 $NS_EXEC sysctl -qw net.ipv4.conf.all.accept_local=1
494 $NS_EXEC sysctl -qw net.ipv4.conf.all.route_localnet=1
495 ip netns exec ns2 sysctl -qw net.ipv4.conf.all.rp_filter=1
496 ip netns exec ns2 sysctl -qw net.ipv4.conf.all.accept_local=1
497 ip netns exec ns2 sysctl -qw net.ipv4.conf.all.route_localnet=1
500 run_cmd "ip netns exec ns2 ping -w1 -c1 192.0.2.1"
503 run_cmd "ip netns exec ns2 ping -w1 -c1 127.0.0.1"
523 [ "$vrf" = "-" ] && vrf="default"
524 [ -n "$gw" ] && gw="via $gw"
525 [ -n "$dev" ] && dev="dev $dev"
534 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
553 if [ -z "$lldummy" ]; then
557 if [ -z "$llv1" ]; then
566 - 2001:db8:101::/64 2001:db8:1::2
568 - 2001:db8:102::/64 2001:db8:1::2 "dummy0"
570 - 2001:db8:103::1/64 $llv1 "veth0"
574 - 2001:db8:104::1/64 $llv1
578 - 2001:db8:105::/64 2001:db8:1::1
580 - 2001:db8:106::/64 2001:db8:1::1 "dummy0"
582 - 2001:db8:107::1/64 $lldummy "dummy0"
586 - 2001:db8:108::/64 2001:db8:51::2
588 - 2001:db8:109::/64 2001:db8:51::2 "veth0"
590 - 2001:db8:110::1/64 $llv1 "veth0"
593 - 2001:db8:111::/64 "" "red"
606 # dummy0 - 198.51.100.1/24 2001:db8:1::1/64
607 # veth0 - 192.0.2.1/24 2001:db8:51::1/64
610 # dummy1 - 192.168.2.1/24 2001:db8:2::1/64
611 # veth1 - 192.0.2.2/24 2001:db8:51::2/64
613 # [ dummy0 veth0 ]--[ veth1 dummy1 ]
619 set -e
621 $IP -4 rule add pref 32765 table local
622 $IP -4 rule del pref 0
623 $IP -6 rule add pref 32765 table local
624 $IP -6 rule del pref 0
626 $IP link add red type vrf table 1
627 $IP link set red up
628 $IP -4 route add vrf red unreachable default metric 4278198272
629 $IP -6 route add vrf red unreachable default metric 4278198272
631 $IP link add veth0 type veth peer name veth1
632 $IP link set dev veth0 up
634 $IP -6 address add 2001:db8:51::1/64 dev veth0
636 $IP link set dev veth1 vrf red up
638 $IP -6 address add 2001:db8:51::2/64 dev veth1
640 $IP link add dummy1 type dummy
641 $IP link set dev dummy1 vrf red up
643 $IP -6 address add 2001:db8:2::1/64 dev dummy1
651 $IP link del dev dummy1
652 $IP link del veth0
653 $IP link del red
664 $IP link add dummy1 type dummy
665 $IP link set dummy1 up
666 $IP -6 route add default dev dummy1
667 $IP -6 rule add table main suppress_prefixlength 0
668 ping -f -c 1000 -W 1 1234::1 >/dev/null 2>&1
669 $IP -6 rule del table main suppress_prefixlength 0
670 $IP link del dummy1
694 if [ "$VERBOSE" = "1" -a -n "$out" ]; then
711 if [ -z "${out}" ]; then
720 # tricky way to convert output to 1-line without ip's
750 run_cmd "$IP -6 ro flush ${pfx}"
751 [ $? -ne 0 ] && exit 1
753 out=$($IP -6 ro ls match ${pfx})
754 if [ -n "$out" ]; then
759 run_cmd "$IP -6 ro add ${pfx} ${nh}"
760 if [ $? -ne 0 ]; then
766 # add initial route - used in replace route tests
779 set -- $expected
782 out=$($IP -6 ro ls match ${pfx} | sed -e 's/ pref medium//')
801 [ "${VERBOSE}" = "1" ] && set -x
802 set -e
806 ip -netns ns2 link set dev lo up
807 ip netns exec ns2 sysctl -qw net.ipv4.ip_forward=1
808 ip netns exec ns2 sysctl -qw net.ipv6.conf.all.forwarding=1
817 ip -netns ns2 li add dummy1 type dummy
818 ip -netns ns2 li set dummy1 up
820 $IP -6 addr add 2001:db8:101::1/64 dev veth1 nodad
821 $IP -6 addr add 2001:db8:103::1/64 dev veth3 nodad
825 ip -netns ns2 -6 addr add 2001:db8:101::2/64 dev veth2 nodad
826 ip -netns ns2 -6 addr add 2001:db8:103::2/64 dev veth4 nodad
827 ip -netns ns2 -6 addr add 2001:db8:104::1/64 dev dummy1 nodad
829 ip -netns ns2 addr add 172.16.101.2/24 dev veth2
830 ip -netns ns2 addr add 172.16.103.2/24 dev veth4
831 ip -netns ns2 addr add 172.16.104.1/24 dev dummy1
836 # assumption is that basic add of a single path route works
845 # route add same prefix - fails with EEXISTS b/c ip adds NLM_F_EXCL
847 run_cmd "$IP -6 ro add 2001:db8:104::/64 via 2001:db8:103::2"
848 log_test $? 2 "Attempt to add duplicate route - gw"
850 # route add same prefix - fails with EEXISTS b/c ip adds NLM_F_EXCL
852 run_cmd "$IP -6 ro add 2001:db8:104::/64 dev veth3"
853 log_test $? 2 "Attempt to add duplicate route - dev only"
855 # route add same prefix - fails with EEXISTS b/c ip adds NLM_F_EXCL
857 run_cmd "$IP -6 ro add unreachable 2001:db8:104::/64"
858 log_test $? 2 "Attempt to add duplicate route - reject route"
861 # - iproute2 sets NLM_F_CREATE | NLM_F_APPEND
863 run_cmd "$IP -6 ro append 2001:db8:104::/64 via 2001:db8:103::2"
865 log_test $? 0 "Append nexthop to existing route - gw"
873 run_cmd "$IP -6 ro add 2001:db8:104::/64 nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2"
878 run_cmd "$IP -6 ro add 2001:db8:104::/64 via 2001:db8:103::2 metric 512"
880 if [ $rc -eq 0 ]; then
881 run_cmd "$IP -6 ro add 2001:db8:104::/64 via 2001:db8:103::3 metric 256"
886 run_cmd "$IP -6 ro del 2001:db8:104::/64 metric 512"
888 if [ $rc -eq 0 ]; then
897 # single path with single path
900 run_cmd "$IP -6 ro replace 2001:db8:104::/64 via 2001:db8:103::2"
902 log_test $? 0 "Single path with single path"
904 # single path with multipath
907 …run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:101::3 nexthop via 2001:db8:103:…
909 log_test $? 0 "Single path with multipath"
911 # single path with single path using MULTIPATH attribute
914 run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:103::2"
916 log_test $? 0 "Single path with single path via multipath attribute"
918 # route replace fails - invalid nexthop
920 run_cmd "$IP -6 ro replace 2001:db8:104::/64 via 2001:db8:104::2"
921 if [ $? -eq 0 ]; then
930 # replace non-existent route
931 # - note use of change versus replace since ip adds NLM_F_CREATE
934 run_cmd "$IP -6 ro change 2001:db8:105::/64 via 2001:db8:101::2"
935 log_test $? 2 "Single path - replace of non-existent route"
942 …run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:101::3 nexthop via 2001:db8:103:…
946 # multipath with single
948 run_cmd "$IP -6 ro replace 2001:db8:104::/64 via 2001:db8:101::3"
950 log_test $? 0 "Multipath with single path"
952 # multipath with single
954 run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:101::3"
956 log_test $? 0 "Multipath with single path via multipath attribute"
958 # multipath with dev-only
960 run_cmd "$IP -6 ro replace 2001:db8:104::/64 dev veth1"
962 log_test $? 0 "Multipath with dev-only"
964 # route replace fails - invalid nexthop 1
966 …run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:111::3 nexthop via 2001:db8:103:…
968 log_test $? 0 "Multipath - invalid first nexthop"
970 # route replace fails - invalid nexthop 2
972 …run_cmd "$IP -6 ro replace 2001:db8:104::/64 nexthop via 2001:db8:101::3 nexthop via 2001:db8:113:…
974 log_test $? 0 "Multipath - invalid second nexthop"
976 # multipath non-existent route
978 …run_cmd "$IP -6 ro change 2001:db8:105::/64 nexthop via 2001:db8:101::3 nexthop via 2001:db8:103::…
979 log_test $? 2 "Multipath - replace of non-existent route"
996 run_cmd "$IP -6 route flush 2001:db8:102::/64"
999 run_cmd "$IP -6 route add 2001:db8:102::/64 dsfield 0x04 via 2001:db8:101::2"
1016 ip addr help 2>&1 | grep -q metric
1017 if [ $? -ne 0 ]; then
1036 set -e
1043 run_cmd "$IP -6 addr add dev dummy1 2001:db8:104::1/64"
1044 run_cmd "$IP -6 addr add dev dummy2 2001:db8:104::2/64"
1050 set -e
1051 run_cmd "$IP -6 addr flush dev dummy1"
1052 run_cmd "$IP -6 addr add dev dummy1 2001:db8:104::1/64 metric 257"
1058 set -e
1059 run_cmd "$IP -6 addr flush dev dummy2"
1060 run_cmd "$IP -6 addr add dev dummy2 2001:db8:104::2/64 metric 258"
1066 run_cmd "$IP -6 addr del dev dummy1 2001:db8:104::1/64 metric 257"
1068 if [ $rc -eq 0 ]; then
1074 run_cmd "$IP -6 addr change dev dummy2 2001:db8:104::2/64 metric 259"
1076 if [ $rc -eq 0 ]; then
1083 run_cmd "ip netns exec ns1 sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1"
1086 if [ $rc -eq 0 ]; then
1087 out=$($IP -6 ro ls match 2001:db8:104::/64)
1091 log_test $rc 0 "Prefix route removed on link down"
1093 # verify prefix route re-inserted with assigned metric
1096 if [ $rc -eq 0 ]; then
1100 log_test $rc 0 "Prefix route with metric on link up"
1103 set -e
1104 run_cmd "$IP -6 addr flush dev dummy2"
1105 run_cmd "$IP -6 addr add dev dummy2 2001:db8:104::1 peer 2001:db8:104::2 metric 260"
1113 set -e
1114 run_cmd "$IP -6 addr change dev dummy2 2001:db8:104::1 peer 2001:db8:104::3 metric 261"
1137 # single path with metrics
1139 run_cmd "$IP -6 ro add 2001:db8:111::/64 via 2001:db8:101::2 mtu 1400"
1141 if [ $rc -eq 0 ]; then
1145 log_test $rc 0 "Single path route with mtu metric"
1151 run_cmd "$IP -6 ro add 2001:db8:112::/64 via 2001:db8:101::2 mtu 1400"
1152 run_cmd "$IP -6 ro append 2001:db8:112::/64 via 2001:db8:103::2"
1154 if [ $rc -eq 0 ]; then
1158 log_test $rc 0 "Multipath route via 2 single routes with mtu metric on first"
1162 run_cmd "$IP -6 ro add 2001:db8:113::/64 via 2001:db8:101::2"
1163 run_cmd "$IP -6 ro append 2001:db8:113::/64 via 2001:db8:103::2 mtu 1400"
1165 if [ $rc -eq 0 ]; then
1169 log_test $rc 0 "Multipath route via 2 single routes with mtu metric on 2nd"
1171 run_cmd "$IP -6 ro del 2001:db8:113::/64 via 2001:db8:101::2"
1172 if [ $? -eq 0 ]; then
1180 …run_cmd "$IP -6 ro add 2001:db8:115::/64 mtu 1400 nexthop via 2001:db8:101::2 nexthop via 2001:db8…
1182 if [ $rc -eq 0 ]; then
1188 $IP -6 ro add 2001:db8:104::/64 via 2001:db8:101::2 mtu 1300
1189 run_cmd "ip netns exec ns1 ${ping6} -w1 -c1 -s 1500 2001:db8:104::1"
1192 run_cmd "$IP -6 ro add 2001:db8:114::/64 via 2001:db8:101::2 congctl lock foo"
1213 [ $? -ne 0 ] && exit 1
1216 if [ -n "$out" ]; then
1222 if [ $? -ne 0 ]; then
1228 # add initial route - used in replace route tests
1240 set -- $expected
1248 # assumption is that basic add of a single path route works
1257 # route add same prefix - fails with EEXISTS b/c ip adds NLM_F_EXCL
1260 log_test $? 2 "Attempt to add duplicate route - gw"
1262 # route add same prefix - fails with EEXISTS b/c ip adds NLM_F_EXCL
1265 log_test $? 2 "Attempt to add duplicate route - dev only"
1267 # route add same prefix - fails with EEXISTS b/c ip adds NLM_F_EXCL
1270 log_test $? 2 "Attempt to add duplicate route - reject route"
1273 # - adds a new route; does NOT convert existing route to ECMP
1280 # - iproute2 sets NLM_F_CREATE | NLM_F_APPEND
1284 log_test $? 0 "Append nexthop to existing route - gw"
1288 check_route "172.16.104.0/24 via 172.16.101.2 dev veth1 172.16.104.0/24 dev veth3 scope link"
1289 log_test $? 0 "Append nexthop to existing route - dev only"
1294 log_test $? 0 "Append nexthop to existing route - reject route"
1300 log_test $? 0 "Append nexthop to existing reject route - gw"
1305 check_route "unreachable 172.16.104.0/24 172.16.104.0/24 dev veth3 scope link"
1306 log_test $? 0 "Append nexthop to existing reject route - dev only"
1321 if [ $rc -eq 0 ]; then
1329 if [ $rc -eq 0 ]; then
1338 # single path with single path
1343 log_test $? 0 "Single path with single path"
1345 # single path with multipath
1350 log_test $? 0 "Single path with multipath"
1352 # single path with reject
1357 log_test $? 0 "Single path with reject route"
1359 # single path with single path using MULTIPATH attribute
1364 log_test $? 0 "Single path with single path via multipath attribute"
1366 # route replace fails - invalid nexthop
1369 if [ $? -eq 0 ]; then
1378 # replace non-existent route
1379 # - note use of change versus replace since ip adds NLM_F_CREATE
1383 log_test $? 2 "Single path - replace of non-existent route"
1394 # multipath with single
1398 log_test $? 0 "Multipath with single path"
1400 # multipath with single
1404 log_test $? 0 "Multipath with single path via multipath attribute"
1412 # route replace fails - invalid nexthop 1
1416 log_test $? 0 "Multipath - invalid first nexthop"
1418 # route replace fails - invalid nexthop 2
1422 log_test $? 0 "Multipath - invalid second nexthop"
1424 # multipath non-existent route
1427 log_test $? 2 "Multipath - replace of non-existent route"
1444 run_cmd "ip netns add test-ns"
1445 run_cmd "ip link add veth-outside type veth peer name veth-inside"
1446 run_cmd "ip link add vrf-100 type vrf table 1100"
1447 run_cmd "ip link set veth-outside master vrf-100"
1448 run_cmd "ip link set veth-inside netns test-ns"
1449 run_cmd "ip link set veth-outside up"
1450 run_cmd "ip link set vrf-100 up"
1451 run_cmd "ip route add 10.1.1.1/32 dev veth-outside table 1100"
1452 run_cmd "ip netns exec test-ns ip link set veth-inside up"
1453 run_cmd "ip netns exec test-ns ip addr add 10.1.1.1/32 dev veth-inside"
1454 run_cmd "ip netns exec test-ns ip route add 10.0.0.1/32 dev veth-inside"
1455 run_cmd "ip netns exec test-ns ip route add default via 10.0.0.1"
1456 run_cmd "ip netns exec test-ns ping 10.0.0.1 -c 1 -i 1"
1457 run_cmd "ip link delete vrf-100"
1488 grep -q "via 172.16.103.2"
1489 log_test $? 0 "IPv4 route with DSCP and ECN:Not-ECT"
1492 grep -q "via 172.16.103.2"
1496 grep -q "via 172.16.103.2"
1500 grep -q "via 172.16.103.2"
1505 grep -q "via 172.16.101.2"
1506 log_test $? 0 "IPv4 route with unknown DSCP and ECN:Not-ECT"
1509 grep -q "via 172.16.101.2"
1513 grep -q "via 172.16.101.2"
1517 grep -q "via 172.16.101.2"
1522 grep -q "via 172.16.101.2"
1523 log_test $? 0 "IPv4 route with no DSCP and ECN:Not-ECT"
1526 grep -q "via 172.16.101.2"
1530 grep -q "via 172.16.101.2"
1534 grep -q "via 172.16.101.2"
1561 set -e
1572 ….104.0/24 dev dummy1 proto kernel scope link src 172.16.104.1 172.16.104.0/24 dev dummy2 proto ker…
1575 set -e
1580 ….104.0/24 dev dummy2 proto kernel scope link src 172.16.104.2 172.16.104.0/24 dev dummy1 proto ker…
1583 set -e
1588 …0/24 dev dummy1 proto kernel scope link src 172.16.104.1 metric 257 172.16.104.0/24 dev dummy2 pro…
1593 if [ $rc -eq 0 ]; then
1594 check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.2 metric 258"
1601 if [ $rc -eq 0 ]; then
1602 check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.2 metric 259"
1610 if [ $rc -eq 0 ]; then
1615 log_test $rc 0 "Prefix route removed on link down"
1617 # verify prefix route re-inserted with assigned metric
1620 if [ $rc -eq 0 ]; then
1621 check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.2 metric 259"
1624 log_test $rc 0 "Prefix route with metric on link up"
1631 if [ $rc -eq 0 ]; then
1632 check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.0 metric 260"
1640 if [ $rc -eq 0 ]; then
1641 check_route "172.16.104.2 dev dummy2 proto kernel scope link src 172.16.104.1 metric 260"
1648 if [ $rc -eq 0 ]; then
1649 check_route "172.16.104.3 dev dummy2 proto kernel scope link src 172.16.104.1 metric 261"
1670 if [ $rc -eq 0 ]; then
1674 log_test $rc 0 "Single path route with mtu metric"
1679 if [ $rc -eq 0 ]; then
1686 run_cmd "ip netns exec ns1 ping -w1 -c1 -s 1500 172.16.104.1"
1702 set -e
1730 $IP ro ls vrf red | grep -q 172.16.105.0/24
1733 $IP ro ls | grep -q 172.16.105.0/24
1740 $IP ro ls | grep -q 172.16.105.0/24
1743 $IP ro ls vrf red | grep -q 172.16.105.0/24
1751 $IP ro ls vrf red | grep -q 172.16.106.0/24
1754 $IP ro ls | grep -q 172.16.106.0/24
1761 $IP ro ls | grep -q 172.16.106.0/24
1764 $IP ro ls vrf red | grep -q 172.16.106.0/24
1772 $IP ro ls | grep -q 172.16.107.0/24
1792 # single path route
1796 log_test $rc 0 "Single path route with IPv6 gateway"
1797 if [ $rc -eq 0 ]; then
1801 run_cmd "ip netns exec ns1 ping -w1 -c1 172.16.104.1"
1802 log_test $rc 0 "Single path route with IPv6 gateway - ping"
1806 log_test $rc 0 "Single path route delete"
1807 if [ $rc -eq 0 ]; then
1812 # multipath - v6 then v4
1816 log_test $rc 0 "Multipath route add - v6 nexthop then v4"
1817 if [ $rc -eq 0 ]; then
1822 log_test $? 2 " Multipath route delete - nexthops in wrong order"
1828 # multipath - v4 then v6
1832 log_test $rc 0 "Multipath route add - v4 nexthop then v6"
1833 if [ $rc -eq 0 ]; then
1838 log_test $? 2 " Multipath route delete - nexthops in wrong order"
1848 if [ ! -x "$(command -v socat)" ]; then
1858 iptables -t mangle -L OUTPUT &> /dev/null
1859 if [ $? -ne 0 ]; then
1869 ip6tables -t mangle -L OUTPUT &> /dev/null
1870 if [ $? -ne 0 ]; then
1892 ip netns exec ns2 socat UDP4-LISTEN:54321,fork $tmp_file &
1910 $NS_EXEC iptables -t mangle -A OUTPUT -j MARK --set-mark 1
1913 log_test $? 0 " Connection with correct parameters - mangling"
1917 $NS_EXEC iptables -t mangle -D OUTPUT -j MARK --set-mark 1
1920 log_test $? 0 " Connection with correct parameters - no mangling"
1923 [[ $(cat $tmp_file | wc -l) -eq 3 ]]
1924 log_test $? 0 " Connection check - server side"
1950 ip netns exec ns2 socat UDP6-LISTEN:54321,fork $tmp_file &
1954 $IP -6 rule add pref 100 ipproto udp sport 12345 dport 54321 table 123
1955 $IP -6 route add table 123 2001:db8:101::/64 dev veth1
1959 $IP -6 route add unreachable 2001:db8:101::2/128
1968 $NS_EXEC ip6tables -t mangle -A OUTPUT -j MARK --set-mark 1
1971 log_test $? 0 " Connection with correct parameters - mangling"
1975 $NS_EXEC ip6tables -t mangle -D OUTPUT -j MARK --set-mark 1
1978 log_test $? 0 " Connection with correct parameters - no mangling"
1981 [[ $(cat $tmp_file | wc -l) -eq 3 ]]
1982 log_test $? 0 " Connection check - server side"
1984 $IP -6 route del unreachable 2001:db8:101::2/128
1985 $IP -6 route del table 123 2001:db8:101::/64 dev veth1
1986 $IP -6 rule del pref 100
1996 ip neigh help 2>&1 | grep -q 'ip neigh get'
1997 if [ $? -ne 0 ]; then
2016 set -e
2057 -t <test> Test(s) to run (default: all)
2059 -p Pause on fail
2060 -P Pause after each test before cleanup
2061 -v verbose mode (show commands and output)
2085 if [ "$(id -u)" -ne 0 ];then
2090 if [ ! -x "$(command -v ip)" ]; then
2095 ip route help 2>&1 | grep -q fibmatch
2096 if [ $? -ne 0 ]; then