libbpfgo icon indicating copy to clipboard operation
libbpfgo copied to clipboard

Implement libbpf bpf_program API

Open grantseltzer opened this issue 4 years ago • 4 comments

We should expose all of the bpf_program api, just being careful about what is deprecated and/or discouraged when 1.0 is released.

  • [ ] bpf_program__set_ifindex
  • [ ] bpf_program__name
  • [ ] bpf_program__section_name
  • [ ] bpf_program__autoload
  • [x] bpf_program__set_autoload
  • [x] bpf_program__fd
  • [x] bpf_program__pin
  • [x] bpf_program__unpin
  • [ ] bpf_program__unload
  • [x] bpf_program__attach
  • [x] bpf_program__attach_perf_event
  • [ ] bpf_program__attach_perf_event_opts
  • [x] bpf_program__attach_kprobe
  • [ ] bpf_program__attach_kprobe_opts
  • [x] bpf_program__attach_uprobe
  • [ ] bpf_program__attach_uprobe_opts
  • [x] bpf_program__attach_tracepoint
  • [ ] bpf_program__attach_tracepoint_opts
  • [x] bpf_program__attach_raw_tracepoint
  • [ ] bpf_program__attach_trace
  • [ ] bpf_program__attach_trace_opts
  • [x] bpf_program__attach_lsm
  • [x] bpf_program__attach_cgroup
  • [x] bpf_program__attach_netns
  • [x] bpf_program__attach_xdp
  • [ ] bpf_program__attach_freplace
  • [x] bpf_program__attach_iter
  • [x] bpf_program__type
  • [x] bpf_program__set_type
  • [ ] bpf_program__expected_attach_type
  • [x] bpf_program__set_expected_attach_type
  • [x] bpf_program__set_attach_target

Low-level API:

  • [ ] bpf_prog_get_info_by_fd

grantseltzer avatar Nov 12 '21 19:11 grantseltzer

Hey folks, is anyone already working on the XDP API bits? I would require it for a PoC so I can probably contribute from this perspective.

saschagrunert avatar Dec 07 '21 15:12 saschagrunert

Hi @saschagrunert! No one currently has the XDP api on their plate, you're more than welcome to contribute and I'd be happy to help in any way I can!

grantseltzer avatar Dec 07 '21 15:12 grantseltzer

BTW, there is a generic attachment interface now, right ?

image

It is tied to bpf_program__attach_cgroup and some other attachments.

rafaeldtinoco avatar Jul 24 '22 03:07 rafaeldtinoco

bpf_program__attach_cgroup PR: https://github.com/aquasecurity/libbpfgo/pull/196

rafaeldtinoco avatar Jul 24 '22 04:07 rafaeldtinoco