File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ pub enum AddressFamily {
81
81
#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
82
82
#[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
83
83
Netlink = libc:: AF_NETLINK ,
84
+ /// Kernel interface for interacting with the routing table
85
+ #[ cfg( target_os = "macos" ) ]
86
+ Route = libc:: PF_ROUTE ,
84
87
/// Low level packet interface (see [`packet(7)`](https://man7.org/linux/man-pages/man7/packet.7.html))
85
88
#[ cfg( any(
86
89
target_os = "android" ,
@@ -422,6 +425,8 @@ impl AddressFamily {
422
425
libc:: AF_NETLINK => Some ( AddressFamily :: Netlink ) ,
423
426
#[ cfg( any( target_os = "macos" , target_os = "macos" ) ) ]
424
427
libc:: AF_SYSTEM => Some ( AddressFamily :: System ) ,
428
+ #[ cfg( target_os = "macos" ) ]
429
+ libc:: PF_ROUTE => Some ( AddressFamily :: Route ) ,
425
430
#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
426
431
libc:: AF_PACKET => Some ( AddressFamily :: Packet ) ,
427
432
#[ cfg( any(
Original file line number Diff line number Diff line change @@ -2462,4 +2462,16 @@ mod tests {
2462
2462
fn can_use_cmsg_space ( ) {
2463
2463
let _ = cmsg_space ! ( u8 ) ;
2464
2464
}
2465
+
2466
+ #[ cfg( target_os = "macos" ) ]
2467
+ #[ test]
2468
+ fn can_open_routing_socket ( ) {
2469
+ let _ = super :: socket (
2470
+ super :: AddressFamily :: Route ,
2471
+ super :: SockType :: Raw ,
2472
+ super :: SockFlag :: empty ( ) ,
2473
+ None ,
2474
+ )
2475
+ . expect ( "Failed to open routing socket" ) ;
2476
+ }
2465
2477
}
You can’t perform that action at this time.
0 commit comments