From: Roy Marples Date: Wed, 25 Oct 2017 08:15:10 +0000 (+0100) Subject: bpf: remove the BPF_FREE flag X-Git-Tag: v7.0.0-rc4~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da54cc96f6fc0079f24f77464bdd7b3767b98faf;p=thirdparty%2Fdhcpcd.git bpf: remove the BPF_FREE flag ARP code can just try and free the istate if no astates left after finishing the read loop. --- diff --git a/src/arp.c b/src/arp.c index 372978f2..a4e218db 100644 --- a/src/arp.c +++ b/src/arp.c @@ -194,13 +194,12 @@ arp_tryfree(struct interface *ifp) if (TAILQ_FIRST(&state->arp_states) == NULL) { arp_close(ifp); if (state->bpf_flags & BPF_READING) - state->bpf_flags |= BPF_EOF | BPF_FREE; + state->bpf_flags |= BPF_EOF; else { free(state); ifp->if_data[IF_DATA_ARP] = NULL; } } else { - state->bpf_flags &= BPF_FREE; if (bpf_arp(ifp, state->bpf_fd) == -1) logerr(__func__); } @@ -235,8 +234,8 @@ arp_read(void *arg) } if (state != NULL) { state->bpf_flags &= ~BPF_READING; - if (state->bpf_flags & BPF_FREE) - arp_tryfree(ifp); + /* Try and free the state if nothing left to do. */ + arp_tryfree(ifp); } } diff --git a/src/bpf.h b/src/bpf.h index d41efdce..3e3c9d61 100644 --- a/src/bpf.h +++ b/src/bpf.h @@ -28,10 +28,9 @@ #ifndef BPF_HEADER #define BPF_HEADER -#define BPF_EOF (1U << 0) -#define BPF_PARTIALCSUM (1U << 1) -#define BPF_READING (1U << 2) -#define BPF_FREE (1U << 3) +#define BPF_READING (1U << 0) +#define BPF_EOF (1U << 1) +#define BPF_PARTIALCSUM (1U << 2) #include "dhcpcd.h"