]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only run the IPv4LL script on drop when actually dropping an IPv4LL address.
authorRoy Marples <roy@marples.name>
Thu, 9 Jul 2015 13:51:26 +0000 (13:51 +0000)
committerRoy Marples <roy@marples.name>
Thu, 9 Jul 2015 13:51:26 +0000 (13:51 +0000)
ipv4ll.c

index 87e598bf65676d3cd4c3097b8b97a1c501d51947..e610256a8450a4b4b88ee82ff890eee7d027282e 100644 (file)
--- a/ipv4ll.c
+++ b/ipv4ll.c
@@ -363,10 +363,13 @@ ipv4ll_freedrop(struct interface *ifp, int drop)
 
        if (drop && (ifp->options->options & DHCPCD_NODROP) != DHCPCD_NODROP) {
                struct ipv4_state *istate;
+               int dropped;
 
+               dropped = 0;
                if (state && state->addr.s_addr != INADDR_ANY) {
                        ipv4_deladdr(ifp, &state->addr, &inaddr_llmask, 1);
                        state->addr.s_addr = INADDR_ANY;
+                       dropped = 1;
                }
 
                /* Free any other link local addresses that might exist. */
@@ -374,12 +377,16 @@ ipv4ll_freedrop(struct interface *ifp, int drop)
                        struct ipv4_addr *ia, *ian;
 
                        TAILQ_FOREACH_SAFE(ia, &istate->addrs, next, ian) {
-                               if (IN_LINKLOCAL(ntohl(ia->addr.s_addr)))
+                               if (IN_LINKLOCAL(ntohl(ia->addr.s_addr))) {
                                        ipv4_deladdr(ifp, &ia->addr,
                                            &ia->net, 0);
+                                       dropped = 1;
+                               }
                        }
                }
-               script_runreason(ifp, "IPV4LL");
+
+               if (dropped)
+                       script_runreason(ifp, "IPV4LL");
        }
 
        if (state) {