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

Question: How to bind to netlink on Linux? #1260

Open
al8n opened this issue Jan 12, 2025 · 1 comment
Open

Question: How to bind to netlink on Linux? #1260

al8n opened this issue Jan 12, 2025 · 1 comment

Comments

@al8n
Copy link
Contributor

al8n commented Jan 12, 2025

Hi, when using rustix on linux, I found that it seems that there is no socketaddr_nl, and cannot bind to netlink.

    let mut sa: sockaddr_nl = mem::zeroed();
    sa.nl_family = AF_NETLINK as u16;

    if bind(
      sock,
      &sa as *const sockaddr_nl as *const _,
      mem::size_of::<sockaddr_nl>() as socklen_t,
    ) < 0
    {
      return Err(io::Error::last_os_error());
    }

The above libc code cannot use rustix to achieve.

@kevinmehall
Copy link
Contributor

I submitted a PR for this last year: #1004

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

No branches or pull requests

2 participants