selftests: mptcp: join: helper to filter TCP
This is more readable and reduces duplicated commands. This might also be useful to add v6 support and switch to nftables. Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Родитель
39aab88242
Коммит
3469d72f13
|
@ -561,6 +561,15 @@ pm_nl_check_endpoint()
|
|||
fi
|
||||
}
|
||||
|
||||
filter_tcp_from()
|
||||
{
|
||||
local ns="${1}"
|
||||
local src="${2}"
|
||||
local target="${3}"
|
||||
|
||||
ip netns exec "${ns}" iptables -A INPUT -s "${src}" -p tcp -j "${target}"
|
||||
}
|
||||
|
||||
do_transfer()
|
||||
{
|
||||
listener_ns="$1"
|
||||
|
@ -1519,7 +1528,7 @@ subflows_error_tests()
|
|||
pm_nl_set_limits $ns2 0 2
|
||||
pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
|
||||
pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
|
||||
ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j REJECT
|
||||
filter_tcp_from $ns1 10.0.3.2 REJECT
|
||||
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
|
||||
chk_join_nr 1 1 1
|
||||
fi
|
||||
|
@ -1530,7 +1539,7 @@ subflows_error_tests()
|
|||
pm_nl_set_limits $ns2 0 2
|
||||
pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
|
||||
pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
|
||||
ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j DROP
|
||||
filter_tcp_from $ns1 10.0.3.2 DROP
|
||||
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
|
||||
chk_join_nr 1 1 1
|
||||
fi
|
||||
|
@ -1542,7 +1551,7 @@ subflows_error_tests()
|
|||
pm_nl_set_limits $ns1 0 1
|
||||
pm_nl_set_limits $ns2 0 1
|
||||
pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
|
||||
ip netns exec $ns1 iptables -A INPUT -s 10.0.3.2 -p tcp -j REJECT
|
||||
filter_tcp_from $ns1 10.0.3.2 REJECT
|
||||
run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow &
|
||||
|
||||
# mpj subflow will be in TW after the reset
|
||||
|
|
Загрузка…
Ссылка в новой задаче