[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3590084f-bc61-b2c7-ed1b-dd4caa85fdcd@linux.dev>
Date: Wed, 16 Aug 2023 11:59:12 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Geliang Tang <geliang.tang@...e.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, mptcp@...ts.linux.dev,
linux-security-module@...r.kernel.org, selinux@...r.kernel.org,
linux-kselftest@...r.kernel.org, Yonghong Song <yonghong.song@...ux.dev>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, 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>,
Florent Revest <revest@...omium.org>, Brendan Jackman
<jackmanb@...omium.org>, Matthieu Baerts <matthieu.baerts@...sares.net>,
Mat Martineau <martineau@...nel.org>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
John Johansen <john.johansen@...onical.com>, Paul Moore
<paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>, Mykola Lysenko <mykolal@...com>,
Shuah Khan <shuah@...nel.org>, Simon Horman <horms@...nel.org>
Subject: Re: [PATCH bpf-next v14 4/4] selftests/bpf: Add mptcpify test
On 8/15/23 6:11 PM, Geliang Tang wrote:
> Implement a new test program mptcpify: if the family is AF_INET or
> AF_INET6, the type is SOCK_STREAM, and the protocol ID is 0 or
> IPPROTO_TCP, set it to IPPROTO_MPTCP. It will be hooked in
> update_socket_protocol().
>
> Extend the MPTCP test base, add a selftest test_mptcpify() for the
> mptcpify case. Open and load the mptcpify test prog to mptcpify the
> TCP sockets dynamically, then use start_server() and connect_to_fd()
> to create a TCP socket, but actually what's created is an MPTCP
> socket, which can be verified through 'getsockopt(SOL_PROTOCOL)'
> and 'getsockopt(MPTCP_INFO)'.
>
> Acked-by: Yonghong Song <yonghong.song@...ux.dev>
> Reviewed-by: Matthieu Baerts <matthieu.baerts@...sares.net>
> Signed-off-by: Geliang Tang <geliang.tang@...e.com>
> ---
> .../testing/selftests/bpf/prog_tests/mptcp.c | 116 ++++++++++++++++++
> tools/testing/selftests/bpf/progs/mptcpify.c | 20 +++
> 2 files changed, 136 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/progs/mptcpify.c
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index 3d3999067e27..68ebf9735e16 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> @@ -2,13 +2,30 @@
> /* Copyright (c) 2020, Tessares SA. */
> /* Copyright (c) 2022, SUSE. */
>
> +#include <linux/mptcp.h>
bpf CI failed
(https://github.com/kernel-patches/bpf/actions/runs/5882006207/job/15951617063):
/tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/mptcp.c:5:10: fatal
error: 'linux/mptcp.h' file not found
#include <linux/mptcp.h>
I fixed that by copying the 'struct mptcp_info' but renamed to 'struct
__mptcp_info' just in case any fallout in the future.
My environment also does not have SOL_MPTCP, so I do an ifndef for it also.
> +#include <netinet/in.h>
> #include <test_progs.h>
> #include "cgroup_helpers.h"
> #include "network_helpers.h"
> #include "mptcp_sock.skel.h"
> +#include "mptcpify.skel.h"
>
> #define NS_TEST "mptcp_ns"
>
> +#ifndef IPPROTO_MPTCP
> +#define IPPROTO_MPTCP 262
> +#endif
> +
> +#ifndef MPTCP_INFO
> +#define MPTCP_INFO 1
> +#endif
> +#ifndef MPTCP_INFO_FLAG_FALLBACK
> +#define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
I have to add '#include <linux/const.h>' for the _BITUL() here also....
The set is applied. Please follow up if I make mistake on those fixes.
Powered by blists - more mailing lists