Skip to content

Commit

Permalink
Add a few tweak a code to fix libbpf's API change.
Browse files Browse the repository at this point in the history
  • Loading branch information
nak3 committed May 29, 2023
1 parent 0bc886f commit afb4aa1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions aya/src/sys/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ pub(crate) fn bpf_link_create(
) -> SysResult {
let mut attr = unsafe { mem::zeroed::<bpf_attr>() };

attr.link_create.prog_fd = prog_fd as u32;
attr.link_create.__bindgen_anon_1.target_fd = target_fd as u32;
attr.link_create.__bindgen_anon_1.prog_fd = prog_fd as u32;
attr.link_create.__bindgen_anon_2.target_fd = target_fd as u32;
attr.link_create.attach_type = attach_type as u32;
attr.link_create.flags = flags;
if let Some(btf_id) = btf_id {
attr.link_create.__bindgen_anon_2.target_btf_id = btf_id;
attr.link_create.__bindgen_anon_3.target_btf_id = btf_id;
}

sys_bpf(bpf_cmd::BPF_LINK_CREATE, &attr)
Expand All @@ -391,9 +391,9 @@ pub(crate) fn bpf_link_update(
let mut attr = unsafe { mem::zeroed::<bpf_attr>() };

attr.link_update.link_fd = link_fd as u32;
attr.link_update.new_prog_fd = new_prog_fd as u32;
attr.link_update.__bindgen_anon_1.new_prog_fd = new_prog_fd as u32;
if let Some(fd) = old_prog_fd {
attr.link_update.old_prog_fd = fd as u32;
attr.link_update.__bindgen_anon_2.old_prog_fd = fd as u32;
attr.link_update.flags = flags | BPF_F_REPLACE;
} else {
attr.link_update.flags = flags;
Expand Down

0 comments on commit afb4aa1

Please sign in to comment.