summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorarthurprs <arthurprs@gmail.com>2015-12-29 12:50:09 +0000
committerCarl Lerche <me@carllerche.com>2016-01-18 21:29:39 -0800
commitc4257f8a76b69b0d2e9a001d83e4bef67c03b23f (patch)
tree46efa63947fd4fd51f1eea514e56b20cd3d7ae11 /src
parentc35e7f87818d73dd655e74f8c8853ef7ae077054 (diff)
downloadnix-c4257f8a76b69b0d2e9a001d83e4bef67c03b23f.zip
improve bsd unixes ipv6 support
Diffstat (limited to 'src')
-rw-r--r--src/sys/socket/consts.rs16
-rw-r--r--src/sys/socket/sockopt.rs4
2 files changed, 8 insertions, 12 deletions
diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs
index 4b5f7092..5cb69202 100644
--- a/src/sys/socket/consts.rs
+++ b/src/sys/socket/consts.rs
@@ -204,16 +204,10 @@ mod os {
pub const IP_ADD_MEMBERSHIP: c_int = 12;
pub const IP_DROP_MEMBERSHIP: c_int = 13;
- #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd")))]
- pub const IPV6_ADD_MEMBERSHIP: c_int = libc::IPV6_ADD_MEMBERSHIP;
- #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd")))]
- pub const IPV6_DROP_MEMBERSHIP: c_int = libc::IPV6_DROP_MEMBERSHIP;
-
- #[cfg(target_os = "netbsd")]
- pub const IPV6_JOIN_GROUP: c_int = 12;
-
- #[cfg(target_os = "netbsd")]
- pub const IPV6_LEAVE_GROUP: c_int = 13;
+ #[cfg(not(target_os = "openbsd"))]
+ pub const IPV6_JOIN_GROUP: c_int = libc::IPV6_JOIN_GROUP;
+ #[cfg(not(target_os = "openbsd"))]
+ pub const IPV6_LEAVE_GROUP: c_int = libc::IPV6_LEAVE_GROUP;
pub type InAddrT = u32;
@@ -295,6 +289,8 @@ mod os {
pub const IP_MULTICAST_LOOP: c_int = 11;
pub const IP_ADD_MEMBERSHIP: c_int = 12;
pub const IP_DROP_MEMBERSHIP: c_int = 13;
+ pub const IPV6_JOIN_GROUP: c_int = libc::IPV6_JOIN_GROUP;
+ pub const IPV6_LEAVE_GROUP: c_int = libc::IPV6_LEAVE_GROUP;
pub type InAddrT = u32;
diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs
index ef972fc9..4fea8d53 100644
--- a/src/sys/socket/sockopt.rs
+++ b/src/sys/socket/sockopt.rs
@@ -125,9 +125,9 @@ sockopt_impl!(SetOnly, IpDropMembership, consts::IPPROTO_IP, consts::IP_DROP_MEM
sockopt_impl!(SetOnly, Ipv6AddMembership, consts::IPPROTO_IPV6, consts::IPV6_ADD_MEMBERSHIP, super::ipv6_mreq);
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd")))]
sockopt_impl!(SetOnly, Ipv6DropMembership, consts::IPPROTO_IPV6, consts::IPV6_DROP_MEMBERSHIP, super::ipv6_mreq);
-#[cfg(target_os = "netbsd")]
+#[cfg(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd"))]
sockopt_impl!(SetOnly, Ipv6AddMembership, consts::IPPROTO_IPV6, consts::IPV6_JOIN_GROUP, super::ipv6_mreq);
-#[cfg(target_os = "netbsd")]
+#[cfg(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd"))]
sockopt_impl!(SetOnly, Ipv6DropMembership, consts::IPPROTO_IPV6, consts::IPV6_LEAVE_GROUP, super::ipv6_mreq);
sockopt_impl!(Both, IpMulticastTtl, consts::IPPROTO_IP, consts::IP_MULTICAST_TTL, u8);
sockopt_impl!(Both, IpMulticastLoop, consts::IPPROTO_IP, consts::IP_MULTICAST_LOOP, bool);