-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: mptcp: Support for mptcp_sock and is_mptcp #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Master branch: e1a34e1 |
|
Master branch: 0ed6ff5 |
90cd18c to
f5ae0c2
Compare
0ed6ff5 to
9d87e41
Compare
|
Master branch: 9d87e41 |
f5ae0c2 to
9838c59
Compare
|
Master branch: 920fd5e |
9838c59 to
111562d
Compare
|
Master branch: 6a12b8e |
111562d to
6a068a5
Compare
|
Master branch: b71a2eb |
6a068a5 to
5e4a565
Compare
|
Master branch: e8c5e1a |
5e4a565 to
4c46809
Compare
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]>
|
Master branch: fd0493a |
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]>
4c46809 to
9de46d8
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=633936 expired. Closing PR. |
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