* [PATCH net v5 1/3] mptcp: disallow MPTCP subflows from sockmap
2025-11-11 6:02 [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Jiayuan Chen
@ 2025-11-11 6:02 ` Jiayuan Chen
2025-11-11 6:02 ` [PATCH net v5 2/3] net,mptcp: fix proto fallback detection with BPF Jiayuan Chen
` (3 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Jiayuan Chen @ 2025-11-11 6:02 UTC (permalink / raw)
To: mptcp
Cc: Jiayuan Chen, stable, Matthieu Baerts, Mat Martineau,
Geliang Tang, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Andrii Nakryiko, Eduard Zingerman,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Peter Krystad, Christoph Paasch,
Florian Westphal, linux-kernel, netdev, bpf, linux-kselftest
The sockmap feature allows bpf syscall from userspace, or based on bpf
sockops, replacing the sk_prot of sockets during protocol stack processing
with sockmap's custom read/write interfaces.
'''
tcp_rcv_state_process()
subflow_syn_recv_sock()
tcp_init_transfer(BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB)
bpf_skops_established <== sockops
bpf_sock_map_update(sk) <== call bpf helper
tcp_bpf_update_proto() <== update sk_prot
'''
Consider two scenarios:
1. When the server has MPTCP enabled and the client also requests MPTCP,
the sk passed to the BPF program is a subflow sk. Since subflows only
handle partial data, replacing their sk_prot is meaningless and will
cause traffic disruption.
2. When the server has MPTCP enabled but the client sends a TCP SYN
without MPTCP, subflow_syn_recv_sock() performs a fallback on the
subflow, replacing the subflow sk's sk_prot with the native sk_prot.
'''
subflow_ulp_fallback()
subflow_drop_ctx()
mptcp_subflow_ops_undo_override()
'''
Subsequently, accept::mptcp_stream_accept::mptcp_fallback_tcp_ops()
converts the subflow to plain TCP.
For the first case, we should prevent it from being combined with sockmap
by setting sk_prot->psock_update_sk_prot to NULL, which will be blocked by
sockmap's own flow.
For the second case, since subflow_syn_recv_sock() has already restored
sk_prot to native tcp_prot/tcpv6_prot, no further action is needed.
Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/subflow.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index e8325890a322..af707ce0f624 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -2144,6 +2144,10 @@ void __init mptcp_subflow_init(void)
tcp_prot_override = tcp_prot;
tcp_prot_override.release_cb = tcp_release_cb_override;
tcp_prot_override.diag_destroy = tcp_abort_override;
+#ifdef CONFIG_BPF_SYSCALL
+ /* Disable sockmap processing for subflows */
+ tcp_prot_override.psock_update_sk_prot = NULL;
+#endif
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
/* In struct mptcp_subflow_request_sock, we assume the TCP request sock
@@ -2180,6 +2184,10 @@ void __init mptcp_subflow_init(void)
tcpv6_prot_override = tcpv6_prot;
tcpv6_prot_override.release_cb = tcp_release_cb_override;
tcpv6_prot_override.diag_destroy = tcp_abort_override;
+#ifdef CONFIG_BPF_SYSCALL
+ /* Disable sockmap processing for subflows */
+ tcpv6_prot_override.psock_update_sk_prot = NULL;
+#endif
#endif
mptcp_diag_subflow_init(&subflow_ulp_ops);
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH net v5 2/3] net,mptcp: fix proto fallback detection with BPF
2025-11-11 6:02 [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Jiayuan Chen
2025-11-11 6:02 ` [PATCH net v5 1/3] mptcp: disallow MPTCP subflows from sockmap Jiayuan Chen
@ 2025-11-11 6:02 ` Jiayuan Chen
2025-11-11 10:35 ` Matthieu Baerts
2025-11-11 6:02 ` [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap Jiayuan Chen
` (2 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Jiayuan Chen @ 2025-11-11 6:02 UTC (permalink / raw)
To: mptcp
Cc: Jiayuan Chen, stable, Jakub Sitnicki, Matthieu Baerts,
Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Peter Krystad, Florian Westphal, Christoph Paasch, linux-kernel,
netdev, bpf, linux-kselftest
The sockmap feature allows bpf syscall from userspace, or based
on bpf sockops, replacing the sk_prot of sockets during protocol stack
processing with sockmap's custom read/write interfaces.
'''
tcp_rcv_state_process()
syn_recv_sock()/subflow_syn_recv_sock()
tcp_init_transfer(BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB)
bpf_skops_established <== sockops
bpf_sock_map_update(sk) <== call bpf helper
tcp_bpf_update_proto() <== update sk_prot
'''
When the server has MPTCP enabled but the client sends a TCP SYN
without MPTCP, subflow_syn_recv_sock() performs a fallback on the
subflow, replacing the subflow sk's sk_prot with the native sk_prot.
'''
subflow_syn_recv_sock()
subflow_ulp_fallback()
subflow_drop_ctx()
mptcp_subflow_ops_undo_override()
'''
Then, this subflow can be normally used by sockmap, which replaces the
native sk_prot with sockmap's custom sk_prot. The issue occurs when the
user executes accept::mptcp_stream_accept::mptcp_fallback_tcp_ops().
Here, it uses sk->sk_prot to compare with the native sk_prot, but this
is incorrect when sockmap is used, as we may incorrectly set
sk->sk_socket->ops.
This fix uses the more generic sk_family for the comparison instead.
Additionally, this also prevents a WARNING from occurring:
result from ./scripts/decode_stacktrace.sh:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 337 at net/mptcp/protocol.c:68 mptcp_stream_accept \
(net/mptcp/protocol.c:4005)
Modules linked in:
...
PKRU: 55555554
Call Trace:
<TASK>
do_accept (net/socket.c:1989)
__sys_accept4 (net/socket.c:2028 net/socket.c:2057)
__x64_sys_accept (net/socket.c:2067)
x64_sys_call (arch/x86/entry/syscall_64.c:41)
do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
RIP: 0033:0x7f87ac92b83d
---[ end trace 0000000000000000 ]---
Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/protocol.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 2d6b8de35c44..90b4aeca2596 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -61,11 +61,13 @@ static u64 mptcp_wnd_end(const struct mptcp_sock *msk)
static const struct proto_ops *mptcp_fallback_tcp_ops(const struct sock *sk)
{
+ unsigned short family = READ_ONCE(sk->sk_family);
+
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
- if (sk->sk_prot == &tcpv6_prot)
+ if (family == AF_INET6)
return &inet6_stream_ops;
#endif
- WARN_ON_ONCE(sk->sk_prot != &tcp_prot);
+ WARN_ON_ONCE(family != AF_INET);
return &inet_stream_ops;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH net v5 2/3] net,mptcp: fix proto fallback detection with BPF
2025-11-11 6:02 ` [PATCH net v5 2/3] net,mptcp: fix proto fallback detection with BPF Jiayuan Chen
@ 2025-11-11 10:35 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2025-11-11 10:35 UTC (permalink / raw)
To: Jiayuan Chen, mptcp
Cc: stable, Jakub Sitnicki, Mat Martineau, Geliang Tang,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Peter Krystad, Florian Westphal,
Christoph Paasch, linux-kernel, netdev, bpf, linux-kselftest
Hi Jiayuan,
On 11/11/2025 07:02, Jiayuan Chen wrote:
> The sockmap feature allows bpf syscall from userspace, or based
> on bpf sockops, replacing the sk_prot of sockets during protocol stack
> processing with sockmap's custom read/write interfaces.
> '''
> tcp_rcv_state_process()
> syn_recv_sock()/subflow_syn_recv_sock()
> tcp_init_transfer(BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB)
> bpf_skops_established <== sockops
> bpf_sock_map_update(sk) <== call bpf helper
> tcp_bpf_update_proto() <== update sk_prot
> '''
>
> When the server has MPTCP enabled but the client sends a TCP SYN
> without MPTCP, subflow_syn_recv_sock() performs a fallback on the
> subflow, replacing the subflow sk's sk_prot with the native sk_prot.
> '''
> subflow_syn_recv_sock()
> subflow_ulp_fallback()
> subflow_drop_ctx()
> mptcp_subflow_ops_undo_override()
> '''
>
> Then, this subflow can be normally used by sockmap, which replaces the
> native sk_prot with sockmap's custom sk_prot. The issue occurs when the
> user executes accept::mptcp_stream_accept::mptcp_fallback_tcp_ops().
> Here, it uses sk->sk_prot to compare with the native sk_prot, but this
> is incorrect when sockmap is used, as we may incorrectly set
> sk->sk_socket->ops.
>
> This fix uses the more generic sk_family for the comparison instead.
>
> Additionally, this also prevents a WARNING from occurring:
>
> result from ./scripts/decode_stacktrace.sh:
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 337 at net/mptcp/protocol.c:68 mptcp_stream_accept \
> (net/mptcp/protocol.c:4005)
> Modules linked in:
> ...
>
> PKRU: 55555554
> Call Trace:
> <TASK>
> do_accept (net/socket.c:1989)
> __sys_accept4 (net/socket.c:2028 net/socket.c:2057)
> __x64_sys_accept (net/socket.c:2067)
> x64_sys_call (arch/x86/entry/syscall_64.c:41)
> do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
> entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
> RIP: 0033:0x7f87ac92b83d
>
> ---[ end trace 0000000000000000 ]---
>
> Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections")
The previous Fixes tag you used in the previous versions was correct for
this second patch:
Fixes: 0b4f33def7bb ("mptcp: fix tcp fallback crash")
But well, in terms of backports, that will be the same. So I guess we
don't need a new version just for that.
Also, I guess you missed my comments from the two previous versions:
> please remove the 'net,' prefix from the title. And maybe good
> to mention 'sockmap', e.g.
>
> mptcp: fix proto fallback detection with sockmap
But same here, fine like that.
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
For next time: the Signed-off-by of the sender should be at the end. So
here, your SoB should go to the end, after the already sent RvB tags.
But again, I don't think we need a v6 for that, except if net
maintainers prefer to.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap
2025-11-11 6:02 [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Jiayuan Chen
2025-11-11 6:02 ` [PATCH net v5 1/3] mptcp: disallow MPTCP subflows from sockmap Jiayuan Chen
2025-11-11 6:02 ` [PATCH net v5 2/3] net,mptcp: fix proto fallback detection with BPF Jiayuan Chen
@ 2025-11-11 6:02 ` Jiayuan Chen
2025-11-11 10:35 ` Matthieu Baerts
2025-11-13 21:48 ` Martin KaFai Lau
2025-11-11 10:35 ` [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Matthieu Baerts
2025-11-13 21:40 ` patchwork-bot+netdevbpf
4 siblings, 2 replies; 13+ messages in thread
From: Jiayuan Chen @ 2025-11-11 6:02 UTC (permalink / raw)
To: mptcp
Cc: Jiayuan Chen, Matthieu Baerts, Mat Martineau, Geliang Tang,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Florian Westphal,
Christoph Paasch, Peter Krystad, linux-kernel, netdev, bpf,
linux-kselftest
Add test cases to verify that when MPTCP falls back to plain TCP sockets,
they can properly work with sockmap.
Additionally, add test cases to ensure that sockmap correctly rejects
MPTCP sockets as expected.
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
---
.../testing/selftests/bpf/prog_tests/mptcp.c | 141 ++++++++++++++++++
.../selftests/bpf/progs/mptcp_sockmap.c | 43 ++++++
2 files changed, 184 insertions(+)
create mode 100644 tools/testing/selftests/bpf/progs/mptcp_sockmap.c
diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index f8eb7f9d4fd2..b976fe626343 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -6,11 +6,14 @@
#include <netinet/in.h>
#include <test_progs.h>
#include <unistd.h>
+#include <error.h>
#include "cgroup_helpers.h"
#include "network_helpers.h"
+#include "socket_helpers.h"
#include "mptcp_sock.skel.h"
#include "mptcpify.skel.h"
#include "mptcp_subflow.skel.h"
+#include "mptcp_sockmap.skel.h"
#define NS_TEST "mptcp_ns"
#define ADDR_1 "10.0.1.1"
@@ -436,6 +439,142 @@ static void test_subflow(void)
close(cgroup_fd);
}
+/* Test sockmap on MPTCP server handling non-mp-capable clients. */
+static void test_sockmap_with_mptcp_fallback(struct mptcp_sockmap *skel)
+{
+ int listen_fd = -1, client_fd1 = -1, client_fd2 = -1;
+ int server_fd1 = -1, server_fd2 = -1, sent, recvd;
+ char snd[9] = "123456789";
+ char rcv[10];
+
+ /* start server with MPTCP enabled */
+ listen_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
+ if (!ASSERT_OK_FD(listen_fd, "sockmap-fb:start_mptcp_server"))
+ return;
+
+ skel->bss->trace_port = ntohs(get_socket_local_port(listen_fd));
+ skel->bss->sk_index = 0;
+ /* create client without MPTCP enabled */
+ client_fd1 = connect_to_fd_opts(listen_fd, NULL);
+ if (!ASSERT_OK_FD(client_fd1, "sockmap-fb:connect_to_fd"))
+ goto end;
+
+ server_fd1 = xaccept_nonblock(listen_fd, NULL, NULL);
+ skel->bss->sk_index = 1;
+ client_fd2 = connect_to_fd_opts(listen_fd, NULL);
+ if (!ASSERT_OK_FD(client_fd2, "sockmap-fb:connect_to_fd"))
+ goto end;
+
+ server_fd2 = xaccept_nonblock(listen_fd, NULL, NULL);
+ /* test normal redirect behavior: data sent by client_fd1 can be
+ * received by client_fd2
+ */
+ skel->bss->redirect_idx = 1;
+ sent = xsend(client_fd1, snd, sizeof(snd), 0);
+ if (!ASSERT_EQ(sent, sizeof(snd), "sockmap-fb:xsend(client_fd1)"))
+ goto end;
+
+ /* try to recv more bytes to avoid truncation check */
+ recvd = recv_timeout(client_fd2, rcv, sizeof(rcv), MSG_DONTWAIT, 2);
+ if (!ASSERT_EQ(recvd, sizeof(snd), "sockmap-fb:recv(client_fd2)"))
+ goto end;
+
+end:
+ if (client_fd1 >= 0)
+ close(client_fd1);
+ if (client_fd2 >= 0)
+ close(client_fd2);
+ if (server_fd1 >= 0)
+ close(server_fd1);
+ if (server_fd2 >= 0)
+ close(server_fd2);
+ close(listen_fd);
+}
+
+/* Test sockmap rejection of MPTCP sockets - both server and client sides. */
+static void test_sockmap_reject_mptcp(struct mptcp_sockmap *skel)
+{
+ int listen_fd = -1, server_fd = -1, client_fd1 = -1;
+ int err, zero = 0;
+
+ /* start server with MPTCP enabled */
+ listen_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
+ if (!ASSERT_OK_FD(listen_fd, "start_mptcp_server"))
+ return;
+
+ skel->bss->trace_port = ntohs(get_socket_local_port(listen_fd));
+ skel->bss->sk_index = 0;
+ /* create client with MPTCP enabled */
+ client_fd1 = connect_to_fd(listen_fd, 0);
+ if (!ASSERT_OK_FD(client_fd1, "connect_to_fd client_fd1"))
+ goto end;
+
+ /* bpf_sock_map_update() called from sockops should reject MPTCP sk */
+ if (!ASSERT_EQ(skel->bss->helper_ret, -EOPNOTSUPP, "should reject"))
+ goto end;
+
+ server_fd = xaccept_nonblock(listen_fd, NULL, NULL);
+ err = bpf_map_update_elem(bpf_map__fd(skel->maps.sock_map),
+ &zero, &server_fd, BPF_NOEXIST);
+ if (!ASSERT_EQ(err, -EOPNOTSUPP, "server should be disallowed"))
+ goto end;
+
+ /* MPTCP client should also be disallowed */
+ err = bpf_map_update_elem(bpf_map__fd(skel->maps.sock_map),
+ &zero, &client_fd1, BPF_NOEXIST);
+ if (!ASSERT_EQ(err, -EOPNOTSUPP, "client should be disallowed"))
+ goto end;
+end:
+ if (client_fd1 >= 0)
+ close(client_fd1);
+ if (server_fd >= 0)
+ close(server_fd);
+ close(listen_fd);
+}
+
+static void test_mptcp_sockmap(void)
+{
+ struct mptcp_sockmap *skel;
+ struct netns_obj *netns;
+ int cgroup_fd, err;
+
+ cgroup_fd = test__join_cgroup("/mptcp_sockmap");
+ if (!ASSERT_OK_FD(cgroup_fd, "join_cgroup: mptcp_sockmap"))
+ return;
+
+ skel = mptcp_sockmap__open_and_load();
+ if (!ASSERT_OK_PTR(skel, "skel_open_load: mptcp_sockmap"))
+ goto close_cgroup;
+
+ skel->links.mptcp_sockmap_inject =
+ bpf_program__attach_cgroup(skel->progs.mptcp_sockmap_inject, cgroup_fd);
+ if (!ASSERT_OK_PTR(skel->links.mptcp_sockmap_inject, "attach sockmap"))
+ goto skel_destroy;
+
+ err = bpf_prog_attach(bpf_program__fd(skel->progs.mptcp_sockmap_redirect),
+ bpf_map__fd(skel->maps.sock_map),
+ BPF_SK_SKB_STREAM_VERDICT, 0);
+ if (!ASSERT_OK(err, "bpf_prog_attach stream verdict"))
+ goto skel_destroy;
+
+ netns = netns_new(NS_TEST, true);
+ if (!ASSERT_OK_PTR(netns, "netns_new: mptcp_sockmap"))
+ goto skel_destroy;
+
+ if (endpoint_init("subflow") < 0)
+ goto close_netns;
+
+ test_sockmap_with_mptcp_fallback(skel);
+ test_sockmap_reject_mptcp(skel);
+
+close_netns:
+ netns_free(netns);
+skel_destroy:
+ mptcp_sockmap__destroy(skel);
+close_cgroup:
+ close(cgroup_fd);
+}
+
void test_mptcp(void)
{
if (test__start_subtest("base"))
@@ -444,4 +583,6 @@ void test_mptcp(void)
test_mptcpify();
if (test__start_subtest("subflow"))
test_subflow();
+ if (test__start_subtest("sockmap"))
+ test_mptcp_sockmap();
}
diff --git a/tools/testing/selftests/bpf/progs/mptcp_sockmap.c b/tools/testing/selftests/bpf/progs/mptcp_sockmap.c
new file mode 100644
index 000000000000..d4eef0cbadb9
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/mptcp_sockmap.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include "bpf_tracing_net.h"
+
+char _license[] SEC("license") = "GPL";
+
+int sk_index;
+int redirect_idx;
+int trace_port;
+int helper_ret;
+struct {
+ __uint(type, BPF_MAP_TYPE_SOCKMAP);
+ __uint(key_size, sizeof(__u32));
+ __uint(value_size, sizeof(__u32));
+ __uint(max_entries, 100);
+} sock_map SEC(".maps");
+
+SEC("sockops")
+int mptcp_sockmap_inject(struct bpf_sock_ops *skops)
+{
+ struct bpf_sock *sk;
+
+ /* only accept specified connection */
+ if (skops->local_port != trace_port ||
+ skops->op != BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB)
+ return 1;
+
+ sk = skops->sk;
+ if (!sk)
+ return 1;
+
+ /* update sk handler */
+ helper_ret = bpf_sock_map_update(skops, &sock_map, &sk_index, BPF_NOEXIST);
+
+ return 1;
+}
+
+SEC("sk_skb/stream_verdict")
+int mptcp_sockmap_redirect(struct __sk_buff *skb)
+{
+ /* redirect skb to the sk under sock_map[redirect_idx] */
+ return bpf_sk_redirect_map(skb, &sock_map, redirect_idx, 0);
+}
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap
2025-11-11 6:02 ` [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap Jiayuan Chen
@ 2025-11-11 10:35 ` Matthieu Baerts
2025-11-13 21:48 ` Martin KaFai Lau
1 sibling, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2025-11-11 10:35 UTC (permalink / raw)
To: Jiayuan Chen, mptcp
Cc: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Florian Westphal, Christoph Paasch, Peter Krystad, linux-kernel,
netdev, bpf, linux-kselftest
Hi Jiayuan,
On 11/11/2025 07:02, Jiayuan Chen wrote:
> Add test cases to verify that when MPTCP falls back to plain TCP sockets,
> they can properly work with sockmap.
>
> Additionally, add test cases to ensure that sockmap correctly rejects
> MPTCP sockets as expected.
Thank you for the v5.
Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap
2025-11-11 6:02 ` [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap Jiayuan Chen
2025-11-11 10:35 ` Matthieu Baerts
@ 2025-11-13 21:48 ` Martin KaFai Lau
2025-11-14 1:36 ` Jiayuan Chen
2025-11-14 10:00 ` Matthieu Baerts
1 sibling, 2 replies; 13+ messages in thread
From: Martin KaFai Lau @ 2025-11-13 21:48 UTC (permalink / raw)
To: Jiayuan Chen, Matthieu Baerts
Cc: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Florian Westphal,
Christoph Paasch, Peter Krystad, linux-kernel, netdev, bpf,
linux-kselftest
> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index f8eb7f9d4fd2..b976fe626343 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> @@ -6,11 +6,14 @@
> #include <netinet/in.h>
> #include <test_progs.h>
> #include <unistd.h>
> +#include <error.h>
I changed to errno.h to be specific. I think you only need the values of
an errno here.
> #include "cgroup_helpers.h"
> #include "network_helpers.h"
> +#include "socket_helpers.h"
> #include "mptcp_sock.skel.h"
> #include "mptcpify.skel.h"
> #include "mptcp_subflow.skel.h"
> +#include "mptcp_sockmap.skel.h"
>
> #define NS_TEST "mptcp_ns"
> #define ADDR_1 "10.0.1.1"
> @@ -436,6 +439,142 @@ static void test_subflow(void)
> close(cgroup_fd);
> }
>
> +/* Test sockmap on MPTCP server handling non-mp-capable clients. */
> +static void test_sockmap_with_mptcp_fallback(struct mptcp_sockmap *skel)
> +{
> + int listen_fd = -1, client_fd1 = -1, client_fd2 = -1;
> + int server_fd1 = -1, server_fd2 = -1, sent, recvd;
> + char snd[9] = "123456789";
> + char rcv[10];
> +
> + /* start server with MPTCP enabled */
> + listen_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
> + if (!ASSERT_OK_FD(listen_fd, "sockmap-fb:start_mptcp_server"))
> + return;
> +
> + skel->bss->trace_port = ntohs(get_socket_local_port(listen_fd));
> + skel->bss->sk_index = 0;
> + /* create client without MPTCP enabled */
> + client_fd1 = connect_to_fd_opts(listen_fd, NULL);
> + if (!ASSERT_OK_FD(client_fd1, "sockmap-fb:connect_to_fd"))
> + goto end;
> +
> + server_fd1 = xaccept_nonblock(listen_fd, NULL, NULL);
> + skel->bss->sk_index = 1;
> + client_fd2 = connect_to_fd_opts(listen_fd, NULL);
> + if (!ASSERT_OK_FD(client_fd2, "sockmap-fb:connect_to_fd"))
> + goto end;
> +
> + server_fd2 = xaccept_nonblock(listen_fd, NULL, NULL);
> + /* test normal redirect behavior: data sent by client_fd1 can be
> + * received by client_fd2
> + */
> + skel->bss->redirect_idx = 1;
> + sent = xsend(client_fd1, snd, sizeof(snd), 0);
> + if (!ASSERT_EQ(sent, sizeof(snd), "sockmap-fb:xsend(client_fd1)"))
> + goto end;
> +
> + /* try to recv more bytes to avoid truncation check */
> + recvd = recv_timeout(client_fd2, rcv, sizeof(rcv), MSG_DONTWAIT, 2);
I removed the socket_helpers.h usage. The _nonblock, _timeout, and
MSG_DONTWAIT are unnecessary. I replaced them with the regular accept,
send, and recv. All fds from network_helpers.c have a default 3s
timeout instead of 30s in xaccept_nonblock. This matches how most of
the selftests/bpf are doing it as well.
I also touched up the commit message in patch 2 based on Matt's comment.
Applied. Thanks.
> + server_fd = xaccept_nonblock(listen_fd, NULL, NULL);
> + err = bpf_map_update_elem(bpf_map__fd(skel->maps.sock_map),
> + &zero, &server_fd, BPF_NOEXIST);
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap
2025-11-13 21:48 ` Martin KaFai Lau
@ 2025-11-14 1:36 ` Jiayuan Chen
2025-11-14 10:00 ` Matthieu Baerts
1 sibling, 0 replies; 13+ messages in thread
From: Jiayuan Chen @ 2025-11-14 1:36 UTC (permalink / raw)
To: Martin KaFai Lau, Matthieu Baerts
Cc: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Florian Westphal,
Christoph Paasch, Peter Krystad, linux-kernel, netdev, bpf,
linux-kselftest
2025/11/14 05:48, "Martin KaFai Lau" <martin.lau@linux.dev mailto:martin.lau@linux.dev?to=%22Martin%20KaFai%20Lau%22%20%3Cmartin.lau%40linux.dev%3E > 写到:
>
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> > index f8eb7f9d4fd2..b976fe626343 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> > @@ -6,11 +6,14 @@
> > #include <netinet/in.h>
> > #include <test_progs.h>
> > #include <unistd.h>
> > +#include <error.h>
> >
> I changed to errno.h to be specific. I think you only need the values of an errno here.
>
> >
> > #include "cgroup_helpers.h"
> > #include "network_helpers.h"
> > +#include "socket_helpers.h"
> > #include "mptcp_sock.skel.h"
> > #include "mptcpify.skel.h"
> > #include "mptcp_subflow.skel.h"
> > +#include "mptcp_sockmap.skel.h"
> > > #define NS_TEST "mptcp_ns"
> > #define ADDR_1 "10.0.1.1"
> > @@ -436,6 +439,142 @@ static void test_subflow(void)
> > close(cgroup_fd);
> > }
> > > +/* Test sockmap on MPTCP server handling non-mp-capable clients. */
> > +static void test_sockmap_with_mptcp_fallback(struct mptcp_sockmap *skel)
> > +{
> > + int listen_fd = -1, client_fd1 = -1, client_fd2 = -1;
> > + int server_fd1 = -1, server_fd2 = -1, sent, recvd;
> > + char snd[9] = "123456789";
> > + char rcv[10];
> > +
> > + /* start server with MPTCP enabled */
> > + listen_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
> > + if (!ASSERT_OK_FD(listen_fd, "sockmap-fb:start_mptcp_server"))
> > + return;
> > +
> > + skel->bss->trace_port = ntohs(get_socket_local_port(listen_fd));
> > + skel->bss->sk_index = 0;
> > + /* create client without MPTCP enabled */
> > + client_fd1 = connect_to_fd_opts(listen_fd, NULL);
> > + if (!ASSERT_OK_FD(client_fd1, "sockmap-fb:connect_to_fd"))
> > + goto end;
> > +
> > + server_fd1 = xaccept_nonblock(listen_fd, NULL, NULL);
> > + skel->bss->sk_index = 1;
> > + client_fd2 = connect_to_fd_opts(listen_fd, NULL);
> > + if (!ASSERT_OK_FD(client_fd2, "sockmap-fb:connect_to_fd"))
> > + goto end;
> > +
> > + server_fd2 = xaccept_nonblock(listen_fd, NULL, NULL);
> > + /* test normal redirect behavior: data sent by client_fd1 can be
> > + * received by client_fd2
> > + */
> > + skel->bss->redirect_idx = 1;
> > + sent = xsend(client_fd1, snd, sizeof(snd), 0);
> > + if (!ASSERT_EQ(sent, sizeof(snd), "sockmap-fb:xsend(client_fd1)"))
> > + goto end;
> > +
> > + /* try to recv more bytes to avoid truncation check */
> > + recvd = recv_timeout(client_fd2, rcv, sizeof(rcv), MSG_DONTWAIT, 2);
> >
> I removed the socket_helpers.h usage. The _nonblock, _timeout, and
> MSG_DONTWAIT are unnecessary. I replaced them with the regular accept,
> send, and recv. All fds from network_helpers.c have a default 3s
> timeout instead of 30s in xaccept_nonblock. This matches how most of
> the selftests/bpf are doing it as well.
>
> I also touched up the commit message in patch 2 based on Matt's comment.
>
> Applied. Thanks.
>
Thanks for the cleanup and applying!
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap
2025-11-13 21:48 ` Martin KaFai Lau
2025-11-14 1:36 ` Jiayuan Chen
@ 2025-11-14 10:00 ` Matthieu Baerts
1 sibling, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2025-11-14 10:00 UTC (permalink / raw)
To: Martin KaFai Lau, Jiayuan Chen
Cc: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Florian Westphal,
Christoph Paasch, Peter Krystad, linux-kernel, netdev, bpf,
linux-kselftest
Hi Martin,
On 13/11/2025 22:48, Martin KaFai Lau wrote:
>> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/
>> testing/selftests/bpf/prog_tests/mptcp.c
>> index f8eb7f9d4fd2..b976fe626343 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
>> @@ -6,11 +6,14 @@
>> #include <netinet/in.h>
>> #include <test_progs.h>
>> #include <unistd.h>
>> +#include <error.h>
>
> I changed to errno.h to be specific. I think you only need the values of
> an errno here.
>> #include "cgroup_helpers.h"
>> #include "network_helpers.h"
>> +#include "socket_helpers.h"
>> #include "mptcp_sock.skel.h"
>> #include "mptcpify.skel.h"
>> #include "mptcp_subflow.skel.h"
>> +#include "mptcp_sockmap.skel.h"
>> #define NS_TEST "mptcp_ns"
>> #define ADDR_1 "10.0.1.1"
>> @@ -436,6 +439,142 @@ static void test_subflow(void)
>> close(cgroup_fd);
>> }
>> +/* Test sockmap on MPTCP server handling non-mp-capable clients. */
>> +static void test_sockmap_with_mptcp_fallback(struct mptcp_sockmap *skel)
>> +{
>> + int listen_fd = -1, client_fd1 = -1, client_fd2 = -1;
>> + int server_fd1 = -1, server_fd2 = -1, sent, recvd;
>> + char snd[9] = "123456789";
>> + char rcv[10];
>> +
>> + /* start server with MPTCP enabled */
>> + listen_fd = start_mptcp_server(AF_INET, NULL, 0, 0);
>> + if (!ASSERT_OK_FD(listen_fd, "sockmap-fb:start_mptcp_server"))
>> + return;
>> +
>> + skel->bss->trace_port = ntohs(get_socket_local_port(listen_fd));
>> + skel->bss->sk_index = 0;
>> + /* create client without MPTCP enabled */
>> + client_fd1 = connect_to_fd_opts(listen_fd, NULL);
>> + if (!ASSERT_OK_FD(client_fd1, "sockmap-fb:connect_to_fd"))
>> + goto end;
>> +
>> + server_fd1 = xaccept_nonblock(listen_fd, NULL, NULL);
>> + skel->bss->sk_index = 1;
>> + client_fd2 = connect_to_fd_opts(listen_fd, NULL);
>> + if (!ASSERT_OK_FD(client_fd2, "sockmap-fb:connect_to_fd"))
>> + goto end;
>> +
>> + server_fd2 = xaccept_nonblock(listen_fd, NULL, NULL);
>> + /* test normal redirect behavior: data sent by client_fd1 can be
>> + * received by client_fd2
>> + */
>> + skel->bss->redirect_idx = 1;
>> + sent = xsend(client_fd1, snd, sizeof(snd), 0);
>> + if (!ASSERT_EQ(sent, sizeof(snd), "sockmap-fb:xsend(client_fd1)"))
>> + goto end;
>> +
>> + /* try to recv more bytes to avoid truncation check */
>> + recvd = recv_timeout(client_fd2, rcv, sizeof(rcv), MSG_DONTWAIT, 2);
>
> I removed the socket_helpers.h usage. The _nonblock, _timeout, and
> MSG_DONTWAIT are unnecessary. I replaced them with the regular accept,
> send, and recv. All fds from network_helpers.c have a default 3s
> timeout instead of 30s in xaccept_nonblock. This matches how most of
> the selftests/bpf are doing it as well.
>
> I also touched up the commit message in patch 2 based on Matt's comment.
Thank you for having applied the patches, and for the modifications you did!
> Applied. Thanks.
>
>> + server_fd = xaccept_nonblock(listen_fd, NULL, NULL);
>> + err = bpf_map_update_elem(bpf_map__fd(skel->maps.sock_map),
>> + &zero, &server_fd, BPF_NOEXIST);
>
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap
2025-11-11 6:02 [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Jiayuan Chen
` (2 preceding siblings ...)
2025-11-11 6:02 ` [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap Jiayuan Chen
@ 2025-11-11 10:35 ` Matthieu Baerts
2025-11-13 2:23 ` Jakub Kicinski
2025-11-13 21:40 ` patchwork-bot+netdevbpf
4 siblings, 1 reply; 13+ messages in thread
From: Matthieu Baerts @ 2025-11-11 10:35 UTC (permalink / raw)
To: Jiayuan Chen, mptcp
Cc: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Christoph Paasch, Florian Westphal, Peter Krystad, linux-kernel,
netdev, bpf, linux-kselftest
Hi net and bpf-net maintainers,
On 11/11/2025 07:02, Jiayuan Chen wrote:
> Overall, we encountered a warning [1] that can be triggered by running the
> selftest I provided.
>
> sockmap works by replacing sk_data_ready, recvmsg, sendmsg operations and
> implementing fast socket-level forwarding logic:
> 1. Users can obtain file descriptors through userspace socket()/accept()
> interfaces, then call BPF syscall to perform these replacements.
> 2. Users can also use the bpf_sock_hash_update helper (in sockops programs)
> to replace handlers when TCP connections enter ESTABLISHED state
> (BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB/BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB)
>
> However, when combined with MPTCP, an issue arises: MPTCP creates subflow
> sk's and performs TCP handshakes, so the BPF program obtains subflow sk's
> and may incorrectly replace their sk_prot. We need to reject such
> operations. In patch 1, we set psock_update_sk_prot to NULL in the
> subflow's custom sk_prot.
>
> Additionally, if the server's listening socket has MPTCP enabled and the
> client's TCP also uses MPTCP, we should allow the combination of subflow
> and sockmap. This is because the latest Golang programs have enabled MPTCP
> for listening sockets by default [2]. For programs already using sockmap,
> upgrading Golang should not cause sockmap functionality to fail.
>
> Patch 2 prevents the WARNING from occurring.
I think this series can be applied directly in 'net', if that's OK for
both of you.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap
2025-11-11 10:35 ` [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Matthieu Baerts
@ 2025-11-13 2:23 ` Jakub Kicinski
2025-11-13 9:12 ` Matthieu Baerts
0 siblings, 1 reply; 13+ messages in thread
From: Jakub Kicinski @ 2025-11-13 2:23 UTC (permalink / raw)
To: Matthieu Baerts
Cc: Jiayuan Chen, mptcp, Mat Martineau, Geliang Tang, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Christoph Paasch, Florian Westphal, Peter Krystad, linux-kernel,
netdev, bpf, linux-kselftest
On Tue, 11 Nov 2025 11:35:04 +0100 Matthieu Baerts wrote:
> I think this series can be applied directly in 'net', if that's OK for
> both of you.
Also no preference here, Martin mentioned he will take it via bpf
tomorrow.
Please let us know on the off chance that you have anything that may
conflict queued up. These will likely need a week of travel before
they reach net in this case.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap
2025-11-13 2:23 ` Jakub Kicinski
@ 2025-11-13 9:12 ` Matthieu Baerts
0 siblings, 0 replies; 13+ messages in thread
From: Matthieu Baerts @ 2025-11-13 9:12 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Jiayuan Chen, mptcp, Mat Martineau, Geliang Tang, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
Christoph Paasch, Florian Westphal, Peter Krystad, linux-kernel,
netdev, bpf, linux-kselftest
Hi Jakub,
On 13/11/2025 03:23, Jakub Kicinski wrote:
> On Tue, 11 Nov 2025 11:35:04 +0100 Matthieu Baerts wrote:
>> I think this series can be applied directly in 'net', if that's OK for
>> both of you.
>
> Also no preference here, Martin mentioned he will take it via bpf
> tomorrow.
>
> Please let us know on the off chance that you have anything that may
> conflict queued up. These will likely need a week of travel before
> they reach net in this case.
No problem for me, this can go to bpf-net first. We don't have pending
patches modifying these parts.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap
2025-11-11 6:02 [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Jiayuan Chen
` (3 preceding siblings ...)
2025-11-11 10:35 ` [PATCH net v5 0/3] mptcp: Fix conflicts between MPTCP and sockmap Matthieu Baerts
@ 2025-11-13 21:40 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 13+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-13 21:40 UTC (permalink / raw)
To: Jiayuan Chen
Cc: mptcp, matttbe, martineau, geliang, davem, edumazet, kuba, pabeni,
horms, ast, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah,
cpaasch, fw, peter.krystad, linux-kernel, netdev, bpf,
linux-kselftest
Hello:
This series was applied to bpf/bpf.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:
On Tue, 11 Nov 2025 14:02:49 +0800 you wrote:
> Overall, we encountered a warning [1] that can be triggered by running the
> selftest I provided.
>
> sockmap works by replacing sk_data_ready, recvmsg, sendmsg operations and
> implementing fast socket-level forwarding logic:
> 1. Users can obtain file descriptors through userspace socket()/accept()
> interfaces, then call BPF syscall to perform these replacements.
> 2. Users can also use the bpf_sock_hash_update helper (in sockops programs)
> to replace handlers when TCP connections enter ESTABLISHED state
> (BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB/BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB)
>
> [...]
Here is the summary with links:
- [net,v5,1/3] mptcp: disallow MPTCP subflows from sockmap
https://git.kernel.org/bpf/bpf/c/fbade4bd08ba
- [net,v5,2/3] net,mptcp: fix proto fallback detection with BPF
https://git.kernel.org/bpf/bpf/c/c77b3b79a92e
- [net,v5,3/3] selftests/bpf: Add mptcp test with sockmap
https://git.kernel.org/bpf/bpf/c/cb730e4ac1b4
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 13+ messages in thread