Skip to content

Commit

Permalink
socket_filter: fix build
Browse files Browse the repository at this point in the history
The signature of attach changed in
aya-rs/aya#723.
  • Loading branch information
tamird committed Sep 5, 2023
1 parent 599ba4b commit 1247fde
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ case "$PROG_TYPE" in
ADDITIONAL_ARGS=''
esac

cargo generate -v --path "${TEMPLATE_DIR}" -n test -d program_type="${PROG_TYPE}" ${ADDITIONAL_ARGS}
cargo generate --path "${TEMPLATE_DIR}" -n test -d program_type="${PROG_TYPE}" ${ADDITIONAL_ARGS}
pushd test
cargo xtask build-ebpf
cargo build
Expand Down
1 change: 0 additions & 1 deletion xtask/src/build_ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
let target = format!("--target={}", opts.target);
let mut args = vec![
"build",
"--verbose",
target.as_str(),
"-Z",
"build-std=core",
Expand Down
3 changes: 1 addition & 2 deletions {{project-name}}/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use aya::util::online_cpus;
use aya::{programs::BtfTracePoint, Btf};
{%- when "socket_filter" -%}
use std::net::TcpStream;
use std::os::unix::io::AsRawFd;
use aya::programs::SocketFilter;
{%- when "raw_tracepoint" -%}
use aya::programs::RawTracePoint;
Expand Down Expand Up @@ -165,7 +164,7 @@ async fn main() -> Result<(), anyhow::Error> {
let client = TcpStream::connect("127.0.0.1:1234")?;
let prog: &mut SocketFilter = bpf.program_mut("{{crate_name}}").unwrap().try_into()?;
prog.load()?;
prog.attach(client.as_raw_fd())?;
prog.attach(client)?;
{%- when "cgroup_sysctl" -%}
let program: &mut CgroupSysctl = bpf.program_mut("{{crate_name}}").unwrap().try_into()?;
let cgroup = std::fs::File::open(opt.cgroup_path)?;
Expand Down

0 comments on commit 1247fde

Please sign in to comment.