Skip to content

Commit

Permalink
Enable IP_BOUND_IF on illumos and Solaris
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hawkw committed Feb 26, 2025
1 parent 34aba73 commit 2928673
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1834,6 +1834,8 @@ impl crate::Socket {
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
target_os = "illumos",
target_os = "solaris",
)
))]
pub fn bind_device_by_index_v4(&self, interface: Option<NonZeroU32>) -> io::Result<()> {
Expand All @@ -1859,6 +1861,8 @@ impl crate::Socket {
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
target_os = "illumos",
target_os = "solaris",
)
))]
pub fn bind_device_by_index_v6(&self, interface: Option<NonZeroU32>) -> io::Result<()> {
Expand All @@ -1879,6 +1883,8 @@ impl crate::Socket {
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
target_os = "illumos",
target_os = "solaris",
)
))]
pub fn device_index_v4(&self) -> io::Result<Option<NonZeroU32>> {
Expand All @@ -1900,6 +1906,8 @@ impl crate::Socket {
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
target_os = "illumos",
target_os = "solaris",
)
))]
pub fn device_index_v6(&self) -> io::Result<Option<NonZeroU32>> {
Expand Down

0 comments on commit 2928673

Please sign in to comment.