changeset 4283:c66180322ab9 draft

ip6: if forked from ia callback, don't run ia handlers It's pointless and resolves an issue where the handler would try and listen to an address when not in master mode, but it's already listened to in the child.
author Roy Marples <roy@marples.name>
date Sat, 02 Jun 2018 10:27:45 +0100
parents 18aa55c59279
children b0e348ab0a4a
files src/ipv6.c
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ipv6.c	Thu May 10 18:51:56 2018 +0100
+++ b/src/ipv6.c	Sat Jun 02 10:27:45 2018 +0100
@@ -1152,8 +1152,11 @@
 			}
 #endif
 
-			if (ia->dadcallback)
+			if (ia->dadcallback) {
 				ia->dadcallback(ia);
+				if (ctx->options & DHCPCD_FORKED)
+					goto out;
+			}
 
 			if (IN6_IS_ADDR_LINKLOCAL(&ia->addr) &&
 			    !(ia->addr_flags & IN6_IFF_NOTUSEABLE))
@@ -1168,20 +1171,24 @@
 					    cb, next);
 					cb->callback(cb->arg);
 					free(cb);
+					if (ctx->options & DHCPCD_FORKED)
+						goto out;
 				}
 			}
 		}
 		break;
 	}
 
-	if (ia != NULL) {
-		ipv6nd_handleifa(cmd, ia, pid);
-		dhcp6_handleifa(cmd, ia, pid);
+	if (ia == NULL)
+		return;
 
-		/* Done with the ia now, so free it. */
-		if (cmd == RTM_DELADDR)
-			ipv6_freeaddr(ia);
-	}
+	ipv6nd_handleifa(cmd, ia, pid);
+	dhcp6_handleifa(cmd, ia, pid);
+
+out:
+	/* Done with the ia now, so free it. */
+	if (cmd == RTM_DELADDR)
+		ipv6_freeaddr(ia);
 }
 
 int