mirror of https://github.com/aya-rs/aya
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
644 B
Rust
32 lines
644 B
Rust
#![no_std]
|
|
#![no_main]
|
|
|
|
use aya_bpf::{
|
|
bindings::xdp_action,
|
|
macros::{kprobe, xdp},
|
|
programs::{ProbeContext, XdpContext},
|
|
};
|
|
|
|
#[xdp(name = "test_unload_xdp")]
|
|
pub fn pass(ctx: XdpContext) -> u32 {
|
|
match unsafe { try_pass(ctx) } {
|
|
Ok(ret) => ret,
|
|
Err(_) => xdp_action::XDP_ABORTED,
|
|
}
|
|
}
|
|
|
|
unsafe fn try_pass(_ctx: XdpContext) -> Result<u32, u32> {
|
|
Ok(xdp_action::XDP_PASS)
|
|
}
|
|
|
|
#[kprobe]
|
|
// truncated name to match bpftool output
|
|
pub fn test_unload_kpr(_ctx: ProbeContext) -> u32 {
|
|
0
|
|
}
|
|
|
|
#[panic_handler]
|
|
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
|
unsafe { core::hint::unreachable_unchecked() }
|
|
}
|