Allow for ARP retry during egress

This commit is contained in:
whitequark 2020-08-11 16:35:23 +00:00 committed by GitHub
commit 11e97f3a06
2 changed files with 6 additions and 3 deletions

View File

@ -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
}

View File

@ -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
}