hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/testing/selftests/net/fib_tests.sh
....@@ -9,11 +9,15 @@
99 ksft_skip=4
1010
1111 # all tests in this script. Can be overridden with -t option
12
-TESTS="unregister down carrier nexthop ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric"
12
+TESTS="unregister down carrier nexthop suppress ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr"
13
+
1314 VERBOSE=0
1415 PAUSE_ON_FAIL=no
1516 PAUSE=no
16
-IP="ip -netns testns"
17
+IP="ip -netns ns1"
18
+NS_EXEC="ip netns exec ns1"
19
+
20
+which ping6 > /dev/null 2>&1 && ping6=$(which ping6) || ping6=$(which ping)
1721
1822 log_test()
1923 {
....@@ -47,8 +51,11 @@
4751 setup()
4852 {
4953 set -e
50
- ip netns add testns
54
+ ip netns add ns1
55
+ ip netns set ns1 auto
5156 $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
5259
5360 $IP link add dummy0 type dummy
5461 $IP link set dev dummy0 up
....@@ -61,7 +68,8 @@
6168 cleanup()
6269 {
6370 $IP link del dev dummy0 &> /dev/null
64
- ip netns del testns
71
+ ip netns del ns1
72
+ ip netns del ns2 &> /dev/null
6573 }
6674
6775 get_linklocal()
....@@ -428,6 +436,76 @@
428436 fib_carrier_unicast_test
429437 }
430438
439
+fib_rp_filter_test()
440
+{
441
+ echo
442
+ echo "IPv4 rp_filter tests"
443
+
444
+ setup
445
+
446
+ set -e
447
+ ip netns add ns2
448
+ ip netns set ns2 auto
449
+
450
+ ip -netns ns2 link set dev lo up
451
+
452
+ $IP link add name veth1 type veth peer name veth2
453
+ $IP link set dev veth2 netns ns2
454
+ $IP address add 192.0.2.1/24 dev veth1
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
458
+
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
463
+
464
+ # 1. (ns2) redirect lo's egress to veth2's egress
465
+ ip netns exec ns2 tc qdisc add dev lo parent root handle 1: fq_codel
466
+ ip netns exec ns2 tc filter add dev lo parent 1: protocol arp basic \
467
+ action mirred egress redirect dev veth2
468
+ ip netns exec ns2 tc filter add dev lo parent 1: protocol ip basic \
469
+ action mirred egress redirect dev veth2
470
+
471
+ # 2. (ns1) redirect veth1's ingress to lo's ingress
472
+ $NS_EXEC tc qdisc add dev veth1 ingress
473
+ $NS_EXEC tc filter add dev veth1 ingress protocol arp basic \
474
+ action mirred ingress redirect dev lo
475
+ $NS_EXEC tc filter add dev veth1 ingress protocol ip basic \
476
+ action mirred ingress redirect dev lo
477
+
478
+ # 3. (ns1) redirect lo's egress to veth1's egress
479
+ $NS_EXEC tc qdisc add dev lo parent root handle 1: fq_codel
480
+ $NS_EXEC tc filter add dev lo parent 1: protocol arp basic \
481
+ action mirred egress redirect dev veth1
482
+ $NS_EXEC tc filter add dev lo parent 1: protocol ip basic \
483
+ action mirred egress redirect dev veth1
484
+
485
+ # 4. (ns2) redirect veth2's ingress to lo's ingress
486
+ ip netns exec ns2 tc qdisc add dev veth2 ingress
487
+ ip netns exec ns2 tc filter add dev veth2 ingress protocol arp basic \
488
+ action mirred ingress redirect dev lo
489
+ ip netns exec ns2 tc filter add dev veth2 ingress protocol ip basic \
490
+ action mirred ingress redirect dev lo
491
+
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
498
+ set +e
499
+
500
+ run_cmd "ip netns exec ns2 ping -w1 -c1 192.0.2.1"
501
+ log_test $? 0 "rp_filter passes local packets"
502
+
503
+ run_cmd "ip netns exec ns2 ping -w1 -c1 127.0.0.1"
504
+ log_test $? 0 "rp_filter passes loopback packets"
505
+
506
+ cleanup
507
+}
508
+
431509 ################################################################################
432510 # Tests on nexthop spec
433511
....@@ -577,6 +655,26 @@
577655 cleanup
578656 }
579657
658
+fib_suppress_test()
659
+{
660
+ echo
661
+ echo "FIB rule with suppress_prefixlength"
662
+ setup
663
+
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
671
+
672
+ # If we got here without crashing, we're good.
673
+ log_test 0 0 "FIB rule suppress test"
674
+
675
+ cleanup
676
+}
677
+
580678 ################################################################################
581679 # Tests on route add and replace
582680
....@@ -673,10 +771,13 @@
673771
674772 check_route6()
675773 {
676
- local pfx="2001:db8:104::/64"
774
+ local pfx
677775 local expected="$1"
678776 local out
679777 local rc=0
778
+
779
+ set -- $expected
780
+ pfx=$1
680781
681782 out=$($IP -6 ro ls match ${pfx} | sed -e 's/ pref medium//')
682783 check_expected "${out}" "${expected}"
....@@ -700,28 +801,34 @@
700801 [ "${VERBOSE}" = "1" ] && set -x
701802 set -e
702803
703
- $IP li add red up type vrf table 101
804
+ ip netns add ns2
805
+ ip netns set ns2 auto
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
809
+
704810 $IP li add veth1 type veth peer name veth2
705811 $IP li add veth3 type veth peer name veth4
706812
707813 $IP li set veth1 up
708814 $IP li set veth3 up
709
- $IP li set veth2 vrf red up
710
- $IP li set veth4 vrf red up
711
- $IP li add dummy1 type dummy
712
- $IP li set dummy1 vrf red up
815
+ $IP li set veth2 netns ns2 up
816
+ $IP li set veth4 netns ns2 up
817
+ ip -netns ns2 li add dummy1 type dummy
818
+ ip -netns ns2 li set dummy1 up
713819
714
- $IP -6 addr add 2001:db8:101::1/64 dev veth1
715
- $IP -6 addr add 2001:db8:101::2/64 dev veth2
716
- $IP -6 addr add 2001:db8:103::1/64 dev veth3
717
- $IP -6 addr add 2001:db8:103::2/64 dev veth4
718
- $IP -6 addr add 2001:db8:104::1/64 dev dummy1
719
-
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
720822 $IP addr add 172.16.101.1/24 dev veth1
721
- $IP addr add 172.16.101.2/24 dev veth2
722823 $IP addr add 172.16.103.1/24 dev veth3
723
- $IP addr add 172.16.103.2/24 dev veth4
724
- $IP addr add 172.16.104.1/24 dev dummy1
824
+
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
828
+
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
725832
726833 set +e
727834 }
....@@ -960,7 +1067,7 @@
9601067 log_test $rc 0 "Modify metric of address"
9611068
9621069 # verify prefix route removed on down
963
- run_cmd "ip netns exec testns sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1"
1070
+ run_cmd "ip netns exec ns1 sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1"
9641071 run_cmd "$IP li set dev dummy2 down"
9651072 rc=$?
9661073 if [ $rc -eq 0 ]; then
....@@ -1004,6 +1111,77 @@
10041111 cleanup
10051112 }
10061113
1114
+ipv6_route_metrics_test()
1115
+{
1116
+ local rc
1117
+
1118
+ echo
1119
+ echo "IPv6 routes with metrics"
1120
+
1121
+ route_setup
1122
+
1123
+ #
1124
+ # single path with metrics
1125
+ #
1126
+ run_cmd "$IP -6 ro add 2001:db8:111::/64 via 2001:db8:101::2 mtu 1400"
1127
+ rc=$?
1128
+ if [ $rc -eq 0 ]; then
1129
+ check_route6 "2001:db8:111::/64 via 2001:db8:101::2 dev veth1 metric 1024 mtu 1400"
1130
+ rc=$?
1131
+ fi
1132
+ log_test $rc 0 "Single path route with mtu metric"
1133
+
1134
+
1135
+ #
1136
+ # multipath via separate routes with metrics
1137
+ #
1138
+ run_cmd "$IP -6 ro add 2001:db8:112::/64 via 2001:db8:101::2 mtu 1400"
1139
+ run_cmd "$IP -6 ro append 2001:db8:112::/64 via 2001:db8:103::2"
1140
+ rc=$?
1141
+ if [ $rc -eq 0 ]; then
1142
+ check_route6 "2001:db8:112::/64 metric 1024 mtu 1400 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1"
1143
+ rc=$?
1144
+ fi
1145
+ log_test $rc 0 "Multipath route via 2 single routes with mtu metric on first"
1146
+
1147
+ # second route is coalesced to first to make a multipath route.
1148
+ # MTU of the second path is hidden from display!
1149
+ run_cmd "$IP -6 ro add 2001:db8:113::/64 via 2001:db8:101::2"
1150
+ run_cmd "$IP -6 ro append 2001:db8:113::/64 via 2001:db8:103::2 mtu 1400"
1151
+ rc=$?
1152
+ if [ $rc -eq 0 ]; then
1153
+ check_route6 "2001:db8:113::/64 metric 1024 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1"
1154
+ rc=$?
1155
+ fi
1156
+ log_test $rc 0 "Multipath route via 2 single routes with mtu metric on 2nd"
1157
+
1158
+ run_cmd "$IP -6 ro del 2001:db8:113::/64 via 2001:db8:101::2"
1159
+ if [ $? -eq 0 ]; then
1160
+ check_route6 "2001:db8:113::/64 via 2001:db8:103::2 dev veth3 metric 1024 mtu 1400"
1161
+ log_test $? 0 " MTU of second leg"
1162
+ fi
1163
+
1164
+ #
1165
+ # multipath with metrics
1166
+ #
1167
+ run_cmd "$IP -6 ro add 2001:db8:115::/64 mtu 1400 nexthop via 2001:db8:101::2 nexthop via 2001:db8:103::2"
1168
+ rc=$?
1169
+ if [ $rc -eq 0 ]; then
1170
+ check_route6 "2001:db8:115::/64 metric 1024 mtu 1400 nexthop via 2001:db8:101::2 dev veth1 weight 1 nexthop via 2001:db8:103::2 dev veth3 weight 1"
1171
+ rc=$?
1172
+ fi
1173
+ log_test $rc 0 "Multipath route with mtu metric"
1174
+
1175
+ $IP -6 ro add 2001:db8:104::/64 via 2001:db8:101::2 mtu 1300
1176
+ run_cmd "ip netns exec ns1 ${ping6} -w1 -c1 -s 1500 2001:db8:104::1"
1177
+ log_test $? 0 "Using route with mtu metric"
1178
+
1179
+ run_cmd "$IP -6 ro add 2001:db8:114::/64 via 2001:db8:101::2 congctl lock foo"
1180
+ log_test $? 2 "Invalid metric (fails metric_convert)"
1181
+
1182
+ route_cleanup
1183
+}
1184
+
10071185 # add route for a prefix, flushing any existing routes first
10081186 # expected to be the first step of a test
10091187 add_route()
....@@ -1042,9 +1220,13 @@
10421220
10431221 check_route()
10441222 {
1045
- local pfx="172.16.104.0/24"
1223
+ local pfx
10461224 local expected="$1"
10471225 local out
1226
+
1227
+ set -- $expected
1228
+ pfx=$1
1229
+ [ "${pfx}" = "unreachable" ] && pfx=$2
10481230
10491231 out=$($IP ro ls match ${pfx})
10501232 check_expected "${out}" "${expected}"
....@@ -1241,12 +1423,37 @@
12411423 ipv4_rt_replace_mpath
12421424 }
12431425
1426
+# checks that cached input route on VRF port is deleted
1427
+# when VRF is deleted
1428
+ipv4_local_rt_cache()
1429
+{
1430
+ run_cmd "ip addr add 10.0.0.1/32 dev lo"
1431
+ run_cmd "ip netns add test-ns"
1432
+ run_cmd "ip link add veth-outside type veth peer name veth-inside"
1433
+ run_cmd "ip link add vrf-100 type vrf table 1100"
1434
+ run_cmd "ip link set veth-outside master vrf-100"
1435
+ run_cmd "ip link set veth-inside netns test-ns"
1436
+ run_cmd "ip link set veth-outside up"
1437
+ run_cmd "ip link set vrf-100 up"
1438
+ run_cmd "ip route add 10.1.1.1/32 dev veth-outside table 1100"
1439
+ run_cmd "ip netns exec test-ns ip link set veth-inside up"
1440
+ run_cmd "ip netns exec test-ns ip addr add 10.1.1.1/32 dev veth-inside"
1441
+ run_cmd "ip netns exec test-ns ip route add 10.0.0.1/32 dev veth-inside"
1442
+ run_cmd "ip netns exec test-ns ip route add default via 10.0.0.1"
1443
+ run_cmd "ip netns exec test-ns ping 10.0.0.1 -c 1 -i 1"
1444
+ run_cmd "ip link delete vrf-100"
1445
+
1446
+ # if we do not hang test is a success
1447
+ log_test $? 0 "Cached route removed from VRF port device"
1448
+}
1449
+
12441450 ipv4_route_test()
12451451 {
12461452 route_setup
12471453
12481454 ipv4_rt_add
12491455 ipv4_rt_replace
1456
+ ipv4_local_rt_cache
12501457
12511458 route_cleanup
12521459 }
....@@ -1360,6 +1567,193 @@
13601567 cleanup
13611568 }
13621569
1570
+ipv4_route_metrics_test()
1571
+{
1572
+ local rc
1573
+
1574
+ echo
1575
+ echo "IPv4 route add / append tests"
1576
+
1577
+ route_setup
1578
+
1579
+ run_cmd "$IP ro add 172.16.111.0/24 via 172.16.101.2 mtu 1400"
1580
+ rc=$?
1581
+ if [ $rc -eq 0 ]; then
1582
+ check_route "172.16.111.0/24 via 172.16.101.2 dev veth1 mtu 1400"
1583
+ rc=$?
1584
+ fi
1585
+ log_test $rc 0 "Single path route with mtu metric"
1586
+
1587
+
1588
+ run_cmd "$IP ro add 172.16.112.0/24 mtu 1400 nexthop via 172.16.101.2 nexthop via 172.16.103.2"
1589
+ rc=$?
1590
+ if [ $rc -eq 0 ]; then
1591
+ check_route "172.16.112.0/24 mtu 1400 nexthop via 172.16.101.2 dev veth1 weight 1 nexthop via 172.16.103.2 dev veth3 weight 1"
1592
+ rc=$?
1593
+ fi
1594
+ log_test $rc 0 "Multipath route with mtu metric"
1595
+
1596
+ $IP ro add 172.16.104.0/24 via 172.16.101.2 mtu 1300
1597
+ run_cmd "ip netns exec ns1 ping -w1 -c1 -s 1500 172.16.104.1"
1598
+ log_test $? 0 "Using route with mtu metric"
1599
+
1600
+ run_cmd "$IP ro add 172.16.111.0/24 via 172.16.101.2 congctl lock foo"
1601
+ log_test $? 2 "Invalid metric (fails metric_convert)"
1602
+
1603
+ route_cleanup
1604
+}
1605
+
1606
+ipv4_del_addr_test()
1607
+{
1608
+ echo
1609
+ echo "IPv4 delete address route tests"
1610
+
1611
+ setup
1612
+
1613
+ set -e
1614
+ $IP li add dummy1 type dummy
1615
+ $IP li set dummy1 up
1616
+ $IP li add dummy2 type dummy
1617
+ $IP li set dummy2 up
1618
+ $IP li add red type vrf table 1111
1619
+ $IP li set red up
1620
+ $IP ro add vrf red unreachable default
1621
+ $IP li set dummy2 vrf red
1622
+
1623
+ $IP addr add dev dummy1 172.16.104.1/24
1624
+ $IP addr add dev dummy1 172.16.104.11/24
1625
+ $IP addr add dev dummy1 172.16.104.12/24
1626
+ $IP addr add dev dummy1 172.16.104.13/24
1627
+ $IP addr add dev dummy2 172.16.104.1/24
1628
+ $IP addr add dev dummy2 172.16.104.11/24
1629
+ $IP addr add dev dummy2 172.16.104.12/24
1630
+ $IP route add 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11
1631
+ $IP route add 172.16.106.0/24 dev lo src 172.16.104.12
1632
+ $IP route add table 0 172.16.107.0/24 via 172.16.104.2 src 172.16.104.13
1633
+ $IP route add vrf red 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11
1634
+ $IP route add vrf red 172.16.106.0/24 dev lo src 172.16.104.12
1635
+ set +e
1636
+
1637
+ # removing address from device in vrf should only remove route from vrf table
1638
+ echo " Regular FIB info"
1639
+
1640
+ $IP addr del dev dummy2 172.16.104.11/24
1641
+ $IP ro ls vrf red | grep -q 172.16.105.0/24
1642
+ log_test $? 1 "Route removed from VRF when source address deleted"
1643
+
1644
+ $IP ro ls | grep -q 172.16.105.0/24
1645
+ log_test $? 0 "Route in default VRF not removed"
1646
+
1647
+ $IP addr add dev dummy2 172.16.104.11/24
1648
+ $IP route add vrf red 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11
1649
+
1650
+ $IP addr del dev dummy1 172.16.104.11/24
1651
+ $IP ro ls | grep -q 172.16.105.0/24
1652
+ log_test $? 1 "Route removed in default VRF when source address deleted"
1653
+
1654
+ $IP ro ls vrf red | grep -q 172.16.105.0/24
1655
+ log_test $? 0 "Route in VRF is not removed by address delete"
1656
+
1657
+ # removing address from device in vrf should only remove route from vrf
1658
+ # table even when the associated fib info only differs in table ID
1659
+ echo " Identical FIB info with different table ID"
1660
+
1661
+ $IP addr del dev dummy2 172.16.104.12/24
1662
+ $IP ro ls vrf red | grep -q 172.16.106.0/24
1663
+ log_test $? 1 "Route removed from VRF when source address deleted"
1664
+
1665
+ $IP ro ls | grep -q 172.16.106.0/24
1666
+ log_test $? 0 "Route in default VRF not removed"
1667
+
1668
+ $IP addr add dev dummy2 172.16.104.12/24
1669
+ $IP route add vrf red 172.16.106.0/24 dev lo src 172.16.104.12
1670
+
1671
+ $IP addr del dev dummy1 172.16.104.12/24
1672
+ $IP ro ls | grep -q 172.16.106.0/24
1673
+ log_test $? 1 "Route removed in default VRF when source address deleted"
1674
+
1675
+ $IP ro ls vrf red | grep -q 172.16.106.0/24
1676
+ log_test $? 0 "Route in VRF is not removed by address delete"
1677
+
1678
+ # removing address from device in default vrf should remove route from
1679
+ # the default vrf even when route was inserted with a table ID of 0.
1680
+ echo " Table ID 0"
1681
+
1682
+ $IP addr del dev dummy1 172.16.104.13/24
1683
+ $IP ro ls | grep -q 172.16.107.0/24
1684
+ log_test $? 1 "Route removed in default VRF when source address deleted"
1685
+
1686
+ $IP li del dummy1
1687
+ $IP li del dummy2
1688
+ cleanup
1689
+}
1690
+
1691
+
1692
+ipv4_route_v6_gw_test()
1693
+{
1694
+ local rc
1695
+
1696
+ echo
1697
+ echo "IPv4 route with IPv6 gateway tests"
1698
+
1699
+ route_setup
1700
+ sleep 2
1701
+
1702
+ #
1703
+ # single path route
1704
+ #
1705
+ run_cmd "$IP ro add 172.16.104.0/24 via inet6 2001:db8:101::2"
1706
+ rc=$?
1707
+ log_test $rc 0 "Single path route with IPv6 gateway"
1708
+ if [ $rc -eq 0 ]; then
1709
+ check_route "172.16.104.0/24 via inet6 2001:db8:101::2 dev veth1"
1710
+ fi
1711
+
1712
+ run_cmd "ip netns exec ns1 ping -w1 -c1 172.16.104.1"
1713
+ log_test $rc 0 "Single path route with IPv6 gateway - ping"
1714
+
1715
+ run_cmd "$IP ro del 172.16.104.0/24 via inet6 2001:db8:101::2"
1716
+ rc=$?
1717
+ log_test $rc 0 "Single path route delete"
1718
+ if [ $rc -eq 0 ]; then
1719
+ check_route "172.16.112.0/24"
1720
+ fi
1721
+
1722
+ #
1723
+ # multipath - v6 then v4
1724
+ #
1725
+ run_cmd "$IP ro add 172.16.104.0/24 nexthop via inet6 2001:db8:101::2 dev veth1 nexthop via 172.16.103.2 dev veth3"
1726
+ rc=$?
1727
+ log_test $rc 0 "Multipath route add - v6 nexthop then v4"
1728
+ if [ $rc -eq 0 ]; then
1729
+ check_route "172.16.104.0/24 nexthop via inet6 2001:db8:101::2 dev veth1 weight 1 nexthop via 172.16.103.2 dev veth3 weight 1"
1730
+ fi
1731
+
1732
+ run_cmd "$IP ro del 172.16.104.0/24 nexthop via 172.16.103.2 dev veth3 nexthop via inet6 2001:db8:101::2 dev veth1"
1733
+ log_test $? 2 " Multipath route delete - nexthops in wrong order"
1734
+
1735
+ run_cmd "$IP ro del 172.16.104.0/24 nexthop via inet6 2001:db8:101::2 dev veth1 nexthop via 172.16.103.2 dev veth3"
1736
+ log_test $? 0 " Multipath route delete exact match"
1737
+
1738
+ #
1739
+ # multipath - v4 then v6
1740
+ #
1741
+ run_cmd "$IP ro add 172.16.104.0/24 nexthop via 172.16.103.2 dev veth3 nexthop via inet6 2001:db8:101::2 dev veth1"
1742
+ rc=$?
1743
+ log_test $rc 0 "Multipath route add - v4 nexthop then v6"
1744
+ if [ $rc -eq 0 ]; then
1745
+ check_route "172.16.104.0/24 nexthop via 172.16.103.2 dev veth3 weight 1 nexthop via inet6 2001:db8:101::2 dev veth1 weight 1"
1746
+ fi
1747
+
1748
+ run_cmd "$IP ro del 172.16.104.0/24 nexthop via inet6 2001:db8:101::2 dev veth1 nexthop via 172.16.103.2 dev veth3"
1749
+ log_test $? 2 " Multipath route delete - nexthops in wrong order"
1750
+
1751
+ run_cmd "$IP ro del 172.16.104.0/24 nexthop via 172.16.103.2 dev veth3 nexthop via inet6 2001:db8:101::2 dev veth1"
1752
+ log_test $? 0 " Multipath route delete exact match"
1753
+
1754
+ route_cleanup
1755
+}
1756
+
13631757 ################################################################################
13641758 # usage
13651759
....@@ -1421,11 +1815,17 @@
14211815 fib_unreg_test|unregister) fib_unreg_test;;
14221816 fib_down_test|down) fib_down_test;;
14231817 fib_carrier_test|carrier) fib_carrier_test;;
1818
+ fib_rp_filter_test|rp_filter) fib_rp_filter_test;;
14241819 fib_nexthop_test|nexthop) fib_nexthop_test;;
1820
+ fib_suppress_test|suppress) fib_suppress_test;;
14251821 ipv6_route_test|ipv6_rt) ipv6_route_test;;
14261822 ipv4_route_test|ipv4_rt) ipv4_route_test;;
14271823 ipv6_addr_metric) ipv6_addr_metric_test;;
14281824 ipv4_addr_metric) ipv4_addr_metric_test;;
1825
+ ipv4_del_addr) ipv4_del_addr_test;;
1826
+ ipv6_route_metrics) ipv6_route_metrics_test;;
1827
+ ipv4_route_metrics) ipv4_route_metrics_test;;
1828
+ ipv4_route_v6_gw) ipv4_route_v6_gw_test;;
14291829
14301830 help) echo "Test names: $TESTS"; exit 0;;
14311831 esac