Rename ARP_GW_CHECK to BOUND_GW_CHECK and call anfrelease() rather than
frelease() for this state.
This commit is contained in:
parent
3f6aafe809
commit
d89e9f89c2
@ -153,7 +153,7 @@ int arp_gw_check(struct client_state_t *cs)
|
|||||||
if (arpping(cs, cs->routerAddr) == -1)
|
if (arpping(cs, cs->routerAddr) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
cs->arpPrevState = cs->dhcpState;
|
cs->arpPrevState = cs->dhcpState;
|
||||||
cs->dhcpState = DS_ARP_GW_CHECK;
|
cs->dhcpState = DS_BOUND_GW_CHECK;
|
||||||
cs->oldTimeout = cs->timeout;
|
cs->oldTimeout = cs->timeout;
|
||||||
cs->timeout = 2000;
|
cs->timeout = 2000;
|
||||||
memset(&arp_dhcp_packet, 0, sizeof (struct dhcpmsg));
|
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");
|
log_line("arp: Gateway appears to have changed, getting new lease");
|
||||||
arp_close_fd(cs);
|
arp_close_fd(cs);
|
||||||
|
|
||||||
// Same as packet.c: line 258
|
|
||||||
ifchange(NULL, IFCHANGE_DECONFIG);
|
ifchange(NULL, IFCHANGE_DECONFIG);
|
||||||
cs->dhcpState = DS_SELECTING;
|
cs->dhcpState = DS_SELECTING;
|
||||||
cs->oldTimeout = 0;
|
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));
|
log_error("arp: ARP response read failed: %s", strerror(errno));
|
||||||
switch (cs->dhcpState) {
|
switch (cs->dhcpState) {
|
||||||
case DS_ARP_CHECK: arp_failed(cs); break;
|
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
|
case DS_BOUND: break; // keep trying for finding gw mac
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@ -327,7 +326,7 @@ void handle_arp_response(struct client_state_t *cs)
|
|||||||
arpreply_clear();
|
arpreply_clear();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DS_ARP_GW_CHECK:
|
case DS_BOUND_GW_CHECK:
|
||||||
if (!memcmp(arpreply.sip4, &cs->routerAddr, 4)) {
|
if (!memcmp(arpreply.sip4, &cs->routerAddr, 4)) {
|
||||||
// Success only if the router/gw MAC matches stored value
|
// Success only if the router/gw MAC matches stored value
|
||||||
if (!memcmp(cs->routerArp, arpreply.smac, 6))
|
if (!memcmp(cs->routerArp, arpreply.smac, 6))
|
||||||
|
@ -41,7 +41,7 @@ dhcp_state_t dhcp_states[] = {
|
|||||||
{ 0, bound_timeout, frenew, nfrelease}, // BOUND
|
{ 0, bound_timeout, frenew, nfrelease}, // BOUND
|
||||||
{ an_packet, renewing_timeout, frenew, nfrelease}, // RENEWING
|
{ an_packet, renewing_timeout, frenew, nfrelease}, // RENEWING
|
||||||
{ an_packet, rebinding_timeout, frenew, nfrelease}, // REBINDING
|
{ 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, arp_success, frenew, anfrelease}, // ARP_CHECK
|
||||||
{ 0, released_timeout, frenew, frelease}, // RELEASED
|
{ 0, released_timeout, frenew, frelease}, // RELEASED
|
||||||
{ 0, 0, 0, 0}, // NUM_STATES
|
{ 0, 0, 0, 0}, // NUM_STATES
|
||||||
|
@ -10,7 +10,7 @@ typedef enum {
|
|||||||
DS_BOUND,
|
DS_BOUND,
|
||||||
DS_RENEWING,
|
DS_RENEWING,
|
||||||
DS_REBINDING,
|
DS_REBINDING,
|
||||||
DS_ARP_GW_CHECK,
|
DS_BOUND_GW_CHECK,
|
||||||
DS_ARP_CHECK,
|
DS_ARP_CHECK,
|
||||||
DS_RELEASED,
|
DS_RELEASED,
|
||||||
DS_NUM_STATES,
|
DS_NUM_STATES,
|
||||||
|
Loading…
Reference in New Issue
Block a user