Commit 2386d748 authored by David Ahern's avatar David Ahern Committed by David S. Miller

selftests: Add source route tests to fib_tests

Add tests to verify routes with source address set are deleted when
source address is deleted.
Signed-off-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 71685eb4
......@@ -9,7 +9,7 @@ ret=0
ksft_skip=4
# all tests in this script. Can be overridden with -t option
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"
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"
VERBOSE=0
PAUSE_ON_FAIL=no
......@@ -1500,6 +1500,55 @@ ipv4_route_metrics_test()
route_cleanup
}
ipv4_del_addr_test()
{
echo
echo "IPv4 delete address route tests"
setup
set -e
$IP li add dummy1 type dummy
$IP li set dummy1 up
$IP li add dummy2 type dummy
$IP li set dummy2 up
$IP li add red type vrf table 1111
$IP li set red up
$IP ro add vrf red unreachable default
$IP li set dummy2 vrf red
$IP addr add dev dummy1 172.16.104.1/24
$IP addr add dev dummy1 172.16.104.11/24
$IP addr add dev dummy2 172.16.104.1/24
$IP addr add dev dummy2 172.16.104.11/24
$IP route add 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11
$IP route add vrf red 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11
set +e
# removing address from device in vrf should only remove route from vrf table
$IP addr del dev dummy2 172.16.104.11/24
$IP ro ls vrf red | grep -q 172.16.105.0/24
log_test $? 1 "Route removed from VRF when source address deleted"
$IP ro ls | grep -q 172.16.105.0/24
log_test $? 0 "Route in default VRF not removed"
$IP addr add dev dummy2 172.16.104.11/24
$IP route add vrf red 172.16.105.0/24 via 172.16.104.2 src 172.16.104.11
$IP addr del dev dummy1 172.16.104.11/24
$IP ro ls | grep -q 172.16.105.0/24
log_test $? 1 "Route removed in default VRF when source address deleted"
$IP ro ls vrf red | grep -q 172.16.105.0/24
log_test $? 0 "Route in VRF is not removed by address delete"
$IP li del dummy1
$IP li del dummy2
cleanup
}
ipv4_route_v6_gw_test()
{
local rc
......@@ -1633,6 +1682,7 @@ do
ipv4_route_test|ipv4_rt) ipv4_route_test;;
ipv6_addr_metric) ipv6_addr_metric_test;;
ipv4_addr_metric) ipv4_addr_metric_test;;
ipv4_del_addr) ipv4_del_addr_test;;
ipv6_route_metrics) ipv6_route_metrics_test;;
ipv4_route_metrics) ipv4_route_metrics_test;;
ipv4_route_v6_gw) ipv4_route_v6_gw_test;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment