From 04c380cd3b0c4b5a6dad9b1b284984f42cce5dfe Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Tue, 5 Jul 2011 16:02:11 -0400 Subject: [PATCH] Call arp_close_fd() from reinit_selecting(). --- ndhc/arp.c | 5 +---- ndhc/state.c | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ndhc/arp.c b/ndhc/arp.c index 95d9068..881c837 100644 --- a/ndhc/arp.c +++ b/ndhc/arp.c @@ -1,5 +1,5 @@ /* 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 * @@ -402,7 +402,6 @@ static int arp_get_gw_hwaddr(struct client_state_t *cs) static void arp_failed(struct client_state_t *cs) { log_line("arp: Offered address is in use -- declining"); - arp_close_fd(cs); send_decline(cs, arp_dhcp_packet.yiaddr); reinit_selecting(cs, total_conflicts < MAX_CONFLICTS ? 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) { log_line("arp: Gateway appears to have changed, getting new lease."); - arp_close_fd(cs); cs->oldTimeout = 0; reinit_selecting(cs, 0); } @@ -586,7 +584,6 @@ static void arp_do_defense(struct client_state_t *cs) arp_announcement(cs); } else if (!arp_relentless_def) { log_line("arp: Conflicting peer is persistent. Requesting new lease."); - arp_close_fd(cs); send_release(cs); reinit_selecting(cs, 0); } else { diff --git a/ndhc/state.c b/ndhc/state.c index ec46b6b..f9e1bfb 100644 --- a/ndhc/state.c +++ b/ndhc/state.c @@ -63,13 +63,13 @@ static int delay_timeout(int numpackets) void reinit_selecting(struct client_state_t *cs, int timeout) { ifchange_deconfig(); + arp_close_fd(cs); cs->dhcpState = DS_SELECTING; cs->timeout = timeout; cs->clientAddr = 0; num_dhcp_requests = 0; arp_reset_send_stats(); set_listen_raw(cs); - } // Triggered after a DHCP lease request packet has been sent and no reply has