arp: If first ARP announce fails, rely on the second announce.

The previous approach would desynchronize the state machine if the
carrier is paused after receiving the lease but before sending the
announce, since we have received a lease already.

This change is an improvement but is still not ideal.
This commit is contained in:
Nicholas J. Kain 2017-02-24 04:57:33 -05:00
parent fa1c5d3a0c
commit 09d5e9ad3c

View File

@ -510,12 +510,16 @@ int arp_collision_timeout(struct client_state_t cs[static 1], long long nowts)
} }
stop_dhcp_listen(cs); stop_dhcp_listen(cs);
write_leasefile(temp_addr); write_leasefile(temp_addr);
int ret = ARPR_FREE; if (arp_announcement(cs) < 0) {
if (arp_announcement(cs) < 0) log_warning("%s: (%s) Failed to send first ARP announcement: %s",
ret = ARPR_FAIL; client_config.interface, __func__, strerror(errno));
// If we return ARPR_FAIL here, the state machine will get messed up since we
// do have a binding, we've just not announced it yet. Ideally, we will note
// this issue and will try to announce again.
}
if (client_config.quit_after_lease) if (client_config.quit_after_lease)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
return ret; return ARPR_FREE;
} }
long long rtts = garp.send_stats[ASEND_COLLISION_CHECK].ts + long long rtts = garp.send_stats[ASEND_COLLISION_CHECK].ts +
garp.probe_wait_time; garp.probe_wait_time;