selftests: mptcp: more operations in ns_init/exit

Set more the default sysctl values in mptcp_lib_ns_init(). It is fine to
do that everywhere, because they could be overridden latter if needed.

mptcp_lib_ns_exit() now also try to remove temp netns files used for the
stats even for selftests not using them. That's fine to do that because
these files have a unique name.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-5-bc79e6e5e6a0@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Geliang Tang
2024-03-06 10:42:54 +01:00
committed by Jakub Kicinski
parent 3a0f9bed3c
commit df8d3ba55b
7 changed files with 4 additions and 24 deletions

View File

@@ -385,6 +385,9 @@ mptcp_lib_ns_init() {
ip netns add "${!netns}" || exit ${KSFT_SKIP}
ip -net "${!netns}" link set lo up
ip netns exec "${!netns}" sysctl -q net.mptcp.enabled=1
ip netns exec "${!netns}" sysctl -q net.ipv4.conf.all.rp_filter=0
ip netns exec "${!netns}" sysctl -q net.ipv4.conf.default.rp_filter=0
done
}
@@ -392,5 +395,6 @@ mptcp_lib_ns_exit() {
local netns
for netns in "${@}"; do
ip netns del "${netns}"
rm -f /tmp/"${netns}".{nstat,out}
done
}