Skip to content

Commit 51e9773

Browse files
committed
Enable IP_BOUND_IF on illumos and Solaris
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
1 parent 34aba73 commit 51e9773

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/sys/unix.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ use std::net::{Ipv4Addr, Ipv6Addr};
2222
target_os = "macos",
2323
target_os = "tvos",
2424
target_os = "watchos",
25+
target_os = "illumos",
26+
target_os = "solaris",
2527
)
2628
))]
2729
use std::num::NonZeroU32;
@@ -1834,6 +1836,8 @@ impl crate::Socket {
18341836
target_os = "macos",
18351837
target_os = "tvos",
18361838
target_os = "watchos",
1839+
target_os = "illumos",
1840+
target_os = "solaris",
18371841
)
18381842
))]
18391843
pub fn bind_device_by_index_v4(&self, interface: Option<NonZeroU32>) -> io::Result<()> {
@@ -1859,6 +1863,8 @@ impl crate::Socket {
18591863
target_os = "macos",
18601864
target_os = "tvos",
18611865
target_os = "watchos",
1866+
target_os = "illumos",
1867+
target_os = "solaris",
18621868
)
18631869
))]
18641870
pub fn bind_device_by_index_v6(&self, interface: Option<NonZeroU32>) -> io::Result<()> {
@@ -1879,6 +1885,8 @@ impl crate::Socket {
18791885
target_os = "macos",
18801886
target_os = "tvos",
18811887
target_os = "watchos",
1888+
target_os = "illumos",
1889+
target_os = "solaris",
18821890
)
18831891
))]
18841892
pub fn device_index_v4(&self) -> io::Result<Option<NonZeroU32>> {
@@ -1900,6 +1908,8 @@ impl crate::Socket {
19001908
target_os = "macos",
19011909
target_os = "tvos",
19021910
target_os = "watchos",
1911+
target_os = "illumos",
1912+
target_os = "solaris",
19031913
)
19041914
))]
19051915
pub fn device_index_v6(&self) -> io::Result<Option<NonZeroU32>> {

0 commit comments

Comments
 (0)