Skip to content

Implement socket_bind_device and set_socket_bind_device#1426

Open
al8n wants to merge 2 commits into
bytecodealliance:mainfrom
al8n:bind_device
Open

Implement socket_bind_device and set_socket_bind_device#1426
al8n wants to merge 2 commits into
bytecodealliance:mainfrom
al8n:bind_device

Conversation

@al8n

@al8n al8n commented Mar 26, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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)]?

@Sawangg

Sawangg commented Jan 17, 2026

Copy link
Copy Markdown

I'm interested in this feature. @al8n are you still working on it?

@al8n

al8n commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

I'm interested in this feature. @al8n are you still working on it?

I almost forget this PR. But I will update the code this weekend.

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.

3 participants