aya-ebpf: add ifindex support to XdpContext

This change exposes the ifindex field from the underlying xdp_md
data structure to the XdpContext in Aya. The ifindex represents the
unique OS-provided index for a network interface.

Fixes #1140
reviewable/pr1141/r1
Tim Upthegrove 1 week ago
parent 29b821376e
commit a05e37d47d

@ -21,6 +21,12 @@ impl XdpContext {
unsafe { (*self.ctx).data_end as usize }
}
/// Return the interface of the index as determined by the OS.
#[inline]
pub fn ingress_ifindex(&self) -> usize {
unsafe { (*self.ctx).ingress_ifindex as usize }
}
/// Return the raw address of the XdpContext metadata.
#[inline(always)]
pub fn metadata(&self) -> usize {

Loading…
Cancel
Save