Skip to content

Commit d95e914

Browse files
authored
Enable IP_BOUND_IF on illumos and Solaris (#561) (#566)
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 56e625e commit d95e914

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ targets = ["aarch64-apple-ios", "aarch64-linux-android", "x86_64-apple-darwin",
3535
features = ["all"]
3636

3737
[target."cfg(unix)".dependencies]
38-
libc = "0.2.150"
38+
libc = "0.2.171"
3939

4040
[target.'cfg(windows)'.dependencies.windows-sys]
4141
version = "0.52"

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;
@@ -2076,6 +2078,8 @@ impl crate::Socket {
20762078
target_os = "macos",
20772079
target_os = "tvos",
20782080
target_os = "watchos",
2081+
target_os = "illumos",
2082+
target_os = "solaris",
20792083
)
20802084
))]
20812085
#[cfg_attr(
@@ -2114,6 +2118,8 @@ impl crate::Socket {
21142118
target_os = "macos",
21152119
target_os = "tvos",
21162120
target_os = "watchos",
2121+
target_os = "illumos",
2122+
target_os = "solaris",
21172123
)
21182124
))]
21192125
#[cfg_attr(
@@ -2147,6 +2153,8 @@ impl crate::Socket {
21472153
target_os = "macos",
21482154
target_os = "tvos",
21492155
target_os = "watchos",
2156+
target_os = "illumos",
2157+
target_os = "solaris",
21502158
)
21512159
))]
21522160
#[cfg_attr(
@@ -2210,6 +2218,8 @@ impl crate::Socket {
22102218
target_os = "macos",
22112219
target_os = "tvos",
22122220
target_os = "watchos",
2221+
target_os = "illumos",
2222+
target_os = "solaris",
22132223
)
22142224
))]
22152225
#[cfg_attr(

tests/socket.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,8 @@ fn device() {
990990
target_os = "macos",
991991
target_os = "tvos",
992992
target_os = "watchos",
993+
target_os = "solaris",
994+
target_os = "illumos",
993995
)
994996
))]
995997
#[test]
@@ -1036,6 +1038,8 @@ fn device() {
10361038
target_os = "macos",
10371039
target_os = "tvos",
10381040
target_os = "watchos",
1041+
target_os = "solaris",
1042+
target_os = "illumos",
10391043
)
10401044
))]
10411045
#[test]

0 commit comments

Comments
 (0)