changeset 3227:9047e2c619fe draft

Only run the IPv4LL script on drop when actually dropping an IPv4LL address.
author Roy Marples <roy@marples.name>
date Thu, 09 Jul 2015 13:51:26 +0000
parents a3a4bd68c284
children 2c085591a660
files ipv4ll.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ipv4ll.c	Thu Jul 09 09:29:43 2015 +0000
+++ b/ipv4ll.c	Thu Jul 09 13:51:26 2015 +0000
@@ -363,10 +363,13 @@
 
 	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 @@
 			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) {