Skip to content

Commit

Permalink
Add support for IPPROTO_DIVERT
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsen authored Jun 13, 2023
1 parent 54e7215 commit 9ce984d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ impl Protocol {
)
))]
pub const UDPLITE: Protocol = Protocol(sys::IPPROTO_UDPLITE);

/// Protocol corresponding to `DIVERT`.
#[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "openbsd")))]
pub const DIVERT: Protocol = Protocol(sys::IPPROTO_DIVERT);
}

impl From<c_int> for Protocol {
Expand Down
4 changes: 4 additions & 0 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ pub(crate) use libc::IPPROTO_SCTP;
pub(crate) use libc::IPPROTO_UDPLITE;
pub(crate) use libc::{IPPROTO_ICMP, IPPROTO_ICMPV6, IPPROTO_TCP, IPPROTO_UDP};
// Used in `SockAddr`.
#[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "openbsd")))]
pub(crate) use libc::IPPROTO_DIVERT;
pub(crate) use libc::{
sa_family_t, sockaddr, sockaddr_in, sockaddr_in6, sockaddr_storage, socklen_t,
};
Expand Down Expand Up @@ -520,6 +522,8 @@ impl_debug!(
)
))]
libc::IPPROTO_UDPLITE,
#[cfg(all(feature = "all", any(target_os = "freebsd", target_os = "openbsd")))]
libc::IPPROTO_DIVERT,
);

/// Unix-only API.
Expand Down

0 comments on commit 9ce984d

Please sign in to comment.