Skip to content

Commit 2928673

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 2928673

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/sys/unix.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,8 @@ impl crate::Socket {
18341834
target_os = "macos",
18351835
target_os = "tvos",
18361836
target_os = "watchos",
1837+
target_os = "illumos",
1838+
target_os = "solaris",
18371839
)
18381840
))]
18391841
pub fn bind_device_by_index_v4(&self, interface: Option<NonZeroU32>) -> io::Result<()> {
@@ -1859,6 +1861,8 @@ impl crate::Socket {
18591861
target_os = "macos",
18601862
target_os = "tvos",
18611863
target_os = "watchos",
1864+
target_os = "illumos",
1865+
target_os = "solaris",
18621866
)
18631867
))]
18641868
pub fn bind_device_by_index_v6(&self, interface: Option<NonZeroU32>) -> io::Result<()> {
@@ -1879,6 +1883,8 @@ impl crate::Socket {
18791883
target_os = "macos",
18801884
target_os = "tvos",
18811885
target_os = "watchos",
1886+
target_os = "illumos",
1887+
target_os = "solaris",
18821888
)
18831889
))]
18841890
pub fn device_index_v4(&self) -> io::Result<Option<NonZeroU32>> {
@@ -1900,6 +1906,8 @@ impl crate::Socket {
19001906
target_os = "macos",
19011907
target_os = "tvos",
19021908
target_os = "watchos",
1909+
target_os = "illumos",
1910+
target_os = "solaris",
19031911
)
19041912
))]
19051913
pub fn device_index_v6(&self) -> io::Result<Option<NonZeroU32>> {

0 commit comments

Comments
 (0)