]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
IPv4LL: Don't start if already started
authorRoy Marples <roy@marples.name>
Mon, 23 Oct 2023 15:25:13 +0000 (15:25 +0000)
committerRoy Marples <roy@marples.name>
Mon, 23 Oct 2023 15:25:13 +0000 (15:25 +0000)
It's just pointless noise.
A follow-on fix for #255.

src/ipv4ll.c
src/ipv4ll.h

index 86cc227d5d715b600746bdbda512ed34e2c84164..89b3dce628405c46fc827a1d0b30d733d1a6cfbf 100644 (file)
@@ -335,6 +335,10 @@ ipv4ll_start(void *arg)
                }
        }
 
+       if (state->running)
+               return;
+       state->running = true;
+
        /* RFC 3927 Section 2.1 states that the random number generator
         * SHOULD be seeded with a value derived from persistent information
         * such as the IEEE 802 MAC address so that it usually picks
@@ -435,11 +439,14 @@ ipv4ll_drop(struct interface *ifp)
                return;
 
        state = IPV4LL_STATE(ifp);
-       if (state && state->addr != NULL) {
-               if (ifp->options->options & DHCPCD_CONFIGURE)
-                       ipv4_deladdr(state->addr, 1);
-               state->addr = NULL;
-               dropped = true;
+       if (state) {
+               state->running = false;
+               if (state->addr != NULL) {
+                       if (ifp->options->options & DHCPCD_CONFIGURE)
+                               ipv4_deladdr(state->addr, 1);
+                       state->addr = NULL;
+                       dropped = true;
+               }
        }
 
        /* Free any other link local addresses that might exist. */
index f9e059827e29f0b5b6ad9fe30a9361e0831f0914..78af32e5191b3d532f352110609ba9b8ca8521d0 100644 (file)
@@ -44,6 +44,7 @@ struct ipv4ll_state {
        struct in_addr pickedaddr;
        struct ipv4_addr *addr;
        char randomstate[128];
+       bool running;
        bool seeded;
        bool down;
        size_t conflicts;