[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eb7bc302-8661-229b-f8b9-d5045bffbd19@tessares.net>
Date: Fri, 17 Feb 2023 14:53:24 +0100
From: Matthieu Baerts <matthieu.baerts@...sares.net>
To: Hangbin Liu <liuhangbin@...il.com>, netdev@...r.kernel.org
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Mykola Lysenko <mykolal@...com>,
Felix Maurer <fmaurer@...hat.com>,
MPTCP Upstream <mptcp@...ts.linux.dev>
Subject: Re: [PATCH bpf-next] selftests/bpf: run mptcp in a dedicated netns
Hi Hangbin,
(+cc MPTCP ML)
On 17/02/2023 09:26, Hangbin Liu wrote:
> The current mptcp test is run in init netns. If the user or default
> system config disabled mptcp, the test will fail. Let's run the mptcp
> test in a dedicated netns to avoid none kernel default mptcp setting.
Thank you for the patch!
I just have one request below if you don't mind:
(...)
> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index 59f08d6d1d53..8a4ed9510ec7 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
(...)
> @@ -138,12 +148,20 @@ static int run_test(int cgroup_fd, int server_fd, bool is_mptcp)
>
> static void test_base(void)
> {
> + struct nstoken *nstoken = NULL;
> int server_fd, cgroup_fd;
>
> cgroup_fd = test__join_cgroup("/mptcp");
> if (!ASSERT_GE(cgroup_fd, 0, "test__join_cgroup"))
> return;
>
> + SYS("ip netns add %s", NS_TEST);
> + SYS("ip -net %s link set dev lo up", NS_TEST);
> +
> + nstoken = open_netns(NS_TEST);
> + if (!ASSERT_OK_PTR(nstoken, "open_netns"))
> + goto cmd_fail;
> +
> /* without MPTCP */
> server_fd = start_server(AF_INET, SOCK_STREAM, NULL, 0, 0);
> if (!ASSERT_GE(server_fd, 0, "start_server"))
> @@ -163,6 +181,12 @@ static void test_base(void)
>
> close(server_fd);
>
> +cmd_fail:
> + if (nstoken)
> + close_netns(nstoken);
> +
> + system("ip netns del " NS_TEST " >& /dev/null");
> +
> close_cgroup_fd:
If I'm not mistaken, this label should no longer be needed: after the
modification you did, the only 'goto close_cgroup_fd' used above should
be replaced by 'goto cmd_fail', no?
Apart from that, the rest looks good to me.
Cheers,
Matt
> close(cgroup_fd);
> }
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
Powered by blists - more mailing lists