Skip to content

Commit 44b1024

Browse files
authored
Merge pull request #131 from aya-rs/names-bye
Fix CI
2 parents ac7ee1f + bc0da20 commit 44b1024

File tree

31 files changed

+51
-55
lines changed

31 files changed

+51
-55
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- main
1212
- staging
1313

14+
schedule:
15+
- cron: 00 4 * * *
16+
1417
env:
1518
CARGO_TERM_COLOR: always
1619

@@ -44,8 +47,9 @@ jobs:
4447
examples/xdp-hello
4548
examples/xdp-log
4649
47-
- name: Install bpf-linker
48-
run: cargo install bpf-linker
50+
- uses: taiki-e/install-action@v2
51+
with:
52+
tool: bpf-linker
4953

5054
- name: Set up Python
5155
uses: actions/setup-python@v4
@@ -63,7 +67,7 @@ jobs:
6367
for dir in ./examples/*/ ; do
6468
pushd "${dir}"
6569
echo "Example: ${dir}."
66-
cargo xtask build-ebpf
67-
cargo build
70+
cargo xtask build-ebpf --release
71+
cargo build --release
6872
popd
6973
done

examples/aya-tool/myapp-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default = []
88
user = ["aya"]
99

1010
[dependencies]
11-
aya = { version = "0.11", optional = true }
11+
aya = { git = "https://github.com/aya-rs/aya", optional = true }
1212

1313
[lib]
1414
path = "src/lib.rs"

examples/aya-tool/myapp-ebpf/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use vmlinux::task_struct;
1919
#[map]
2020
static PROCESSES: HashMap<i32, i32> = HashMap::with_max_entries(32768, 0);
2121

22-
#[lsm(name = "task_alloc")]
22+
#[lsm(hook = "task_alloc")]
2323
pub fn task_alloc(ctx: LsmContext) -> i32 {
2424
match unsafe { try_task_alloc(ctx) } {
2525
Ok(ret) => ret,

examples/aya-tool/myapp/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
aya = "0.11"
9-
aya-log = "0.1"
8+
aya = { git = "https://github.com/aya-rs/aya" }
9+
aya-log = { git = "https://github.com/aya-rs/aya" }
1010
myapp-common = { path = "../myapp-common", features = ["user"] }
1111
anyhow = "1"
1212
ctrlc = "3.2"

examples/aya-tool/xtask/src/build_ebpf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4444
let target = format!("--target={}", opts.target);
4545
let mut args = vec![
4646
"build",
47-
"--verbose",
4847
target.as_str(),
4948
"-Z",
5049
"build-std=core",

examples/cgroup-skb-egress/cgroup-skb-egress-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default = []
88
user = [ "aya" ]
99

1010
[dependencies]
11-
aya = { version = ">=0.11", optional=true }
11+
aya = { git = "https://github.com/aya-rs/aya", optional=true }
1212

1313
[lib]
1414
path = "src/lib.rs"

examples/cgroup-skb-egress/cgroup-skb-egress-ebpf/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ use cgroup_skb_egress_common::PacketLog;
1717
mod bindings;
1818
use bindings::iphdr;
1919

20-
#[map(name = "EVENTS")]
20+
#[map]
2121
static EVENTS: PerfEventArray<PacketLog> =
2222
PerfEventArray::with_max_entries(1024, 0);
2323

24-
#[map(name = "BLOCKLIST")] // (1)
24+
#[map] // (1)
2525
static BLOCKLIST: HashMap<u32, u32> = HashMap::with_max_entries(1024, 0);
2626

27-
#[cgroup_skb(name = "cgroup_skb_egress")]
27+
#[cgroup_skb]
2828
pub fn cgroup_skb_egress(ctx: SkBuffContext) -> i32 {
2929
match { try_cgroup_skb_egress(ctx) } {
3030
Ok(ret) => ret,

examples/cgroup-skb-egress/cgroup-skb-egress/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
aya = { version = ">=0.11", features = ["async_tokio"] }
9-
aya-log = "0.1"
8+
aya = { git = "https://github.com/aya-rs/aya", features = ["async_tokio"] }
9+
aya-log = { git = "https://github.com/aya-rs/aya" }
1010
cgroup-skb-egress-common = { path = "../cgroup-skb-egress-common", features = [
1111
"user",
1212
] }

examples/cgroup-skb-egress/cgroup-skb-egress/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ async fn main() -> Result<(), anyhow::Error> {
4747
program.attach(cgroup, CgroupSkbAttachType::Egress)?;
4848

4949
let mut blocklist: HashMap<_, u32, u32> =
50-
HashMap::try_from(bpf.map_mut("BLOCKLIST")?)?;
50+
HashMap::try_from(bpf.map_mut("BLOCKLIST").unwrap())?;
5151

5252
let block_addr: u32 = Ipv4Addr::new(1, 1, 1, 1).try_into()?;
5353

5454
// (3)
5555
blocklist.insert(block_addr, 0, 0)?;
5656

57-
let mut perf_array = AsyncPerfEventArray::try_from(bpf.map_mut("EVENTS")?)?;
57+
let mut perf_array =
58+
AsyncPerfEventArray::try_from(bpf.take_map("EVENTS").unwrap())?;
5859

5960
for cpu_id in online_cpus()? {
6061
let mut buf = perf_array.open(cpu_id, None)?;

examples/cgroup-skb-egress/xtask/src/build_ebpf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4444
let target = format!("--target={}", opts.target);
4545
let mut args = vec![
4646
"build",
47-
"--verbose",
4847
target.as_str(),
4948
"-Z",
5049
"build-std=core",

examples/kprobetcp/kprobetcp-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default = []
88
user = ["aya"]
99

1010
[dependencies]
11-
aya = { version = ">=0.11", optional = true }
11+
aya = { git = "https://github.com/aya-rs/aya", optional = true }
1212

1313
[lib]
1414
path = "src/lib.rs"

examples/kprobetcp/kprobetcp-ebpf/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use aya_log_ebpf::info;
1717
const AF_INET: u16 = 2;
1818
const AF_INET6: u16 = 10;
1919

20-
#[kprobe(name = "kprobetcp")]
20+
#[kprobe]
2121
pub fn kprobetcp(ctx: ProbeContext) -> u32 {
2222
match try_kprobetcp(ctx) {
2323
Ok(ret) => ret,

examples/kprobetcp/xtask/src/build_ebpf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4444
let target = format!("--target={}", opts.target);
4545
let mut args = vec![
4646
"build",
47-
"--verbose",
4847
target.as_str(),
4948
"-Z",
5049
"build-std=core",

examples/lsm-nice/lsm-nice-ebpf/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use vmlinux::task_struct;
1818
#[no_mangle]
1919
static PID: i32 = 0;
2020

21-
#[lsm(name = "task_setnice")]
21+
#[lsm(hook = "task_setnice")]
2222
pub fn task_setnice(ctx: LsmContext) -> i32 {
2323
match unsafe { try_task_setnice(ctx) } {
2424
Ok(ret) => ret,

examples/lsm-nice/lsm-nice/src/main.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ async fn main() -> Result<(), anyhow::Error> {
1818
// like to specify the eBPF program at runtime rather than at compile-time, you can
1919
// reach for `Bpf::load_file` instead.
2020
#[cfg(debug_assertions)]
21-
let mut bpf = BpfLoader::new()
22-
.set_global("PID", &pid, true)
23-
.load(include_bytes_aligned!(
24-
"../../target/bpfel-unknown-none/debug/lsm-nice"
25-
))?;
21+
let mut bpf = BpfLoader::new().set_global("PID", &pid, true).load(
22+
include_bytes_aligned!(
23+
"../../target/bpfel-unknown-none/debug/lsm-nice"
24+
),
25+
)?;
2626

2727
#[cfg(not(debug_assertions))]
28-
let mut bpf = BpfLoader::new()
29-
.set_global("PID", &pid, true)
30-
.load(include_bytes_aligned!(
31-
"../../target/bpfel-unknown-none/release/lsm-nice"
32-
))?;
28+
let mut bpf = BpfLoader::new().set_global("PID", &pid, true).load(
29+
include_bytes_aligned!(
30+
"../../target/bpfel-unknown-none/release/lsm-nice"
31+
),
32+
)?;
3333
if let Err(e) = BpfLogger::init(&mut bpf) {
3434
// This can happen if you remove all log statements from your eBPF program.
3535
warn!("failed to initialize eBPF logger: {}", e);

examples/lsm-nice/xtask/src/build_ebpf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4444
let target = format!("--target={}", opts.target);
4545
let mut args = vec![
4646
"build",
47-
"--verbose",
4847
target.as_str(),
4948
"-Z",
5049
"build-std=core",

examples/tc-egress/tc-egress-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default = []
88
user = ["aya"]
99

1010
[dependencies]
11-
aya = { version = ">=0.11", optional = true }
11+
aya = { git = "https://github.com/aya-rs/aya", optional = true }
1212

1313
[lib]
1414
path = "src/lib.rs"

examples/tc-egress/tc-egress-ebpf/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use network_types::{
1616
#[map]
1717
static BLOCKLIST: HashMap<u32, u32> = HashMap::with_max_entries(1024, 0);
1818

19-
#[classifier(name = "tc_egress")]
19+
#[classifier]
2020
pub fn tc_egress(ctx: TcContext) -> i32 {
2121
match try_tc_egress(ctx) {
2222
Ok(ret) => ret,

examples/tc-egress/tc-egress/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
aya = { version = ">=0.11", features = ["async_tokio"] }
9-
aya-log = "0.1"
8+
aya = { git = "https://github.com/aya-rs/aya", features = ["async_tokio"] }
9+
aya-log = { git = "https://github.com/aya-rs/aya" }
1010
tc-egress-common = { path = "../tc-egress-common", features = ["user"] }
1111
anyhow = "1"
1212
clap = { version = "4.1", features = ["derive"] }

examples/tc-egress/tc-egress/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async fn main() -> Result<(), anyhow::Error> {
4949

5050
// (1)
5151
let mut blocklist: HashMap<_, u32, u32> =
52-
HashMap::try_from(bpf.map_mut("BLOCKLIST")?)?;
52+
HashMap::try_from(bpf.map_mut("BLOCKLIST").unwrap())?;
5353

5454
// (2)
5555
let block_addr: u32 = Ipv4Addr::new(1, 1, 1, 1).try_into()?;

examples/tc-egress/xtask/src/build_ebpf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4444
let target = format!("--target={}", opts.target);
4545
let mut args = vec![
4646
"build",
47-
"--verbose",
4847
target.as_str(),
4948
"-Z",
5049
"build-std=core",

examples/xdp-drop/xdp-drop-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default = []
88
user = [ "aya" ]
99

1010
[dependencies]
11-
aya = { version = ">=0.11", optional=true }
11+
aya = { git = "https://github.com/aya-rs/aya", optional=true }
1212

1313
[lib]
1414
path = "src/lib.rs"

examples/xdp-drop/xdp-drop-ebpf/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn panic(_info: &core::panic::PanicInfo) -> ! {
2121
unsafe { core::hint::unreachable_unchecked() }
2222
}
2323

24-
#[map(name = "BLOCKLIST")] // (1)
24+
#[map] // (1)
2525
static BLOCKLIST: HashMap<u32, u32> =
2626
HashMap::<u32, u32>::with_max_entries(1024, 0);
2727

examples/xdp-drop/xtask/src/build_ebpf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4444
let target = format!("--target={}", opts.target);
4545
let mut args = vec![
4646
"build",
47-
"--verbose",
4847
target.as_str(),
4948
"-Z",
5049
"build-std=core",

examples/xdp-hello/xdp-hello-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default = []
88
user = [ "aya" ]
99

1010
[dependencies]
11-
aya = { version = ">=0.11", optional=true }
11+
aya = { git = "https://github.com/aya-rs/aya", optional=true }
1212

1313
[lib]
1414
path = "src/lib.rs"

examples/xdp-hello/xdp-hello-ebpf/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext};
55
use aya_log_ebpf::info;
66

7-
#[xdp(name = "xdp_hello")] // (4)
7+
#[xdp] // (4)
88
pub fn xdp_hello(ctx: XdpContext) -> u32 {
99
// (5)
1010
match unsafe { try_xdp_hello(ctx) } {

examples/xdp-hello/xtask/src/build_ebpf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4444
let target = format!("--target={}", opts.target);
4545
let mut args = vec![
4646
"build",
47-
"--verbose",
4847
target.as_str(),
4948
"-Z",
5049
"build-std=core",

examples/xdp-log/xdp-log-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ default = []
88
user = [ "aya" ]
99

1010
[dependencies]
11-
aya = { version = ">=0.11", optional=true }
11+
aya = { git = "https://github.com/aya-rs/aya", optional=true }
1212

1313
[lib]
1414
path = "src/lib.rs"

examples/xdp-log/xdp-log-ebpf/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ fn try_xdp_firewall(ctx: XdpContext) -> Result<u32, ()> {
6363
};
6464

6565
// (3)
66-
info!(
67-
&ctx,
68-
"SRC IP: {:i}, SRC PORT: {}", source_addr, source_port
69-
);
66+
info!(&ctx, "SRC IP: {:i}, SRC PORT: {}", source_addr, source_port);
7067

7168
Ok(xdp_action::XDP_PASS)
7269
}

examples/xdp-log/xdp-log/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
use aya::{include_bytes_aligned, Bpf};
21
use anyhow::Context;
3-
use aya::programs::{Xdp, XdpFlags};
2+
use aya::{
3+
include_bytes_aligned,
4+
programs::{Xdp, XdpFlags},
5+
Bpf,
6+
};
47
use aya_log::BpfLogger;
58
use clap::Parser;
69
use log::{info, warn};

examples/xdp-log/xtask/src/build_ebpf.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use std::path::PathBuf;
2-
use std::process::Command;
1+
use std::{path::PathBuf, process::Command};
32

43
use clap::Parser;
54

@@ -45,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
4544
let target = format!("--target={}", opts.target);
4645
let mut args = vec![
4746
"build",
48-
"--verbose",
4947
target.as_str(),
5048
"-Z",
5149
"build-std=core",

0 commit comments

Comments
 (0)