selftests: mptcp: add test-cases for mixed v4/v6 subflows

Note that we can't guess the listener family anymore based on the client
target address: always use IPv6.

The fullmesh flag with endpoints from different families is also
validated here.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Paolo Abeni 2023-01-25 11:47:23 +01:00
parent 7e9740e0e8
commit ad3493746e

View File

@ -774,24 +774,17 @@ do_transfer()
addr_nr_ns2=${addr_nr_ns2:9}
fi
local local_addr
if is_v6 "${connect_addr}"; then
local_addr="::"
else
local_addr="0.0.0.0"
fi
extra_srv_args="$extra_args $extra_srv_args"
if [ "$test_link_fail" -gt 1 ];then
timeout ${timeout_test} \
ip netns exec ${listener_ns} \
./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
$extra_srv_args ${local_addr} < "$sinfail" > "$sout" &
$extra_srv_args "::" < "$sinfail" > "$sout" &
else
timeout ${timeout_test} \
ip netns exec ${listener_ns} \
./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
$extra_srv_args ${local_addr} < "$sin" > "$sout" &
$extra_srv_args "::" < "$sin" > "$sout" &
fi
local spid=$!
@ -2448,6 +2441,47 @@ v4mapped_tests()
fi
}
mixed_tests()
{
if reset "IPv4 sockets do not use IPv6 addresses"; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 1 1
pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
chk_join_nr 0 0 0
fi
# Need an IPv6 mptcp socket to allow subflows of both families
if reset "simult IPv4 and IPv6 subflows"; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 1 1
pm_nl_add_endpoint $ns1 10.0.1.1 flags signal
run_tests $ns1 $ns2 dead:beef:2::1 0 0 0 slow
chk_join_nr 1 1 1
fi
# cross families subflows will not be created even in fullmesh mode
if reset "simult IPv4 and IPv6 subflows, fullmesh 1x1"; then
pm_nl_set_limits $ns1 0 4
pm_nl_set_limits $ns2 1 4
pm_nl_add_endpoint $ns2 dead:beef:2::2 flags subflow,fullmesh
pm_nl_add_endpoint $ns1 10.0.1.1 flags signal
run_tests $ns1 $ns2 dead:beef:2::1 0 0 0 slow
chk_join_nr 1 1 1
fi
# fullmesh still tries to create all the possibly subflows with
# matching family
if reset "simult IPv4 and IPv6 subflows, fullmesh 2x2"; then
pm_nl_set_limits $ns1 0 4
pm_nl_set_limits $ns2 2 4
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal
run_tests $ns1 $ns2 dead:beef:1::1 0 0 fullmesh_1 slow
chk_join_nr 4 4 4
fi
}
backup_tests()
{
# single subflow, backup
@ -3120,6 +3154,7 @@ all_tests_sorted=(
a@add_tests
6@ipv6_tests
4@v4mapped_tests
M@mixed_tests
b@backup_tests
p@add_addr_ports_tests
k@syncookies_tests