diff --git a/ndhc/arp.c b/ndhc/arp.c index 2018ffc..f0ded3a 100644 --- a/ndhc/arp.c +++ b/ndhc/arp.c @@ -1,5 +1,5 @@ /* 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 * @@ -419,6 +419,11 @@ static int act_if_arp_gw_failed(struct client_state_t *cs) 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) { cs->timeout = (cs->renewTime * 1000) - (curms() - cs->leaseStartTime); diff --git a/ndhc/arp.h b/ndhc/arp.h index 3c8d1ab..8328392 100644 --- a/ndhc/arp.h +++ b/ndhc/arp.h @@ -1,5 +1,5 @@ /* 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 * @@ -51,6 +51,7 @@ void arp_reset_send_stats(void); int arp_close_fd(struct client_state_t *cs); int arp_check(struct client_state_t *cs, struct dhcpmsg *packet); 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_retransmit(struct client_state_t *cs); void handle_arp_response(struct client_state_t *cs); diff --git a/ndhc/state.c b/ndhc/state.c index d7f77a9..25e9fec 100644 --- a/ndhc/state.c +++ b/ndhc/state.c @@ -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"); 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) {