Skip to content

libbpf: add netfilter link attach helper

Florian Westphal bpf netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 1 replyIn review
  2. v32 patches 1 replySuperseded
  3. v12 patches 2 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2tools: libbpf: add netfilter link attach helpertools/lib/bpf/bpf.c tools/lib/bpf/bpf.h tools/lib/bpf/libbpf.c +2 more+70 -01 reply
2/2selftests/bpf: Add bpf_program__attach_netfilter helper testtools/testing/selftests/bpf/prog_tests/netfilter_link_attach.c tools/testing/selftests/bpf/progs/test_netfilter_link_attach.c+100 -00 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH bpf-next v4 0/2] libbpf: add netfilter link attach helper

v4: address comment from Daniel Xu:
- use human-readable test names in 2/2

v3: address comments from Andrii:
- prune verbose error message in 1/2
- use bpf_link_create internally in 1/2
- use subtests in patch 2/2

When initial netfilter bpf program type support got added one suggestion was to extend libbpf with a helper to ease attachment of nf programs to the hook locations.

Add such a helper and a demo test case that attaches a dummy program to various combinations.

I tested that the selftest fails when changing the expected outcome (i.e., set 'success' when it should fail and v.v.).

Florian Westphal (2):
tools: libbpf: add netfilter link attach helper selftests/bpf: Add bpf_program__attach_netfilter helper test

 tools/lib/bpf/bpf.c                           |  6 ++
 tools/lib/bpf/bpf.h                           |  6 ++
 tools/lib/bpf/libbpf.c                        | 42 +++++++++
 tools/lib/bpf/libbpf.h                        | 15 ++++
 tools/lib/bpf/libbpf.map                      |  1 +
 .../bpf/prog_tests/netfilter_link_attach.c    | 86 +++++++++++++++++++
 .../bpf/progs/test_netfilter_link_attach.c    | 14 +++
 7 files changed, 170 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/netfilter_link_attach.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_netfilter_link_attach.c
Signature · 1 line
2.39.3