Skip to content

Socket::bind_device_by_index_{v4,v6} should be available on linux and android #569

Open
@ningyuan-wang

Description

@ningyuan-wang

SO_BINDTOIFINDEX has been added to linux since linux v5.1. It behaves similar to SO_BINDTODEVICE but takes the interface index as argument. When a user-space program has the index of a network interface, Calling it directly avoids the possibility where the network device is renamed asynchronously after the program temporarily resolves the interface name from the interface index.

Socket::bind_device_by_index{v4,v6} currently is limited to macOS-like systems and solaris/illumos only. (See also issue #560 )
While current implementation is not valid to linux, another implementation can be defined for linux guarded by cfg macro.

Android also has support for SO_BINDTODEVICE, therefore the support can be extended to android target as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions