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

selftests: Add ipv6 tcp tests to fcnal-test

Add IPv6 tcp tests to fcnal-test.sh. Covers the permutations of directly
connected addresses, routed destinations, VRF and non-VRF, and expected
failures for both clients and servers. Includes permutations with
net.ipv4.tcp_l3mdev_accept set to 0 and 1.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bbd7c764
...@@ -1303,6 +1303,373 @@ ipv6_ping() ...@@ -1303,6 +1303,373 @@ ipv6_ping()
ipv6_ping_vrf ipv6_ping_vrf
} }
################################################################################
# IPv6 TCP
ipv6_tcp_novrf()
{
local a
#
# server tests
#
for a in ${NSA_IP6} ${NSA_LO_IP6} ${NSA_LINKIP6}%${NSB_DEV}
do
log_start
run_cmd nettest -6 -s &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "Global server"
done
# verify TCP reset received
for a in ${NSA_IP6} ${NSA_LO_IP6} ${NSA_LINKIP6}%${NSB_DEV}
do
log_start
show_hint "Should fail 'Connection refused'"
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 1 "No server"
done
#
# client
#
for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV}
do
log_start
run_cmd_nsb nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a}
log_test_addr ${a} $? 0 "Client"
done
for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV}
do
log_start
run_cmd_nsb nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
log_test_addr ${a} $? 0 "Client, device bind"
done
for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV}
do
log_start
show_hint "Should fail 'Connection refused'"
run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
log_test_addr ${a} $? 1 "No server, device client"
done
#
# local address tests
#
for a in ${NSA_IP6} ${NSA_LO_IP6} ::1
do
log_start
run_cmd nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a}
log_test_addr ${a} $? 0 "Global server, local connection"
done
a=${NSA_IP6}
log_start
run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
sleep 1
run_cmd nettest -6 -r ${a} -0 ${a}
log_test_addr ${a} $? 0 "Device server, unbound client, local connection"
for a in ${NSA_LO_IP6} ::1
do
log_start
show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope"
run_cmd nettest -6 -s -d ${NSA_DEV} &
sleep 1
run_cmd nettest -6 -r ${a}
log_test_addr ${a} $? 1 "Device server, unbound client, local connection"
done
a=${NSA_IP6}
log_start
run_cmd nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a}
log_test_addr ${a} $? 0 "Global server, device client, local connection"
for a in ${NSA_LO_IP6} ::1
do
log_start
show_hint "Should fail 'Connection refused' since addresses on loopback are out of device scope"
run_cmd nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
log_test_addr ${a} $? 1 "Global server, device client, local connection"
done
for a in ${NSA_IP6} ${NSA_LINKIP6}
do
log_start
run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
sleep 1
run_cmd nettest -6 -d ${NSA_DEV} -r ${a}
log_test_addr ${a} $? 0 "Device server, device client, local conn"
done
for a in ${NSA_IP6} ${NSA_LINKIP6}
do
log_start
show_hint "Should fail 'Connection refused'"
run_cmd nettest -6 -d ${NSA_DEV} -r ${a}
log_test_addr ${a} $? 1 "No server, device client, local conn"
done
}
ipv6_tcp_vrf()
{
local a
# disable global server
log_subsection "Global server disabled"
set_sysctl net.ipv4.tcp_l3mdev_accept=0
#
# server tests
#
for a in ${NSA_IP6} ${VRF_IP6} ${NSA_LINKIP6}%${NSB_DEV}
do
log_start
show_hint "Should fail 'Connection refused' since global server with VRF is disabled"
run_cmd nettest -6 -s &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 1 "Global server"
done
for a in ${NSA_IP6} ${VRF_IP6}
do
log_start
run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "VRF server"
done
# link local is always bound to ingress device
a=${NSA_LINKIP6}%${NSB_DEV}
log_start
run_cmd nettest -6 -s -d ${VRF} -2 ${NSA_DEV} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "VRF server"
for a in ${NSA_IP6} ${VRF_IP6} ${NSA_LINKIP6}%${NSB_DEV}
do
log_start
run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "Device server"
done
# verify TCP reset received
for a in ${NSA_IP6} ${VRF_IP6} ${NSA_LINKIP6}%${NSB_DEV}
do
log_start
show_hint "Should fail 'Connection refused'"
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 1 "No server"
done
# local address tests
a=${NSA_IP6}
log_start
show_hint "Should fail 'Connection refused' since global server with VRF is disabled"
run_cmd nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
log_test_addr ${a} $? 1 "Global server, local connection"
#
# enable VRF global server
#
log_subsection "VRF Global server enabled"
set_sysctl net.ipv4.tcp_l3mdev_accept=1
for a in ${NSA_IP6} ${VRF_IP6}
do
log_start
run_cmd nettest -6 -s -2 ${VRF} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "Global server"
done
for a in ${NSA_IP6} ${VRF_IP6}
do
log_start
run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "VRF server"
done
# For LLA, child socket is bound to device
a=${NSA_LINKIP6}%${NSB_DEV}
log_start
run_cmd nettest -6 -s -2 ${NSA_DEV} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "Global server"
log_start
run_cmd nettest -6 -s -d ${VRF} -2 ${NSA_DEV} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "VRF server"
for a in ${NSA_IP6} ${NSA_LINKIP6}%${NSB_DEV}
do
log_start
run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
sleep 1
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 0 "Device server"
done
# verify TCP reset received
for a in ${NSA_IP6} ${VRF_IP6} ${NSA_LINKIP6}%${NSB_DEV}
do
log_start
show_hint "Should fail 'Connection refused'"
run_cmd_nsb nettest -6 -r ${a}
log_test_addr ${a} $? 1 "No server"
done
# local address tests
for a in ${NSA_IP6} ${VRF_IP6}
do
log_start
show_hint "Fails 'No route to host' since client is not in VRF"
run_cmd nettest -6 -s -2 ${VRF} &
sleep 1
run_cmd nettest -6 -r ${a}
log_test_addr ${a} $? 1 "Global server, local connection"
done
#
# client
#
for a in ${NSB_IP6} ${NSB_LO_IP6}
do
log_start
run_cmd_nsb nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a} -d ${VRF}
log_test_addr ${a} $? 0 "Client, VRF bind"
done
a=${NSB_LINKIP6}
log_start
show_hint "Fails since VRF device does not allow linklocal addresses"
run_cmd_nsb nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a} -d ${VRF}
log_test_addr ${a} $? 1 "Client, VRF bind"
for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}
do
log_start
run_cmd_nsb nettest -6 -s &
sleep 1
run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
log_test_addr ${a} $? 0 "Client, device bind"
done
for a in ${NSB_IP6} ${NSB_LO_IP6}
do
log_start
show_hint "Should fail 'Connection refused'"
run_cmd nettest -6 -r ${a} -d ${VRF}
log_test_addr ${a} $? 1 "No server, VRF client"
done
for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}
do
log_start
show_hint "Should fail 'Connection refused'"
run_cmd nettest -6 -r ${a} -d ${NSA_DEV}
log_test_addr ${a} $? 1 "No server, device client"
done
for a in ${NSA_IP6} ${VRF_IP6} ::1
do
log_start
run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
sleep 1
run_cmd nettest -6 -r ${a} -d ${VRF} -0 ${a}
log_test_addr ${a} $? 0 "VRF server, VRF client, local connection"
done
a=${NSA_IP6}
log_start
run_cmd nettest -6 -s -d ${VRF} -2 ${VRF} &
sleep 1
run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a}
log_test_addr ${a} $? 0 "VRF server, device client, local connection"
a=${NSA_IP6}
log_start
show_hint "Should fail since unbound client is out of VRF scope"
run_cmd nettest -6 -s -d ${VRF} &
sleep 1
run_cmd nettest -6 -r ${a}
log_test_addr ${a} $? 1 "VRF server, unbound client, local connection"
log_start
run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
sleep 1
run_cmd nettest -6 -r ${a} -d ${VRF} -0 ${a}
log_test_addr ${a} $? 0 "Device server, VRF client, local connection"
for a in ${NSA_IP6} ${NSA_LINKIP6}
do
log_start
run_cmd nettest -6 -s -d ${NSA_DEV} -2 ${NSA_DEV} &
sleep 1
run_cmd nettest -6 -r ${a} -d ${NSA_DEV} -0 ${a}
log_test_addr ${a} $? 0 "Device server, device client, local connection"
done
}
ipv6_tcp()
{
log_section "IPv6/TCP"
which nettest >/dev/null
if [ $? -ne 0 ]; then
log_error "nettest not found; skipping tests"
return
fi
log_subsection "No VRF"
setup
# tcp_l3mdev_accept should have no affect without VRF;
# run tests with it enabled and disabled to verify
log_subsection "tcp_l3mdev_accept disabled"
set_sysctl net.ipv4.tcp_l3mdev_accept=0
ipv6_tcp_novrf
log_subsection "tcp_l3mdev_accept enabled"
set_sysctl net.ipv4.tcp_l3mdev_accept=1
ipv6_tcp_novrf
log_subsection "With VRF"
setup "yes"
ipv6_tcp_vrf
}
################################################################################ ################################################################################
# usage # usage
...@@ -1324,7 +1691,7 @@ EOF ...@@ -1324,7 +1691,7 @@ EOF
# main # main
TESTS_IPV4="ipv4_ping ipv4_tcp" TESTS_IPV4="ipv4_ping ipv4_tcp"
TESTS_IPV6="ipv6_ping" TESTS_IPV6="ipv6_ping ipv6_tcp"
PAUSE_ON_FAIL=no PAUSE_ON_FAIL=no
PAUSE=no PAUSE=no
...@@ -1366,6 +1733,7 @@ do ...@@ -1366,6 +1733,7 @@ do
ipv4_tcp|tcp) ipv4_tcp;; ipv4_tcp|tcp) ipv4_tcp;;
ipv6_ping|ping6) ipv6_ping;; ipv6_ping|ping6) ipv6_ping;;
ipv6_tcp|tcp6) ipv6_tcp;;
# setup namespaces and config, but do not run any tests # setup namespaces and config, but do not run any tests
setup) setup; exit 0;; setup) setup; exit 0;;
......
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