Rename ARP_GW_CHECK to BOUND_GW_CHECK and call anfrelease() rather than

frelease() for this state.
This commit is contained in:
Nicholas J. Kain 2011-06-30 00:39:17 -04:00
parent 3f6aafe809
commit d89e9f89c2
3 changed files with 5 additions and 6 deletions

View File

@ -153,7 +153,7 @@ int arp_gw_check(struct client_state_t *cs)
if (arpping(cs, cs->routerAddr) == -1)
return -1;
cs->arpPrevState = cs->dhcpState;
cs->dhcpState = DS_ARP_GW_CHECK;
cs->dhcpState = DS_BOUND_GW_CHECK;
cs->oldTimeout = cs->timeout;
cs->timeout = 2000;
memset(&arp_dhcp_packet, 0, sizeof (struct dhcpmsg));
@ -193,7 +193,6 @@ void arp_gw_failed(struct client_state_t *cs)
log_line("arp: Gateway appears to have changed, getting new lease");
arp_close_fd(cs);
// Same as packet.c: line 258
ifchange(NULL, IFCHANGE_DECONFIG);
cs->dhcpState = DS_SELECTING;
cs->oldTimeout = 0;
@ -295,7 +294,7 @@ void handle_arp_response(struct client_state_t *cs)
log_error("arp: ARP response read failed: %s", strerror(errno));
switch (cs->dhcpState) {
case DS_ARP_CHECK: arp_failed(cs); break;
case DS_ARP_GW_CHECK: arp_gw_failed(cs); break;
case DS_BOUND_GW_CHECK: arp_gw_failed(cs); break;
case DS_BOUND: break; // keep trying for finding gw mac
default: break;
}
@ -327,7 +326,7 @@ void handle_arp_response(struct client_state_t *cs)
arpreply_clear();
}
break;
case DS_ARP_GW_CHECK:
case DS_BOUND_GW_CHECK:
if (!memcmp(arpreply.sip4, &cs->routerAddr, 4)) {
// Success only if the router/gw MAC matches stored value
if (!memcmp(cs->routerArp, arpreply.smac, 6))

View File

@ -41,7 +41,7 @@ dhcp_state_t dhcp_states[] = {
{ 0, bound_timeout, frenew, nfrelease}, // BOUND
{ an_packet, renewing_timeout, frenew, nfrelease}, // RENEWING
{ an_packet, rebinding_timeout, frenew, nfrelease}, // REBINDING
{ 0, arp_gw_failed, frenew, frelease}, // ARP_GW_CHECK XXX
{ 0, arp_gw_failed, frenew, anfrelease}, // BOUND_GW_CHECK
{ 0, arp_success, frenew, anfrelease}, // ARP_CHECK
{ 0, released_timeout, frenew, frelease}, // RELEASED
{ 0, 0, 0, 0}, // NUM_STATES

View File

@ -10,7 +10,7 @@ typedef enum {
DS_BOUND,
DS_RENEWING,
DS_REBINDING,
DS_ARP_GW_CHECK,
DS_BOUND_GW_CHECK,
DS_ARP_CHECK,
DS_RELEASED,
DS_NUM_STATES,