Call arp_close_fd() from reinit_selecting().

This commit is contained in:
Nicholas J. Kain 2011-07-05 16:02:11 -04:00
parent 3205f823d9
commit 04c380cd3b
2 changed files with 2 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/* arp.c - arp ping checking /* arp.c - arp ping checking
* Time-stamp: <2011-07-05 15:54:06 njk> * Time-stamp: <2011-07-05 16:00:42 njk>
* *
* Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com> * Copyright 2010-2011 Nicholas J. Kain <njkain@gmail.com>
* *
@ -402,7 +402,6 @@ static int arp_get_gw_hwaddr(struct client_state_t *cs)
static void arp_failed(struct client_state_t *cs) static void arp_failed(struct client_state_t *cs)
{ {
log_line("arp: Offered address is in use -- declining"); log_line("arp: Offered address is in use -- declining");
arp_close_fd(cs);
send_decline(cs, arp_dhcp_packet.yiaddr); send_decline(cs, arp_dhcp_packet.yiaddr);
reinit_selecting(cs, total_conflicts < MAX_CONFLICTS ? reinit_selecting(cs, total_conflicts < MAX_CONFLICTS ?
0 : RATE_LIMIT_INTERVAL); 0 : RATE_LIMIT_INTERVAL);
@ -411,7 +410,6 @@ static void arp_failed(struct client_state_t *cs)
static void arp_gw_failed(struct client_state_t *cs) static 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);
cs->oldTimeout = 0; cs->oldTimeout = 0;
reinit_selecting(cs, 0); reinit_selecting(cs, 0);
} }
@ -586,7 +584,6 @@ static void arp_do_defense(struct client_state_t *cs)
arp_announcement(cs); arp_announcement(cs);
} else if (!arp_relentless_def) { } else if (!arp_relentless_def) {
log_line("arp: Conflicting peer is persistent. Requesting new lease."); log_line("arp: Conflicting peer is persistent. Requesting new lease.");
arp_close_fd(cs);
send_release(cs); send_release(cs);
reinit_selecting(cs, 0); reinit_selecting(cs, 0);
} else { } else {

View File

@ -63,13 +63,13 @@ static int delay_timeout(int numpackets)
void reinit_selecting(struct client_state_t *cs, int timeout) void reinit_selecting(struct client_state_t *cs, int timeout)
{ {
ifchange_deconfig(); ifchange_deconfig();
arp_close_fd(cs);
cs->dhcpState = DS_SELECTING; cs->dhcpState = DS_SELECTING;
cs->timeout = timeout; cs->timeout = timeout;
cs->clientAddr = 0; cs->clientAddr = 0;
num_dhcp_requests = 0; num_dhcp_requests = 0;
arp_reset_send_stats(); arp_reset_send_stats();
set_listen_raw(cs); set_listen_raw(cs);
} }
// Triggered after a DHCP lease request packet has been sent and no reply has // Triggered after a DHCP lease request packet has been sent and no reply has