Add error handling for un-notified carrier downs in ifup_action.

This commit is contained in:
Nicholas J. Kain 2015-02-14 05:37:06 -05:00
parent b6b778831c
commit 56cc05599a
2 changed files with 10 additions and 6 deletions

View File

@ -363,12 +363,13 @@ int arp_gw_check(struct client_state_t cs[static 1])
return 0;
garp.gw_check_initpings = garp.send_stats[ASEND_GW_PING].count;
garp.server_replied = false;
if (arp_ping(cs, cs->srcAddr) < 0)
return -1;
int r;
if ((r = arp_ping(cs, cs->srcAddr)) < 0)
return r;
if (cs->routerAddr) {
garp.router_replied = false;
if (arp_ping(cs, cs->routerAddr) < 0)
return -1;
if ((r = arp_ping(cs, cs->routerAddr)) < 0)
return r;
} else
garp.router_replied = true;
arp_switch_state(cs, AS_GW_CHECK);

View File

@ -425,13 +425,16 @@ void ifup_action(struct client_state_t cs[static 1])
if (cs->routerAddr && (cs->dhcpState == DS_BOUND ||
cs->dhcpState == DS_RENEWING ||
cs->dhcpState == DS_REBINDING)) {
if (arp_gw_check(cs) != -1) {
int r = arp_gw_check(cs);
if (r >= 0) {
log_line("%s: Interface is back. Revalidating lease...",
client_config.interface);
return;
} else
} else {
SUSPEND_IF_NOCARRIER();
log_warning("%s: arp_gw_check could not make arp socket.",
client_config.interface);
}
}
if (cs->dhcpState == DS_SELECTING)
return;