Skip to content

Commit c4257f8

Browse files
arthurprscarllerche
authored andcommitted
improve bsd unixes ipv6 support
1 parent c35e7f8 commit c4257f8

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/sys/socket/consts.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,10 @@ mod os {
204204
pub const IP_ADD_MEMBERSHIP: c_int = 12;
205205
pub const IP_DROP_MEMBERSHIP: c_int = 13;
206206

207-
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd")))]
208-
pub const IPV6_ADD_MEMBERSHIP: c_int = libc::IPV6_ADD_MEMBERSHIP;
209-
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd")))]
210-
pub const IPV6_DROP_MEMBERSHIP: c_int = libc::IPV6_DROP_MEMBERSHIP;
211-
212-
#[cfg(target_os = "netbsd")]
213-
pub const IPV6_JOIN_GROUP: c_int = 12;
214-
215-
#[cfg(target_os = "netbsd")]
216-
pub const IPV6_LEAVE_GROUP: c_int = 13;
207+
#[cfg(not(target_os = "openbsd"))]
208+
pub const IPV6_JOIN_GROUP: c_int = libc::IPV6_JOIN_GROUP;
209+
#[cfg(not(target_os = "openbsd"))]
210+
pub const IPV6_LEAVE_GROUP: c_int = libc::IPV6_LEAVE_GROUP;
217211

218212
pub type InAddrT = u32;
219213

@@ -295,6 +289,8 @@ mod os {
295289
pub const IP_MULTICAST_LOOP: c_int = 11;
296290
pub const IP_ADD_MEMBERSHIP: c_int = 12;
297291
pub const IP_DROP_MEMBERSHIP: c_int = 13;
292+
pub const IPV6_JOIN_GROUP: c_int = libc::IPV6_JOIN_GROUP;
293+
pub const IPV6_LEAVE_GROUP: c_int = libc::IPV6_LEAVE_GROUP;
298294

299295
pub type InAddrT = u32;
300296

src/sys/socket/sockopt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ sockopt_impl!(SetOnly, IpDropMembership, consts::IPPROTO_IP, consts::IP_DROP_MEM
125125
sockopt_impl!(SetOnly, Ipv6AddMembership, consts::IPPROTO_IPV6, consts::IPV6_ADD_MEMBERSHIP, super::ipv6_mreq);
126126
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd")))]
127127
sockopt_impl!(SetOnly, Ipv6DropMembership, consts::IPPROTO_IPV6, consts::IPV6_DROP_MEMBERSHIP, super::ipv6_mreq);
128-
#[cfg(target_os = "netbsd")]
128+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd"))]
129129
sockopt_impl!(SetOnly, Ipv6AddMembership, consts::IPPROTO_IPV6, consts::IPV6_JOIN_GROUP, super::ipv6_mreq);
130-
#[cfg(target_os = "netbsd")]
130+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd"))]
131131
sockopt_impl!(SetOnly, Ipv6DropMembership, consts::IPPROTO_IPV6, consts::IPV6_LEAVE_GROUP, super::ipv6_mreq);
132132
sockopt_impl!(Both, IpMulticastTtl, consts::IPPROTO_IP, consts::IP_MULTICAST_TTL, u8);
133133
sockopt_impl!(Both, IpMulticastLoop, consts::IPPROTO_IP, consts::IP_MULTICAST_LOOP, bool);

0 commit comments

Comments
 (0)