Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xmh0511 committed Sep 11, 2024
1 parent 9b621fc commit c574913
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/getifaddrs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,15 @@ mod unix {
.and_then(|sa| sockaddr_to_ipaddr(sa).ok())
};

#[cfg(not(target_os = "linux"))]
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
let dest_addr = unsafe {
ifaddr
.ifa_dstaddr
.as_ref()
.and_then(|sa| sockaddr_to_ipaddr(sa).ok())
};

#[cfg(target_os = "linux")]
#[cfg(all(not(target_os = "macos"), not(target_os = "freebsd")))]
let dest_addr = None;

return Some(Interface {
Expand Down Expand Up @@ -890,7 +890,7 @@ mod tests {
.unwrap()
.collect();
eprintln!("Name filter {name}: {v:?}");
assert!(v.len() >= 1);
assert!(!v.is_empty());
for interface in v {
assert_eq!(name, interface.name);
}
Expand All @@ -899,7 +899,7 @@ mod tests {
if let Some(index) = interface.index {
let v: Vec<_> = InterfaceFilter::new().index(index).get().unwrap().collect();
eprintln!("Index filter {index}: {v:?}");
assert!(v.len() >= 1);
assert!(!v.is_empty());
for interface in v {
assert_eq!(Some(index), interface.index);
}
Expand Down

0 comments on commit c574913

Please sign in to comment.