aquasecurity / libbpfgo

eBPF library for Go. Powered by libbpf.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to Attach a BPF_PROG_TYPE_SK_MSG

fengzx33 opened this issue · comments

@fengzx33 I suppose you can get information about BPF_PROG_TYPE_SK_MSG from the kernel Documentation/bpf/map_sockmap.rst and through the use of its helpers in tools/testing/selftests/bpf/progs/test_sockmap_kern.h.

@rafaeldtinoco we currently don't support bpf_msg_push_data and bpf_msg_pull_data, right?

@geyslan Thank you, but what I would like to know is how to successfully attach to a SEC like SEC("sk_msg") using libbpfgo. I am looking for a function similar to AttachCgroup(cgroupV2DirPath string) or the steps required for attaching to such SEC("sk_msg") using libbpfgo.

@geyslan @rafaeldtinoco I found that libbpfgo haven't an api, which can attach SEC("sk_msg") , what should i do? thanks

example: https://github.com/dafu-wu/istio-tcpip-bypass/blob/796d738babee7da77815ad2819a69d37d8472dea/bpf/bpf_redir.c#L9