Skip to content

Commit

Permalink
Allow for ARP retry during egress
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark authored Aug 11, 2020
2 parents cc85616 + eba8d0e commit e3c7c38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/iface/ethernet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ impl<'b, 'c, 'e, DeviceT> Interface<'b, 'c, 'e, DeviceT>

let mut emitted_any = false;
for mut socket in sockets.iter_mut() {
if !socket.meta_mut().egress_permitted(|ip_addr|
if !socket.meta_mut().egress_permitted(timestamp, |ip_addr|
self.inner.has_neighbor(&ip_addr, timestamp)) {
continue
}
Expand Down
7 changes: 5 additions & 2 deletions src/socket/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,21 @@ impl Meta {
}
}

pub(crate) fn egress_permitted<F>(&mut self, has_neighbor: F) -> bool
pub(crate) fn egress_permitted<F>(&mut self, timestamp: Instant, has_neighbor: F) -> bool
where F: Fn(IpAddress) -> bool
{
match self.neighbor_state {
NeighborState::Active =>
true,
NeighborState::Waiting { neighbor, .. } => {
NeighborState::Waiting { neighbor, silent_until } => {
if has_neighbor(neighbor) {
net_trace!("{}: neighbor {} discovered, unsilencing",
self.handle, neighbor);
self.neighbor_state = NeighborState::Active;
true
} else if timestamp > silent_until {
net_trace!("{}: neighbor {} silence timer expired, rediscovering", self.handle, neighbor);
true
} else {
false
}
Expand Down

0 comments on commit e3c7c38

Please sign in to comment.