diff --git a/test/integration-ebpf/src/pass.rs b/test/integration-ebpf/src/pass.rs index b1bdde99..8aaf085f 100644 --- a/test/integration-ebpf/src/pass.rs +++ b/test/integration-ebpf/src/pass.rs @@ -3,6 +3,8 @@ use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext}; +// Note: the `frags` attribute causes this probe to be incompatible with kernel versions < 5.18.0. +// See https://github.com/torvalds/linux/commit/c2f2cdb. #[xdp(name = "pass", frags = "true")] pub fn pass(ctx: XdpContext) -> u32 { match unsafe { try_pass(ctx) } { diff --git a/test/integration-test/tests/load.rs b/test/integration-test/tests/load.rs index e27e46f0..47a851cf 100644 --- a/test/integration-test/tests/load.rs +++ b/test/integration-test/tests/load.rs @@ -168,8 +168,8 @@ fn pin_link() { #[test] fn pin_lifecycle() { let kernel_version = KernelVersion::current().unwrap(); - if kernel_version < KernelVersion::new(5, 9, 0) { - eprintln!("skipping test on kernel {kernel_version:?}, XDP uses netlink"); + if kernel_version < KernelVersion::new(5, 18, 0) { + eprintln!("skipping test on kernel {kernel_version:?}, support for BPF_F_XDP_HAS_FRAGS was added in 5.18.0; see https://github.com/torvalds/linux/commit/c2f2cdb"); return; } diff --git a/test/integration-test/tests/smoke.rs b/test/integration-test/tests/smoke.rs index 51c54555..2bc10ff4 100644 --- a/test/integration-test/tests/smoke.rs +++ b/test/integration-test/tests/smoke.rs @@ -8,6 +8,12 @@ use aya::{ #[test] fn xdp() { + let kernel_version = KernelVersion::current().unwrap(); + if kernel_version < KernelVersion::new(5, 18, 0) { + eprintln!("skipping test on kernel {kernel_version:?}, support for BPF_F_XDP_HAS_FRAGS was added in 5.18.0; see https://github.com/torvalds/linux/commit/c2f2cdb"); + return; + } + let bytes = include_bytes_aligned!("../../../target/bpfel-unknown-none/release/pass"); let mut bpf = Bpf::load(bytes).unwrap(); let dispatcher: &mut Xdp = bpf.program_mut("pass").unwrap().try_into().unwrap();