Skip to content

Adding set_route to sys::unix::net #255

Description

@devnexen

Proposal

Problem statement

Adding a separated set_route call from the existing set_mark.

Motivating examples or use cases

set_mark is more appropriate to assign an ID to a socket that a route can use, whereas set_route would set the route ID the socket is going to be bound to. The actual set_mark alone conflates a bit the two notions, thus adding FreeBSD's SO_SETFIB and OpenBSD's SO_RTABLE ought to migrate to the new call whereas Linux' SO_MARK (which the set_mark's idea generates from) and FreeBSD's SO_USER_COOKIE should remain.

Solution sketch

#[cfg(any(target_os("openbsd"), target_os("freebsd")))] pub fn set_route(&self, route: i32) -> io::Result<()> { ... <setsockopt with the platform specific constant> }

Alternatives

Links and related work

ref PR.

What happens now?

Possible responses

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-change-proposalA proposal to add or alter unstable APIs in the standard libraries

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions