Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename aya-bpf to aya-ebpf. #106

Merged
merged 8 commits into from
Mar 24, 2024
Merged

Rename aya-bpf to aya-ebpf. #106

merged 8 commits into from
Mar 24, 2024

Conversation

liyan-ah
Copy link
Contributor

Based on aya-rs/aya@41c6156, it's necessary to use aya-ebpf instead of aya-bpf.

@liyan-ah
Copy link
Contributor Author

There are still errors in sk_msg. Any advice would be appreciated.

Copy link
Member

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liyan-ah Yes, the following change should fix the sk_msg build. 🙂

diff --git a/{{project-name}}/src/main.rs b/{{project-name}}/src/main.rs
index 174a0ff..c6a1fa3 100644
--- a/{{project-name}}/src/main.rs
+++ b/{{project-name}}/src/main.rs
@@ -123,11 +123,11 @@ async fn main() -> Result<(), anyhow::Error> {
     program.attach(cgroup)?;
     {%- when "sk_msg" -%}
     let sock_map: SockHash::<_, SockKey> = bpf.map("{{sock_map}}").unwrap().try_into()?;
-    let map_fd = sock_map.fd();
+    let map_fd = sock_map.fd().try_clone()?;

     let prog: &mut SkMsg = bpf.program_mut("{{crate_name}}").unwrap().try_into()?;
     prog.load()?;
-    prog.attach(map_fd)?;
+    prog.attach(&map_fd)?;
     // insert sockets to the map using sock_map.insert here, or from a sock_ops program
     {%- when "xdp" -%}
     let program: &mut Xdp = bpf.program_mut("{{crate_name}}").unwrap().try_into()?;

@liyan-ah liyan-ah requested a review from vadorovsky March 24, 2024 15:44
@vadorovsky vadorovsky merged commit 97e817d into aya-rs:main Mar 24, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants