From: Roy Marples Date: Sat, 2 Jun 2018 09:27:45 +0000 (+0100) Subject: ip6: if forked from ia callback, don't run ia handlers X-Git-Tag: v7.0.5~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=304a2790ced65da00324b525e4e8edb3b2af9345;p=thirdparty%2Fdhcpcd.git 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. --- diff --git a/src/ipv6.c b/src/ipv6.c index 82cf71b6..3085b888 100644 --- a/src/ipv6.c +++ b/src/ipv6.c @@ -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