bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] bpf-next: Introduced to support the ULP to get or set sockets
@ 2025-02-10 13:45 zhangmingyi
  2025-02-10 13:45 ` [PATCH v2 1/2] " zhangmingyi
  2025-02-10 13:45 ` [PATCH v2 2/2] bpf-next: selftest for TCP_ULP in bpf_setsockopt zhangmingyi
  0 siblings, 2 replies; 11+ messages in thread
From: zhangmingyi @ 2025-02-10 13:45 UTC (permalink / raw)
  To: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa
  Cc: bpf, linux-kernel, yanan, wuchangye, xiesongyang, liuxin350,
	liwei883, tianmuyang, zhangmingyi5

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:
- 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/

Mingyi Zhang (2):
  bpf-next: Introduced to support the ULP to get or set sockets
  bpf-next: 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 +-
 .../bpf/prog_tests/setget_sockopt_tcp_ulp.c   | 78 +++++++++++++++++++
 .../bpf/progs/setget_sockopt_tcp_ulp.c        | 33 ++++++++
 7 files changed, 130 insertions(+), 16 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/setget_sockopt_tcp_ulp.c
 create mode 100644 tools/testing/selftests/bpf/progs/setget_sockopt_tcp_ulp.c

-- 
2.43.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-02-28  6:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 13:45 [PATCH v2 0/2] bpf-next: Introduced to support the ULP to get or set sockets zhangmingyi
2025-02-10 13:45 ` [PATCH v2 1/2] " zhangmingyi
2025-02-13 23:17   ` Martin KaFai Lau
2025-02-14  2:13   ` kernel test robot
2025-02-14  6:23     ` Martin KaFai Lau
2025-02-14 21:20       ` Jakub Kicinski
2025-02-14 22:11         ` Martin KaFai Lau
2025-02-10 13:45 ` [PATCH v2 2/2] bpf-next: selftest for TCP_ULP in bpf_setsockopt zhangmingyi
2025-02-13 23:19   ` Martin KaFai Lau
2025-02-28  6:44     ` zhangmingyi
2025-02-14 17:44   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).