]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
bpf: remove the BPF_FREE flag
authorRoy Marples <roy@marples.name>
Wed, 25 Oct 2017 08:15:10 +0000 (09:15 +0100)
committerRoy Marples <roy@marples.name>
Wed, 25 Oct 2017 08:15:10 +0000 (09:15 +0100)
ARP code can just try and free the istate if no astates left
after finishing the read loop.

src/arp.c
src/bpf.h

index 372978f2da17c12e08585d439c61d823bc67c09e..a4e218dbbcde13dd5fb3125d499220ddef64c83d 100644 (file)
--- 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);
        }
 }
 
index d41efdce08c7ff07c246b18939d27051b422b0c2..3e3c9d6110eb985079b91824cf779518ce0ffda0 100644 (file)
--- a/src/bpf.h
+++ b/src/bpf.h
 #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"