Commit 493f3cc7 authored by David Ahern's avatar David Ahern Committed by David S. Miller

selftests: A few improvements to fib_nexthops.sh

Add nodad when adding IPv6 addresses and remove the sleep.

A recent change to iproute2 moved the 'pref medium' to the prefix
(where it belongs). Change the expected route check to strip
'pref medium' to be compatible with old and new iproute2.

Add IPv4 runtime test with an IPv6 address as the gateway in
the default route.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 250562af
...@@ -150,31 +150,31 @@ setup() ...@@ -150,31 +150,31 @@ setup()
$IP li add veth1 type veth peer name veth2 $IP li add veth1 type veth peer name veth2
$IP li set veth1 up $IP li set veth1 up
$IP addr add 172.16.1.1/24 dev veth1 $IP addr add 172.16.1.1/24 dev veth1
$IP -6 addr add 2001:db8:91::1/64 dev veth1 $IP -6 addr add 2001:db8:91::1/64 dev veth1 nodad
$IP li add veth3 type veth peer name veth4 $IP li add veth3 type veth peer name veth4
$IP li set veth3 up $IP li set veth3 up
$IP addr add 172.16.2.1/24 dev veth3 $IP addr add 172.16.2.1/24 dev veth3
$IP -6 addr add 2001:db8:92::1/64 dev veth3 $IP -6 addr add 2001:db8:92::1/64 dev veth3 nodad
$IP li set veth2 netns peer up $IP li set veth2 netns peer up
ip -netns peer addr add 172.16.1.2/24 dev veth2 ip -netns peer addr add 172.16.1.2/24 dev veth2
ip -netns peer -6 addr add 2001:db8:91::2/64 dev veth2 ip -netns peer -6 addr add 2001:db8:91::2/64 dev veth2 nodad
$IP li set veth4 netns peer up $IP li set veth4 netns peer up
ip -netns peer addr add 172.16.2.2/24 dev veth4 ip -netns peer addr add 172.16.2.2/24 dev veth4
ip -netns peer -6 addr add 2001:db8:92::2/64 dev veth4 ip -netns peer -6 addr add 2001:db8:92::2/64 dev veth4 nodad
ip -netns remote li add veth5 type veth peer name veth6 ip -netns remote li add veth5 type veth peer name veth6
ip -netns remote li set veth5 up ip -netns remote li set veth5 up
ip -netns remote addr add dev veth5 172.16.101.1/24 ip -netns remote addr add dev veth5 172.16.101.1/24
ip -netns remote addr add dev veth5 2001:db8:101::1/64 ip -netns remote -6 addr add dev veth5 2001:db8:101::1/64 nodad
ip -netns remote ro add 172.16.0.0/22 via 172.16.101.2 ip -netns remote ro add 172.16.0.0/22 via 172.16.101.2
ip -netns remote -6 ro add 2001:db8:90::/40 via 2001:db8:101::2 ip -netns remote -6 ro add 2001:db8:90::/40 via 2001:db8:101::2
ip -netns remote li set veth6 netns peer up ip -netns remote li set veth6 netns peer up
ip -netns peer addr add dev veth6 172.16.101.2/24 ip -netns peer addr add dev veth6 172.16.101.2/24
ip -netns peer addr add dev veth6 2001:db8:101::2/64 ip -netns peer -6 addr add dev veth6 2001:db8:101::2/64 nodad
set +e set +e
} }
...@@ -248,7 +248,7 @@ check_route6() ...@@ -248,7 +248,7 @@ check_route6()
local expected="$2" local expected="$2"
local out local out
out=$($IP -6 route ls match ${pfx} 2>/dev/null) out=$($IP -6 route ls match ${pfx} 2>/dev/null | sed -e 's/pref medium//')
check_output "${out}" "${expected}" check_output "${out}" "${expected}"
} }
...@@ -423,8 +423,6 @@ ipv6_fcnal_runtime() ...@@ -423,8 +423,6 @@ ipv6_fcnal_runtime()
echo "IPv6 functional runtime" echo "IPv6 functional runtime"
echo "-----------------------" echo "-----------------------"
sleep 5
# #
# IPv6 - the basics # IPv6 - the basics
# #
...@@ -481,12 +479,12 @@ ipv6_fcnal_runtime() ...@@ -481,12 +479,12 @@ ipv6_fcnal_runtime()
run_cmd "$IP -6 nexthop add id 85 dev veth1" run_cmd "$IP -6 nexthop add id 85 dev veth1"
run_cmd "$IP ro replace 2001:db8:101::1/128 nhid 85" run_cmd "$IP ro replace 2001:db8:101::1/128 nhid 85"
log_test $? 0 "IPv6 route with device only nexthop" log_test $? 0 "IPv6 route with device only nexthop"
check_route6 "2001:db8:101::1" "2001:db8:101::1 nhid 85 dev veth1 metric 1024 pref medium" check_route6 "2001:db8:101::1" "2001:db8:101::1 nhid 85 dev veth1 metric 1024"
run_cmd "$IP nexthop add id 123 group 81/85" run_cmd "$IP nexthop add id 123 group 81/85"
run_cmd "$IP ro replace 2001:db8:101::1/128 nhid 123" run_cmd "$IP ro replace 2001:db8:101::1/128 nhid 123"
log_test $? 0 "IPv6 multipath route with nexthop mix - dev only + gw" log_test $? 0 "IPv6 multipath route with nexthop mix - dev only + gw"
check_route6 "2001:db8:101::1" "2001:db8:101::1 nhid 123 metric 1024 nexthop via 2001:db8:91::2 dev veth1 weight 1 nexthop dev veth1 weight 1 pref medium" check_route6 "2001:db8:101::1" "2001:db8:101::1 nhid 123 metric 1024 nexthop via 2001:db8:91::2 dev veth1 weight 1 nexthop dev veth1 weight 1"
# #
# IPv6 route with v4 nexthop - not allowed # IPv6 route with v4 nexthop - not allowed
...@@ -843,6 +841,11 @@ ipv4_fcnal_runtime() ...@@ -843,6 +841,11 @@ ipv4_fcnal_runtime()
$IP neigh sh | grep 'dev veth1' $IP neigh sh | grep 'dev veth1'
fi fi
run_cmd "$IP ro del 172.16.101.1/32 via inet6 ${lladdr} dev veth1"
run_cmd "$IP -4 ro add default via inet6 ${lladdr} dev veth1"
run_cmd "ip netns exec me ping -c1 -w1 172.16.101.1"
log_test $? 0 "IPv4 default route with IPv6 gateway"
# #
# MPLS as an example of LWT encap # MPLS as an example of LWT encap
# #
......
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