From: zhangmingyi <zhangmingyi5@huawei.com>
To: <ast@kernel.org>, <daniel@iogearbox.net>, <andrii@kernel.org>,
<martin.lau@linux.dev>, <song@kernel.org>, <yhs@fb.com>,
<john.fastabend@gmail.com>, <kpsingh@kernel.org>,
<sdf@google.com>, <haoluo@google.com>, <jolsa@kernel.org>
Cc: <bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<yanan@huawei.com>, <wuchangye@huawei.com>,
<xiesongyang@huawei.com>, <liuxin350@huawei.com>,
<liwei883@huawei.com>, <tianmuyang@huawei.com>,
<zhangmingyi5@huawei.com>
Subject: [PATCH bpf-next v3 0/2] Introduced to support the ULP to get or set sockets
Date: Fri, 28 Feb 2025 15:06:26 +0800 [thread overview]
Message-ID: <20250228070628.3219087-1-zhangmingyi5@huawei.com> (raw)
From: Mingyi Zhang <zhangmingyi5@huawei.com>
We want call bpf_setsockopt to replace the kernel module in the TCP_ULP
case. The purpose is to customize the behavior in connect and sendmsg
after the user-defined ko file is loaded. We have an open source
community project kmesh (kmesh.net). Based on this, we refer to some
processes of tcp fastopen to implement delayed connet and perform HTTP
DNAT when sendmsg.In this case, we need to parse HTTP packets in the
bpf program and set TCP_ULP for the specified socket.
Note that tcp_getsockopt and tcp_setsockopt support TCP_ULP, while
bpf_getsockopt and bpf_setsockopt do not support TCP_ULP.
I'm not sure why there is such a difference, but I noticed that
tcp_setsockopt is called in bpf_setsockopt.I think we can add the
handling of this case.
Change list:
- v2 -> V3:
- fixed some compilation issues and added TCP_ULP macro
- Move __tcp_set_ulp outside rcu_read_unlock
- v1 -> v2:
- modified the do_tcp_setsockopt(TCP_ULP) process by referring to
section do_tcp_setsockopt(TCP_CONGESTION), avoid sleep
- The selftest case is modified. An independent file is selected
for the test to avoid affecting the original file in setget_sockopt.c
- fixed some formatting errors, such as Signed and Subject
Revisions:
- v1
https://lore.kernel.org/bpf/20250127090724.3168791-1-zhangmingyi5@huawei.com/
- v2
https://lore.kernel.org/bpf/20250210134550.3189616-1-zhangmingyi5@huawei.com/
Mingyi Zhang (2):
Introduced to support the ULP to get or set sockets
selftest for TCP_ULP in bpf_setsockopt
include/net/tcp.h | 2 +-
net/core/filter.c | 1 +
net/ipv4/tcp.c | 2 +-
net/ipv4/tcp_ulp.c | 28 ++++++++--------
net/mptcp/subflow.c | 2 +-
.../selftests/bpf/prog_tests/setget_sockopt.c | 32 +++++++++++++++++++
.../selftests/bpf/progs/bpf_tracing_net.h | 1 +
.../selftests/bpf/progs/setget_sockopt.c | 24 ++++++++++++++
8 files changed, 76 insertions(+), 16 deletions(-)
--
2.43.0
next reply other threads:[~2025-02-28 7:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 7:06 zhangmingyi [this message]
2025-02-28 7:06 ` [PATCH bpf-next v3 1/2] " zhangmingyi
2025-02-28 7:06 ` [PATCH bpf-next v3 2/2] selftest for TCP_ULP in bpf_setsockopt zhangmingyi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250228070628.3219087-1-zhangmingyi5@huawei.com \
--to=zhangmingyi5@huawei.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuxin350@huawei.com \
--cc=liwei883@huawei.com \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=tianmuyang@huawei.com \
--cc=wuchangye@huawei.com \
--cc=xiesongyang@huawei.com \
--cc=yanan@huawei.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®