Introduce BPF Streams abstraction
Add libbpf-rs support for interacting with BPF streams from Rust code. The interface provides the option to either directly specify the prog fd/stream id, or to hide the details behind a Stream abstraction.
Thank you for the review, I will update the PR accordingly and post here to confirm it's ready for review. Ack to all comments, though I have a couple followup questions (inline).
Updated the code and added tests. The interface now presents the streams only indirectly and without exposing the type itself unless the user opts to create an instance directly. I think the code now is more idiomatic and looks a lot less like C.
The failing tests looks like are caused the test VMs' kernel being < 6.17?
The failing tests looks like are caused the test VMs' kernel being < 6.17?
If that's the case you can mark them as ignored for now.
https://github.com/libbpf/libbpf-rs/blob/e0caff4e52982ff5eca8c0008af0e70fcc709580/libbpf-rs/tests/test.rs#L1702
At the moment we just use whatever kernel the Ubuntu image ships with. Right now that seems to be 6.11 (https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md)
Clippy seems to be failing on unrelated code.
Not sure why clippy is hitting these errors, they are for pre-existing code.
It's failing because you don't use all functions provided by the common module, which your new test_stream module uses, so Rust complains about unused code.
I fixed it up and merged. Thanks for the pull request!
Thank you for the detailed feedback!