rustix icon indicating copy to clipboard operation
rustix copied to clipboard

Implement `socket_bind_device` and `set_socket_bind_device`

Open al8n opened this issue 9 months ago • 1 comments

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.

al8n avatar Mar 26 '25 16:03 al8n

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

sunfishcode avatar May 01 '25 00:05 sunfishcode