Skip to content

Implement socket_bind_device and set_socket_bind_device #1426

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

al8n
Copy link
Contributor

@al8n al8n commented Mar 26, 2025

Hi, this PR adds socket_bind_device and set_socket_bind_device methods.

Besides, as the interface name can only be [u8; 16], I think adding an InterfaceBuffer is better, so that we can remove the alloc feature, which has been mentioned in #1393 and #1397 previously.

@sunfishcode sunfishcode added the enhancement New feature or request label Apr 1, 2025
@sunfishcode
Copy link
Member

It looks like this has a build error in the tests on non-Linux platforms:

error[E0433]: failed to resolve: could not find `netdevice` in `net`
   --> tests/net/sockopt.rs:642:29
    |
642 |     let name = rustix::net::netdevice::index_to_name(&fd, loopback_index).unwrap();
    |                             ^^^^^^^^^ could not find `netdevice` in `net`
    |

Can we enclose those tests in #[cfg(linux_kernel)]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants