Skip to content

Commit 9ce984d

Browse files
authored
Add support for IPPROTO_DIVERT
1 parent 54e7215 commit 9ce984d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ impl Protocol {
339339
)
340340
))]
341341
pub const UDPLITE: Protocol = Protocol(sys::IPPROTO_UDPLITE);
342+
343+
/// Protocol corresponding to `DIVERT`.
344+
#[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "openbsd")))]
345+
pub const DIVERT: Protocol = Protocol(sys::IPPROTO_DIVERT);
342346
}
343347

344348
impl From<c_int> for Protocol {

src/sys/unix.rs

+4
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ pub(crate) use libc::IPPROTO_SCTP;
105105
pub(crate) use libc::IPPROTO_UDPLITE;
106106
pub(crate) use libc::{IPPROTO_ICMP, IPPROTO_ICMPV6, IPPROTO_TCP, IPPROTO_UDP};
107107
// Used in `SockAddr`.
108+
#[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "openbsd")))]
109+
pub(crate) use libc::IPPROTO_DIVERT;
108110
pub(crate) use libc::{
109111
sa_family_t, sockaddr, sockaddr_in, sockaddr_in6, sockaddr_storage, socklen_t,
110112
};
@@ -520,6 +522,8 @@ impl_debug!(
520522
)
521523
))]
522524
libc::IPPROTO_UDPLITE,
525+
#[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "openbsd")))]
526+
libc::IPPROTO_DIVERT,
523527
);
524528

525529
/// Unix-only API.

0 commit comments

Comments
 (0)