Closed raftario closed 3 years ago
Hello @raftario
This feature looks cool!
Thanks to this PR I got to know about sk lookup feature. I just read this article: https://lwn.net/Articles/819618/ (I don't understand all yet)
IMO it's okay to include new kernel features in RedBPF. Even though sk lookup feature exists in RedBPF, users who don't use this feature can continue to use RedBPF with the older Linux kernel. Because nothing would be executed unless they call the new functions.
If users have problems while they try calling the sk lookup functions with the older kernel, users should handle their kernel version issue. But brief note about the minimum kernel version for sk lookup would be helpful to users.
And you concerned that you implemented only the userspace part of sk lookup. Don't worry about this. Somebody or you can freely implement the half part for BPF programs later.
I'm not particularly familiar with the library so I was probably confused. I just assumed that since bpf-sys
uses bindgen, and bpf.h
in libbpf includes linux/bpf.h
, the bindings for sk_lookup types would not be generated on older kernels since they aren't present in the kernel headers, and use
ing them from redbpf
would fail to compile on those systems.
Would you be interested in merging this without support in the other crates ?
@raftario Yes, I welcome your contribution. API for BPF programs can be implemented later. Before this PR get merged to main branch, we have to make sure userspace API clear.
I wonder how you used this API. Can you add some example as a doc comment in the SkLookup structure?
I'll add some documentation and convert to a proper PR then !
This pull request is pretty simple and just adds support for loading
sk_lookup
programs to theredbpf
crate. I'm opening it as a draft as2.sk_lookup
requires a relatively recent kernel version (5.9) and merging this would probably break things for many peoplePoint 1 could be addressed by simply building upon this to add support everywhere else (I'll probably do it at some point but I don't personally need it at the moment),
while for point 2 it might be interesting to consider feature-gating different program types.