Skip to content

Enable IP_BOUND_IF on illumos and Solaris #565

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

Merged

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented Mar 17, 2025

The IP_BOUND_IF socket option, which is wrapped by the Socket::bind_device_by_index_{v4,v6} and
Socket::device_index_{v4,v6} is available on SunOS-like systems, such as illumos and Solaris, as well as macOS-like systems. However, these APIs are currently cfg-flagged to only be available on macOS-like systems.

This commit changes the cfg attributes to also enable these APIs on illumos and Solaris.

Fixes #560

This is a backport of PR #561 to the v0.5.x branch.

The `IP_BOUND_IF` socket option, which is wrapped by the
`Socket::bind_device_by_index_{v4,v6}` and
`Socket::device_index_{v4,v6}` is available on SunOS-like systems, such
as illumos and Solaris, as well as macOS-like systems. However, these
APIs are currently cfg-flagged to only be available on macOS-like
systems.

This commit changes the cfg attributes to also enable these APIs on
illumos and Solaris.

Fixes rust-lang#560
@hawkw hawkw changed the title Enable IP_BOUND_IF on illumos and Solaris (#561) Enable IP_BOUND_IF on illumos and Solaris Mar 17, 2025
@Thomasdezeeuw Thomasdezeeuw merged commit 33291e2 into rust-lang:master Mar 18, 2025
43 checks passed
@Thomasdezeeuw
Copy link
Collaborator

Thanks @hawkw

@hawkw
Copy link
Contributor Author

hawkw commented Mar 20, 2025

Ah, whoops --- it looks like I accidentally opened this PR against master rather than v0.5.x, although it was based on v0.5.x in my fork. My bad! There are now two copies of this commit on master (one of which is a 0-line diff) and none on v0.5.x:
image

I've opened a new PR #566 which is actually based on v0.5.x the way it should be. You may also want to rewrite history to remove the empty second commit to master (33291e2) though I'm not sure how you feel about that sort of thing. Sorry for the inconvenience!

@Thomasdezeeuw
Copy link
Collaborator

Why does GitHub even allow that? 🤦

@hawkw
Copy link
Contributor Author

hawkw commented Mar 20, 2025

I think that GitHub will attempt to prevent you from accidentally opening a PR for a commit that was already merged, but since the source branch was based on the v0.5.x branch on my fork, it may have understood this PR as a totally separate, new commit, rather than the same commit back for a second time? I'm not sure, though. Oh well.

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

Successfully merging this pull request may close these issues.

Socket::bind_device_by_index_{v4,v6} should be available on illumos/Solaris
2 participants