-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See aya-rs/aya#698 for rationale.
- Loading branch information
Showing
9 changed files
with
26 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
|
||
#[allow(non_upper_case_globals)] | ||
#[allow(non_snake_case)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use aya_bpf::{ | ||
macros::{cgroup_skb, map}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
|
||
#[allow(non_upper_case_globals)] | ||
#[allow(non_snake_case)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
|
||
use aya_bpf::{ | ||
bindings::{TC_ACT_PIPE, TC_ACT_SHOT}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#![no_std] | ||
#![no_builtins] | ||
#![no_main] | ||
#![no_std] | ||
#![allow(nonstandard_style, dead_code)] | ||
|
||
use aya_bpf::{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
#![no_std] // (1) | ||
#![no_main] // (2) | ||
#![no_builtins] // (3) | ||
|
||
use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext}; | ||
use aya_log_ebpf::info; | ||
|
||
#[xdp] // (4) | ||
#[xdp] // (5) | ||
pub fn xdp_hello(ctx: XdpContext) -> u32 { | ||
// (5) | ||
// (6) | ||
match unsafe { try_xdp_hello(ctx) } { | ||
Ok(ret) => ret, | ||
Err(_) => xdp_action::XDP_ABORTED, | ||
} | ||
} | ||
|
||
unsafe fn try_xdp_hello(ctx: XdpContext) -> Result<u32, u32> { | ||
// (6) | ||
info!(&ctx, "received a packet"); | ||
// (7) | ||
info!(&ctx, "received a packet"); | ||
// (8) | ||
Ok(xdp_action::XDP_PASS) | ||
} | ||
|
||
#[panic_handler] // (3) | ||
#[panic_handler] // (4) | ||
fn panic(_info: &core::panic::PanicInfo) -> ! { | ||
unsafe { core::hint::unreachable_unchecked() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters