Skip to content

Commit

Permalink
Fix build on non-Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Feb 5, 2024
1 parent ac42487 commit ea84e83
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions aggligator-util/src/bin/raw-speed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,24 @@ impl RawClientCli {
{
let mut bound = false;

for ifn in ifaces {
'ifaces: for ifn in ifaces {
if ifn.name.as_bytes() == iface {
let Some(addr) = ifn.addr else { continue };
match (addr.ip(), target.ip()) {
(IpAddr::V4(_), IpAddr::V4(_)) => (),
(IpAddr::V6(_), IpAddr::V6(_)) => (),
_ => continue,
}
for addr in &ifn.addr {
match (addr.ip(), target.ip()) {
(IpAddr::V4(_), IpAddr::V4(_)) => (),
(IpAddr::V6(_), IpAddr::V6(_)) => (),
_ => continue,
}

if addr.ip().is_loopback() != target.ip().is_loopback() {
continue;
}
if addr.ip().is_loopback() != target.ip().is_loopback() {
continue;
}

tracing::debug!("binding to {addr:?} on interface {}", &ifn.name);
socket.bind(SocketAddr::new(addr.ip(), 0))?;
bound = true;
break;
tracing::debug!("binding to {addr:?} on interface {}", &ifn.name);
socket.bind(SocketAddr::new(addr.ip(), 0))?;
bound = true;
break 'ifaces;
}
}
}

Expand Down

0 comments on commit ea84e83

Please sign in to comment.