ebpf
ebpf copied to clipboard
Add support for netkit device
Adds support for attaching bpf programs to netkit devices using bpf links.
Generated code is currently based on 6.7-rc4
TODO :
- [x] Decide on a way to create
netkit
device in CI for testing. - [x] Re-gen code once
6.7
is out and validate for any changes.
Thanks for this great work!
@hemanthmalla happy new year! Given 6.7 is officially released now, could you move forward with the PR? Thanks! :)
@lmb I remember reading somewhere, that cilium/ebpf
prefers not to have libs like vishvananda/netlink
as dependencies. Do you have thoughts on how we should go about creating a netkit
device in CI for tests?
Is shelling out to do something like ip link add nk0 type netkit
the best option here ?
@lmb I remember reading somewhere, that
cilium/ebpf
prefers not to have libs likevishvananda/netlink
as dependencies. Do you have thoughts on how we should go about creating anetkit
device in CI for tests? Is shelling out to do something likeip link add nk0 type netkit
the best option here ?
Interesting, I never realized we attached to ifindex 1 in the XDP tests, but that obviously won't work for netkit. I think newer versions of Go automatically prune testing-only module dependencies, so technically there wouldn't be any downside to importing e.g. jsimonetti/rtnetlink
. (e.g. vendoring the lib doesn't automatically pull in quicktest either, afaik)
I think we can soften our stance on importing a netlink lib for testing if this is the case. Not sure if we can do the same for examples. I think shelling out to ip
would be strictly worse, since we'll need to deal with the various failure cases then. Using a library would make it easier to degrade gracefully (e.g. skip a test if creating a netkit dev returns EINVAL etc.) without resorting to screen scraping ip
. I'd like to avoid that.
Test failures seem flaky to me. Previously only ci / Run tests on previous stable Go
failed, re-triggered the tests on same commit changes and now Run tests on pre-built kernel (6.7)
seems to fail. How do I re-trigger just the failed test ?