From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: mptcp@lists.linux.dev, Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
Geliang Tang <tanggeliang@kylinos.cn>
Subject: [PATCH net-next v2 05/12] selftests: mptcp: more operations in ns_init/exit
Date: Wed, 06 Mar 2024 10:42:54 +0100 [thread overview]
Message-ID: <20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-5-bc79e6e5e6a0@kernel.org> (raw)
In-Reply-To: <20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-0-bc79e6e5e6a0@kernel.org>
From: Geliang Tang <tanggeliang@kylinos.cn>
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>
---
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 4 ----
tools/testing/selftests/net/mptcp/mptcp_join.sh | 7 -------
tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++++
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 7 -------
tools/testing/selftests/net/mptcp/pm_netlink.sh | 1 -
tools/testing/selftests/net/mptcp/simult_flows.sh | 4 ----
tools/testing/selftests/net/mptcp/userspace_pm.sh | 1 -
7 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 92f6260ba9f3..b53ae64ec08c 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -136,10 +136,6 @@ cleanup()
rm -f "$sin" "$sout"
rm -f "$capout"
- local netns
- for netns in "$ns1" "$ns2" "$ns3" "$ns4";do
- rm -f /tmp/$netns.{nstat,out}
- done
mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}" "${ns4}"
}
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 612470244c58..2d9cf6f3bbf3 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -90,10 +90,7 @@ init_partial()
local netns
for netns in "$ns1" "$ns2"; do
- ip netns exec $netns sysctl -q net.mptcp.enabled=1
ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true
- 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
if $checksum; then
ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1
fi
@@ -138,10 +135,6 @@ cleanup_partial()
{
rm -f "$capout"
- local netns
- for netns in "$ns1" "$ns2"; do
- rm -f /tmp/$netns.{nstat,out}
- done
mptcp_lib_ns_exit "${ns1}" "${ns2}"
}
diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
index 17d609368603..5f44a4ebd185 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
@@ -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
}
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
index 5fa5fa8cab71..7dd0e5467d35 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
@@ -40,13 +40,6 @@ init()
{
mptcp_lib_ns_init ns1 ns2 ns_sbox
- local netns
- for netns in "$ns1" "$ns2" "$ns_sbox";do
- 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
-
local i
for i in `seq 1 4`; do
ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2"
diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh
index 30ec0ec3d68f..c7c46152f6fd 100755
--- a/tools/testing/selftests/net/mptcp/pm_netlink.sh
+++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh
@@ -39,7 +39,6 @@ mptcp_lib_check_tools ip
trap cleanup EXIT
mptcp_lib_ns_init ns1
-ip netns exec $ns1 sysctl -q net.mptcp.enabled=1
check()
{
diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh
index 2aeebb80da07..5a4b83cdaaa9 100755
--- a/tools/testing/selftests/net/mptcp/simult_flows.sh
+++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
@@ -61,10 +61,6 @@ setup()
trap cleanup EXIT
mptcp_lib_ns_init ns1 ns2 ns3
- for i in "$ns1" "$ns2" "$ns3";do
- ip netns exec $i sysctl -q net.ipv4.conf.all.rp_filter=0
- ip netns exec $i sysctl -q net.ipv4.conf.default.rp_filter=0
- done
ip link add ns1eth1 netns "$ns1" type veth peer name ns2eth1 netns "$ns2"
ip link add ns1eth2 netns "$ns1" type veth peer name ns2eth2 netns "$ns2"
diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
index e3092696d2de..6d71bf36a1b9 100755
--- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
+++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
@@ -128,7 +128,6 @@ trap cleanup EXIT
# Create and configure network namespaces for testing
mptcp_lib_ns_init ns1 ns2
for i in "$ns1" "$ns2" ;do
- ip netns exec "$i" sysctl -q net.mptcp.enabled=1
ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
done
--
2.43.0
next prev parent reply other threads:[~2024-03-06 9:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 9:42 [PATCH net-next v2 00/12] selftests: mptcp: share code and fix shellcheck warnings Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 01/12] selftests: mptcp: stop forcing iptables-legacy Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 02/12] selftests: mptcp: add mptcp_lib_check_tools helper Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 03/12] selftests: mptcp: add local variables rndh Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 04/12] selftests: mptcp: add mptcp_lib_ns_init/exit helpers Matthieu Baerts (NGI0)
2024-03-06 9:42 ` Matthieu Baerts (NGI0) [this message]
2024-03-06 9:42 ` [PATCH net-next v2 06/12] selftests: mptcp: add mptcp_lib_events helper Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 07/12] selftests: mptcp: diag: fix shellcheck warnings Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 08/12] selftests: mptcp: connect: " Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 09/12] selftests: mptcp: sockopt: " Matthieu Baerts (NGI0)
2024-03-06 9:42 ` [PATCH net-next v2 10/12] selftests: mptcp: pm netlink: " Matthieu Baerts (NGI0)
2024-03-06 9:43 ` [PATCH net-next v2 11/12] selftests: mptcp: simult flows: " Matthieu Baerts (NGI0)
2024-03-06 9:43 ` [PATCH net-next v2 12/12] selftests: userspace pm: avoid relaunching pm events Matthieu Baerts (NGI0)
2024-03-08 5:10 ` [PATCH net-next v2 00/12] selftests: mptcp: share code and fix shellcheck warnings patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-5-bc79e6e5e6a0@kernel.org \
--to=matttbe@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=tanggeliang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).