summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/sys/socket/addr.rs5
-rw-r--r--src/sys/socket/mod.rs12
3 files changed, 20 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1ed2e8a..129d93f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased] - ReleaseDate
### Added
+- Add `PF_ROUTE` to `SockType` on macOS, iOS, all of the BSDs, Fuchsia, Haiku, Illumos.
+ ([#1867](https://github.com/nix-rust/nix/pull/1867))
+
### Changed
### Fixed
### Removed
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs
index 8b23b10c..55a7b2ff 100644
--- a/src/sys/socket/addr.rs
+++ b/src/sys/socket/addr.rs
@@ -80,6 +80,9 @@ pub enum AddressFamily {
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
Netlink = libc::AF_NETLINK,
+ /// Kernel interface for interacting with the routing table
+ #[cfg(not(any(target_os = "redox", target_os = "linux", target_os = "android")))]
+ Route = libc::PF_ROUTE,
/// Low level packet interface (see [`packet(7)`](https://man7.org/linux/man-pages/man7/packet.7.html))
#[cfg(any(
target_os = "android",
@@ -421,6 +424,8 @@ impl AddressFamily {
libc::AF_NETLINK => Some(AddressFamily::Netlink),
#[cfg(any(target_os = "macos", target_os = "macos"))]
libc::AF_SYSTEM => Some(AddressFamily::System),
+ #[cfg(not(any(target_os = "redox", target_os = "linux", target_os = "android")))]
+ libc::PF_ROUTE => Some(AddressFamily::Route),
#[cfg(any(target_os = "android", target_os = "linux"))]
libc::AF_PACKET => Some(AddressFamily::Packet),
#[cfg(any(
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index 2d7159a6..154403c5 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -2484,4 +2484,16 @@ mod tests {
fn can_use_cmsg_space() {
let _ = cmsg_space!(u8);
}
+
+ #[cfg(not(any(target_os = "redox", target_os = "linux", target_os = "android")))]
+ #[test]
+ fn can_open_routing_socket() {
+ let _ = super::socket(
+ super::AddressFamily::Route,
+ super::SockType::Raw,
+ super::SockFlag::empty(),
+ None,
+ )
+ .expect("Failed to open routing socket");
+ }
}