Attach mode parameter to function attach_xdp
Hi,
Is there any way to specify the attach mode for XDP ? The current function to attach an XDP program only has the interface index as parameter (https://docs.rs/libbpf-rs/latest/libbpf_rs/struct.Program.html#method.attach_xdp).
Available attach modes are :
- XDP_FLAGS_SKB_MODE
- XDP_FLAGS_DRV_MODE
- XDP_FLAGS_HW_MODE
You can use libbpf_sys::bpf_xdp_attach.
bpf_xdp_attach() supports this in libbpf but we haven't yet added bpf_xdp_attach() support for libbpf-rs. It's on the list of features missing for feature-parity with libbpf 1.0.
In general I think we lack support for attachment flags?
The use case I ran into was trying to attach (directly, not through a link) a bpf program to a cgroup but needing to set ALLOW_MULTI to the attachment flags.
@Rei-Tw @mdaverde If this is still an issue for you, please feel free to introduce an attach_xdp_* variant that accepts flags in a pull request. We have done something similar for uprobe attachment with de00fbe4097ebcf1f53a9f6867695093f6327e92, for example.
It's an issue for me. I'll give this a go either tomorrow or next week.
Fixed by https://github.com/libbpf/libbpf-rs/pull/625