Fix a regression: if renewing or rebinding a dhcp lease that matches our
previous client ip, make sure to stop listening for dhcp packets, set the proper timeout interval, and make sure we're in AS_DEFENSE state.
This commit is contained in:
parent
080fefaea0
commit
8beb1d12d1
@ -1,5 +1,5 @@
|
|||||||
/* arp.c - arp ping checking
|
/* arp.c - arp ping checking
|
||||||
* Time-stamp: <2011-07-06 09:18:58 njk>
|
* Time-stamp: <2011-07-06 11:39:23 njk>
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com>
|
* Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com>
|
||||||
*
|
*
|
||||||
@ -419,6 +419,11 @@ static int act_if_arp_gw_failed(struct client_state_t *cs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void arp_set_defense_mode(struct client_state_t *cs)
|
||||||
|
{
|
||||||
|
arp_switch_state(cs, AS_DEFENSE);
|
||||||
|
}
|
||||||
|
|
||||||
void arp_success(struct client_state_t *cs)
|
void arp_success(struct client_state_t *cs)
|
||||||
{
|
{
|
||||||
cs->timeout = (cs->renewTime * 1000) - (curms() - cs->leaseStartTime);
|
cs->timeout = (cs->renewTime * 1000) - (curms() - cs->leaseStartTime);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* arp.h - functions to call the interface change daemon
|
/* arp.h - functions to call the interface change daemon
|
||||||
* Time-stamp: <2011-07-05 15:54:33 njk>
|
* Time-stamp: <2011-07-06 11:39:42 njk>
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com>
|
* Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com>
|
||||||
*
|
*
|
||||||
@ -51,6 +51,7 @@ void arp_reset_send_stats(void);
|
|||||||
int arp_close_fd(struct client_state_t *cs);
|
int arp_close_fd(struct client_state_t *cs);
|
||||||
int arp_check(struct client_state_t *cs, struct dhcpmsg *packet);
|
int arp_check(struct client_state_t *cs, struct dhcpmsg *packet);
|
||||||
int arp_gw_check(struct client_state_t *cs);
|
int arp_gw_check(struct client_state_t *cs);
|
||||||
|
void arp_set_defense_mode(struct client_state_t *cs);
|
||||||
void arp_success(struct client_state_t *cs);
|
void arp_success(struct client_state_t *cs);
|
||||||
void arp_retransmit(struct client_state_t *cs);
|
void arp_retransmit(struct client_state_t *cs);
|
||||||
void handle_arp_response(struct client_state_t *cs);
|
void handle_arp_response(struct client_state_t *cs);
|
||||||
|
@ -212,6 +212,11 @@ static void an_packet(struct client_state_t *cs, struct dhcpmsg *packet,
|
|||||||
log_warning("arp_check failed to make arp socket, retrying lease");
|
log_warning("arp_check failed to make arp socket, retrying lease");
|
||||||
reinit_selecting(cs, 3000);
|
reinit_selecting(cs, 3000);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
cs->dhcpState = DS_BOUND;
|
||||||
|
cs->timeout = cs->renewTime * 1000;
|
||||||
|
arp_set_defense_mode(cs);
|
||||||
|
set_listen_none(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (*message == DHCPNAK) {
|
} else if (*message == DHCPNAK) {
|
||||||
|
Loading…
Reference in New Issue
Block a user