Skip to contentSkip to conversation

bpf: support BPF_PROG_QUERY for progs attached to sockmap

PATCH zhudi (E) 1 participant 1 message Oct 23, 2021 BPF

lore
Share & tools
lore

zhudi (E)

author
#0 lore raw
Quoted 11 lines
Quoted 9 lines · Di Zhu

Right now there is no way to query whether BPF programs are attached to a sockmap or not.

we can use the standard interface in libbpf to query, such as:
bpf_prog_query(mapFd, BPF_SK_SKB_STREAM_PARSER, 0, NULL, ...); the mapFd is the fd of sockmap.

---

Quoted 6 lines

LGTM, lets add a small test here as well

./tools/testing/selftests/bpf/prog_tests/sockmap_basic.c

Looks like we can just copy the sk_lookup.c test case which does the query tests for BPF_SK_LOOKUP.

Thanks for your advice, I will add it in my patch.

Quoted 6 lines

Also I don't think its required for this series, but a bpftool patch to query it would be useful as well if its doesn't just work with above.

Thanks!
John