selftests: pmtu: Introduce list_flush_ipv6_exception test case

This test checks that route exceptions can be successfully listed and
flushed using ip -6 route {list,flush} cache.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stefano Brivio 2019-06-06 22:15:09 +02:00 коммит произвёл David S. Miller
Родитель 48debfd736
Коммит e28799e52a
1 изменённых файлов: 50 добавлений и 1 удалений

Просмотреть файл

@ -111,6 +111,10 @@
#
# - cleanup_ipv6_exception
# Same as above, but use IPv6 transport from A to B
#
# - list_flush_ipv6_exception
# Using the same topology as in pmtu_ipv6, create exceptions, and check
# they are shown when listing exception caches, gone after flushing them
# Kselftest framework requirement - SKIP code is 4.
@ -151,7 +155,8 @@ tests="
pmtu_vti6_link_add_mtu vti6: MTU setting on link creation 0
pmtu_vti6_link_change_mtu vti6: MTU changes on link changes 0
cleanup_ipv4_exception ipv4: cleanup of cached exceptions 1
cleanup_ipv6_exception ipv6: cleanup of cached exceptions 1"
cleanup_ipv6_exception ipv6: cleanup of cached exceptions 1
list_flush_ipv6_exception ipv6: list and flush cached exceptions 1"
NS_A="ns-A"
NS_B="ns-B"
@ -1202,6 +1207,50 @@ run_test_nh() {
USE_NH=no
}
test_list_flush_ipv6_exception() {
setup namespaces routing || return 2
trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \
"${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \
"${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \
"${ns_r2}" veth_R2-B "${ns_b}" veth_B-R2
dst1="${prefix6}:${b_r1}::1"
dst2="${prefix6}:${b_r2}::1"
# Set up initial MTU values
mtu "${ns_a}" veth_A-R1 2000
mtu "${ns_r1}" veth_R1-A 2000
mtu "${ns_r1}" veth_R1-B 1500
mtu "${ns_b}" veth_B-R1 1500
mtu "${ns_a}" veth_A-R2 2000
mtu "${ns_r2}" veth_R2-A 2000
mtu "${ns_r2}" veth_R2-B 1500
mtu "${ns_b}" veth_B-R2 1500
fail=0
# Create route exceptions
run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s 1800 ${dst1}
run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s 1800 ${dst2}
if [ "$(${ns_a} ip -6 route list cache | wc -l)" -ne 2 ]; then
err " can't list cached exceptions"
fail=1
fi
run_cmd ${ns_a} ip -6 route flush cache
sleep 1
pmtu1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})"
pmtu2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"
if [ -n "${pmtu1}" ] || [ -n "${pmtu2}" ]; then
err " can't flush cached exceptions"
fail=1
fi
return ${fail}
}
usage() {
echo
echo "$0 [OPTIONS] [TEST]..."