Commit 6475831
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 <matthieu.baerts@tessares.net> Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net> Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Nicolas Rybowski <nicolas.rybowski@tessares.net> --- include/uapi/linux/bpf.h | 1 + net/core/filter.c | 9 ++++++++- tools/include/uapi/linux/bpf.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)1 parent 34221e8 commit 6475831
3 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4060 | 4060 | | |
4061 | 4061 | | |
4062 | 4062 | | |
| 4063 | + | |
4063 | 4064 | | |
4064 | 4065 | | |
4065 | 4066 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5837 | 5837 | | |
5838 | 5838 | | |
5839 | 5839 | | |
5840 | | - | |
| 5840 | + | |
5841 | 5841 | | |
5842 | 5842 | | |
5843 | 5843 | | |
| |||
5971 | 5971 | | |
5972 | 5972 | | |
5973 | 5973 | | |
| 5974 | + | |
| 5975 | + | |
| 5976 | + | |
| 5977 | + | |
| 5978 | + | |
| 5979 | + | |
| 5980 | + | |
5974 | 5981 | | |
5975 | 5982 | | |
5976 | 5983 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4060 | 4060 | | |
4061 | 4061 | | |
4062 | 4062 | | |
| 4063 | + | |
4063 | 4064 | | |
4064 | 4065 | | |
4065 | 4066 | | |
| |||
0 commit comments