Skip to content

Conversation

@kernel-patches-bot
Copy link

Pull request for series with
subject: bpf: mptcp: Support for mptcp_sock and is_mptcp
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936

@kernel-patches-bot
Copy link
Author

Master branch: e1a34e1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 0ed6ff5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 9d87e41
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 920fd5e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 6a12b8e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: b71a2eb
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: e8c5e1a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

Kernel Patches Daemon and others added 5 commits April 22, 2022 15:45
is_mptcp is a field from struct tcp_sock used to indicate that the
current tcp_sock is part of the MPTCP protocol.

In this protocol, a first socket (mptcp_sock) is created with
sk_protocol set to IPPROTO_MPTCP (=262) for control purpose but it
isn't directly on the wire. This is the role of the subflow (kernel)
sockets which are classical tcp_sock with sk_protocol set to
IPPROTO_TCP. The only way to differentiate such sockets from plain TCP
sockets is the is_mptcp field from tcp_sock.

Such an exposure in BPF is thus required to be able to differentiate
plain TCP sockets from MPTCP subflow sockets in BPF_PROG_TYPE_SOCK_OPS
programs.

The choice has been made to silently pass the case when CONFIG_MPTCP is
unset by defaulting is_mptcp to 0 in order to make BPF independent of
the MPTCP configuration. Another solution is to make the verifier fail
in 'bpf_tcp_sock_is_valid_ctx_access' but this will add an additional
'#ifdef CONFIG_MPTCP' in the BPF code and a same injected BPF program
will not run if MPTCP is not set.

An example use-case is provided in
https://github.com/multipath-tcp/mptcp_net-next/tree/scripts/bpf/examples

Suggested-by: Matthieu Baerts <[email protected]>
Acked-by: Matthieu Baerts <[email protected]>
Signed-off-by: Nicolas Rybowski <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
This patch implements a new struct bpf_func_proto, named
bpf_skc_to_mptcp_sock_proto. Define a new bpf_id BTF_SOCK_TYPE_MPTCP,
and a new helper bpf_skc_to_mptcp_sock(), which invokes another new
helper bpf_mptcp_sock_from_subflow() in net/mptcp/bpf.c to get struct
mptcp_sock from a given subflow socket.

Co-developed-by: Nicolas Rybowski <[email protected]>
Signed-off-by: Nicolas Rybowski <[email protected]>
Co-developed-by: Matthieu Baerts <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
This patch adds a base for MPTCP specific tests.

It is currently limited to the is_mptcp field in case of plain TCP
connection because there is no easy way to get the subflow sk from a msk
in userspace. This implies that we cannot lookup the sk_storage attached
to the subflow sk in the sockops program.

Acked-by: Matthieu Baerts <[email protected]>
Co-developed-by: Geliang Tang <[email protected]>
Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Nicolas Rybowski <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
This patch extends the MPTCP test base, to test the new helper
bpf_skc_to_mptcp_sock().

Define struct mptcp_sock in bpf_tcp_helpers.h, use bpf_skc_to_mptcp_sock
to get the msk socket in progs/mptcp_sock.c and store the infos in
socket_storage_map.

Get the infos from socket_storage_map in prog_tests/mptcp.c. Add a new
function verify_msk() to verify the infos of MPTCP socket, and rename
verify_sk() to verify_tsk() to verify TCP socket only.

Acked-by: Matthieu Baerts <[email protected]>
Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
@kernel-patches-bot
Copy link
Author

Master branch: fd0493a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=633936
version: 1

This patch verifies the struct member token of struct mptcp_sock. Add a
new function get_msk_token() to parse the msk token from the output of
the command 'ip mptcp monitor', and verify it in verify_msk().

Acked-by: Matthieu Baerts <[email protected]>
Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
This patch verifies another member of struct mptcp_sock, ca_name. Add a
new function get_msk_ca_name() to read the sysctl tcp_congestion_control
and verify it in verify_msk().

Acked-by: Matthieu Baerts <[email protected]>
Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
This patch verifies the 'first' struct member of struct mptcp_sock, which
points to the first subflow of msk. Save 'sk' in mptcp_storage, and verify
it with 'first' in verify_msk().

Acked-by: Matthieu Baerts <[email protected]>
Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Mat Martineau <[email protected]>
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=633936 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants