From 09d5e9ad3c58a440614dcd3a8c8ebf1f2b897f6c Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Fri, 24 Feb 2017 04:57:33 -0500 Subject: [PATCH] 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. --- src/arp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/arp.c b/src/arp.c index 096885d..cfae884 100644 --- a/src/arp.c +++ b/src/arp.c @@ -510,12 +510,16 @@ int arp_collision_timeout(struct client_state_t cs[static 1], long long nowts) } stop_dhcp_listen(cs); write_leasefile(temp_addr); - int ret = ARPR_FREE; - if (arp_announcement(cs) < 0) - ret = ARPR_FAIL; + if (arp_announcement(cs) < 0) { + log_warning("%s: (%s) Failed to send first ARP announcement: %s", + 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) exit(EXIT_SUCCESS); - return ret; + return ARPR_FREE; } long long rtts = garp.send_stats[ASEND_COLLISION_CHECK].ts + garp.probe_wait_time;