Skip to content

bpf: Add bpf_ksock_sendto() kfunc

Mahe Tardy bpf netdev 1 version Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 4 repliesApplied 3/3

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: add bpf_ksock_sendto() kfuncnet/core/bpf_ksock.c+69 -274 repliesApplied
2/3selftests/bpf: Test ksock sendto()tools/testing/selftests/bpf/prog_tests/ksock_sendto.c tools/testing/selftests/bpf/progs/ksock_common.h tools/testing/selftests/bpf/progs/ksock_sendto.c+169 -00 repliesApplied
3/3selftests/bpf: Test forbidden bpf_ksock_sendto() LSM attachtools/testing/selftests/bpf/progs/ksock_lsm_verifier.c+24 -10 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/3] bpf: Add bpf_ksock_sendto() kfunc

This patch series improves the bpf_ksock infrastructure in line with the work proposed during Prague Plumbers 2026 presentation[^1] by adding the bpf_ksock_sendto() kfunc to complement the bpf_ksock_send().

This is useful when using ksock to reply to differents peers while reusing the same UDP socket and generally works toward the goal of ksock to support the basic socket operations.

[^1]: https://lpc.events/event/20/contributions/2430/

v2 updates:
- remove the LSM verifier filter refinements (alexei)
- remove allowing calling connect() from the send path (alexei)
- change order of the tests patches for signature definition (sashiko)

v1: https://lore.kernel.org/bpf/[email protected]/

Mahe Tardy (3):
bpf: add bpf_ksock_sendto() kfunc
selftests/bpf: Test ksock sendto()
selftests/bpf: Test forbidden bpf_ksock_sendto() LSM attach

 net/core/bpf_ksock.c                          |  96 +++++++++++-----
 .../selftests/bpf/prog_tests/ksock_sendto.c   | 108 ++++++++++++++++++
 .../selftests/bpf/progs/ksock_common.h        |   2 +
 .../selftests/bpf/progs/ksock_lsm_verifier.c  |  25 +++-
 .../selftests/bpf/progs/ksock_sendto.c        |  59 ++++++++++
 5 files changed, 262 insertions(+), 28 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/ksock_sendto.c
 create mode 100644 tools/testing/selftests/bpf/progs/ksock_sendto.c

--
2.43.0