Skip to content

Introduce libbpf_attach_type_by_name

Andrey Ignatov netdev 1 version Applied

Status from this message: Applied to bpf-next, thanks Andrey!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5libbpf: Introduce libbpf_attach_type_by_nametools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h+84 -390 replies
2/5libbpf: Support cgroup_skb/{e,in}gress section namestools/lib/bpf/libbpf.c+4 -00 replies
3/5libbpf: Support sk_skb/stream_{parser,verdict} section namestools/lib/bpf/libbpf.c+4 -00 replies
4/5selftests/bpf: Use libbpf_attach_type_by_name in test_socket_cookietools/testing/selftests/bpf/test_socket_cookie.c+1 -50 replies
5/5selftests/bpf: Test libbpf_{prog,attach}_type_by_nametools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/test_section_names.c+209 -10 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH bpf-next 0/5] Introduce libbpf_attach_type_by_name

This patch set introduces libbpf_attach_type_by_name function in libbpf to identify attach type by section name.

This is useful to avoid writing same logic over and over again in user space applications that leverage libbpf.

Patch 1 has more details on the new function and problem being solved. Patches 2 and 3 add support for new section names.
Patch 4 uses new function in a selftest.
Patch 5 adds selftest for libbpf_{prog,attach}_type_by_name.

As a side note there are a lot of inconsistencies now between names used by libbpf and bpftool (e.g. cgroup/skb vs cgroup_skb, cgroup_device and device vs cgroup/dev, sockops vs sock_ops, etc). This patch set does not address it but it tries not to make it harder to address it in the future.

Andrey Ignatov (5):
libbpf: Introduce libbpf_attach_type_by_name
libbpf: Support cgroup_skb/{e,in}gress section names
libbpf: Support sk_skb/stream_{parser,verdict} section names selftests/bpf: Use libbpf_attach_type_by_name in test_socket_cookie selftests/bpf: Test libbpf_{prog,attach}_type_by_name

 tools/lib/bpf/libbpf.c                        | 129 +++++++----
 tools/lib/bpf/libbpf.h                        |   2 +
 tools/testing/selftests/bpf/Makefile          |   2 +-
 .../selftests/bpf/test_section_names.c        | 208 ++++++++++++++++++
 .../selftests/bpf/test_socket_cookie.c        |   6 +-
 5 files changed, 302 insertions(+), 45 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/test_section_names.c
Signature · 1 line
2.17.1