void
arp_free(struct arp_state *astate)
{
+ struct interface *ifp;
+ struct iarp_state *state;
- if (astate != NULL) {
- struct interface *ifp;
- struct iarp_state *state;
-
- ifp = astate->iface;
- eloop_timeout_delete(ifp->ctx->eloop, NULL, astate);
- state = ARP_STATE(ifp);
- TAILQ_REMOVE(&state->arp_states, astate, next);
- if (astate->free_cb)
- astate->free_cb(astate);
- free(astate);
-
- /* If there are no more ARP states, close the socket. */
- if (state->fd != -1 &&
- TAILQ_FIRST(&state->arp_states) == NULL)
- {
- eloop_event_delete(ifp->ctx->eloop, state->fd);
- if_closeraw(ifp, state->fd);
- free(state);
- ifp->if_data[IF_DATA_ARP] = NULL;
- }
+ if (astate == NULL)
+ return;
+
+ ifp = astate->iface;
+ eloop_timeout_delete(ifp->ctx->eloop, NULL, astate);
+ state = ARP_STATE(ifp);
+ TAILQ_REMOVE(&state->arp_states, astate, next);
+ if (astate->free_cb)
+ astate->free_cb(astate);
+ free(astate);
+
+ /* If there are no more ARP states, close the socket. */
+ if (state->fd != -1 && TAILQ_FIRST(&state->arp_states) == NULL) {
+ eloop_event_delete(ifp->ctx->eloop, state->fd);
+ if_closeraw(ifp, state->fd);
+ free(state);
+ ifp->if_data[IF_DATA_ARP] = NULL;
}
}