From: Roy Marples Date: Wed, 22 Jul 2015 10:07:39 +0000 (+0000) Subject: Ignore the RA if there are no public addresses on the interface. X-Git-Tag: v6.9.2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baee7c1da4326cd8d8cf75163b4eac8e7fc901cf;p=thirdparty%2Fdhcpcd.git Ignore the RA if there are no public addresses on the interface. Fixes [f44b3b4817]. --- diff --git a/ipv6nd.c b/ipv6nd.c index 03ae85f6..c893d761 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -732,14 +732,19 @@ try_script: } static int -ipv6nd_ra_has_public_addr(const struct ra *rap) +ipv6nd_has_public_addr(const struct interface *ifp) { + const struct ra *rap; const struct ipv6_addr *ia; - TAILQ_FOREACH(ia, &rap->addrs, next) { - if (ia->flags & IPV6_AF_AUTOCONF && - ipv6_publicaddr(ia)) - return 1; + TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) { + if (rap->iface == ifp) { + TAILQ_FOREACH(ia, &rap->addrs, next) { + if (ia->flags & IPV6_AF_AUTOCONF && + ipv6_publicaddr(ia)) + return 1; + } + } } return 0; } @@ -1106,7 +1111,7 @@ ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp, if (new_rap) add_router(ifp->ctx->ipv6, rap); - if (!ipv6nd_ra_has_public_addr(rap) && + if (!ipv6nd_has_public_addr(rap->iface) && !(rap->iface->options->options & DHCPCD_IPV6RA_ACCEPT_NOPUBLIC) && (!(rap->flags & ND_RA_FLAG_MANAGED) || !dhcp6_has_public_addr(rap->iface)))