Skip to content

cgroup/connect{4,6} programs for unprivileged ICMP ping

YiFei Zhu bpf netdev 4 versions – 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 · linked by author and title

  1. v4 Latest3 patches 0 repliesApplied 3/3
  2. v33 patches 2 repliesSuperseded
  3. v23 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches4 repliesSuperseded

Changes in v4 from the cover letter

* Fixed error path to destroy skel in prog_tests/connect_ping.c

Patches in v4 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: Invoke cgroup/connect{4,6} programs for unprivileged ICMP pingnet/ipv4/ping.c net/ipv6/ping.c+31 -00 repliesApplied
2/3selftests/bpf: Deduplicate write_sysctl() to test_progs.ctools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c tools/testing/selftests/bpf/test_progs.c +1 more+18 -400 repliesApplied
3/3selftests/bpf: Ensure cgroup/connect{4,6} programs can bind unpriv ICMP pingtools/testing/selftests/bpf/prog_tests/connect_ping.c tools/testing/selftests/bpf/progs/connect_ping.c+231 -00 repliesApplied

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 bpf-next 0/3] cgroup/connect{4,6} programs for unprivileged ICMP ping

Usually when a TCP/UDP connection is initiated, we can bind the socket to a specific IP attached to an interface in a cgroup/connect hook. But for pings, this is impossible, as the hook is not being called.

This series adds the invocation for cgroup/connect{4,6} programs to unprivileged ICMP ping (i.e. ping sockets created with SOCK_DGRAM IPPROTO_ICMP(V6) as opposed to SOCK_RAW). This also adds a test to verify that the hooks are being called and invoking bpf_bind() from within the hook actually binds the socket.

Patch 1 adds the invocation of the hook. Patch 2 deduplicates write_sysctl in BPF test_progs. Patch 3 adds the tests for this hook.

v1 -> v2:
* Added static to bindaddr_v6 in prog_tests/connect_ping.c
* Deduplicated much of the test logic in prog_tests/connect_ping.c
* Deduplicated write_sysctl() to test_progs.c

v2 -> v3:
* Renamed variable "obj" to "skel" for the BPF skeleton object in prog_tests/connect_ping.c

v3 -> v4:
* Fixed error path to destroy skel in prog_tests/connect_ping.c

YiFei Zhu (3):
bpf: Invoke cgroup/connect{4,6} programs for unprivileged ICMP ping selftests/bpf: Deduplicate write_sysctl() to test_progs.c selftests/bpf: Ensure cgroup/connect{4,6} programs can bind unpriv
ICMP ping

 net/ipv4/ping.c                               |  15 ++
 net/ipv6/ping.c                               |  16 ++
 .../bpf/prog_tests/btf_skc_cls_ingress.c      |  20 --
 .../selftests/bpf/prog_tests/connect_ping.c   | 178 ++++++++++++++++++
 .../bpf/prog_tests/tcp_hdr_options.c          |  20 --
 .../selftests/bpf/progs/connect_ping.c        |  53 ++++++
 tools/testing/selftests/bpf/test_progs.c      |  17 ++
 tools/testing/selftests/bpf/test_progs.h      |   1 +
 8 files changed, 280 insertions(+), 40 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/connect_ping.c
 create mode 100644 tools/testing/selftests/bpf/progs/connect_ping.c
Signature · 1 line
2.37.2.789.g6183377224-goog