]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
ip6: if forked from ia callback, don't run ia handlers
authorRoy Marples <roy@marples.name>
Sat, 2 Jun 2018 09:27:45 +0000 (10:27 +0100)
committerRoy Marples <roy@marples.name>
Sat, 2 Jun 2018 09:27:45 +0000 (10:27 +0100)
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.

src/ipv6.c

index 82cf71b656e217103223ddf604b56d2122b55cd8..3085b8884f4d9acca87389d671fe83e21ae1509c 100644 (file)
@@ -1152,8 +1152,11 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
                        }
 #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 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
                                            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