From: Roy Marples Date: Fri, 19 Jun 2015 13:17:10 +0000 (+0000) Subject: If we free the last ARP state, close the ARP socket. X-Git-Tag: v6.9.1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8489233dd7b54c08bbac0aff4e5aab21a397d13e;p=thirdparty%2Fdhcpcd.git If we free the last ARP state, close the ARP socket. --- diff --git a/arp.c b/arp.c index e381b42e..46b6789d 100644 --- a/arp.c +++ b/arp.c @@ -349,6 +349,15 @@ arp_free(struct arp_state *astate) state = D_STATE(astate->iface); TAILQ_REMOVE(&state->arp_states, astate, next); free(astate); + + /* If there are no more ARP states, close the socket. */ + if (state->arp_fd != -1 && + TAILQ_FIRST(&state->arp_states) == NULL) + { + eloop_event_delete(ifp->ctx->eloop, state->arp_fd); + close(state->arp_fd); + state->arp_fd = -1; + } } }