From 865340f4184db90a2e31550013446fffaec0a200 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 4 Oct 2016 09:40:56 +0000 Subject: [PATCH] Remove hack to add IPv6 LL address as early as possible. This only worked on pre NetBSD-7.0 systems which did not support ND6_IFF_AUTO_LINKLOCAL. By removing it, we make the code smaller and removes the possibility of in-advertently re-ordering interfaces in dhcpcd during the init phases. Should finally fix [c9d04817fa]. --- dhcpcd.c | 29 ++++------------------------- ipv6.c | 7 ------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/dhcpcd.c b/dhcpcd.c index 7e58c7e7..8b8f1220 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -657,15 +657,6 @@ dhcpcd_initstate2(struct interface *ifp, unsigned long long options) logger(ifp->ctx, LOG_ERR, "ipv6_init: %m"); ifo->options &= ~DHCPCD_IPV6RS; } - - /* Add our link-local address before upping the interface - * so our RFC7217 address beats the hwaddr based one. - * This needs to happen before PREINIT incase a hook script - * inadvertently ups the interface. */ - if (ifo->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) { - logger(ifp->ctx, LOG_ERR, "%s: ipv6_start: %m", ifp->name); - ifo->options &= ~DHCPCD_IPV6; - } } static void @@ -809,20 +800,6 @@ warn_iaid_conflict(struct interface *ifp, uint8_t *iaid) ifp->name, ifn->name); } -static void -pre_start(struct interface *ifp) -{ - - /* Add our link-local address before upping the interface - * so our RFC7217 address beats the hwaddr based one. - * This is also a safety check incase it was ripped out - * from under us. */ - if (ifp->options->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) { - logger(ifp->ctx, LOG_ERR, "%s: ipv6_start: %m", ifp->name); - ifp->options->options &= ~DHCPCD_IPV6; - } -} - void dhcpcd_startinterface(void *arg) { @@ -887,6 +864,10 @@ dhcpcd_startinterface(void *arg) } } + if (ifo->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) { + logger(ifp->ctx, LOG_ERR, "%s: ipv6_start: %m", ifp->name); + ifo->options &= ~DHCPCD_IPV6; + } if (ifo->options & DHCPCD_IPV6) { ipv6_startstatic(ifp); @@ -941,7 +922,6 @@ dhcpcd_prestartinterface(void *arg) { struct interface *ifp = arg; - pre_start(ifp); if ((!(ifp->ctx->options & DHCPCD_MASTER) || ifp->options->options & DHCPCD_IF_UP) && if_up(ifp) == -1) @@ -969,7 +949,6 @@ static void run_preinit(struct interface *ifp) { - pre_start(ifp); if (ifp->ctx->options & DHCPCD_TEST) return; diff --git a/ipv6.c b/ipv6.c index 74050a1e..ff48c44a 100644 --- a/ipv6.c +++ b/ipv6.c @@ -112,11 +112,6 @@ #else #define CAN_DROP_LLADDR(ifp) (1) #endif -#elif defined(__NetBSD__) -/* Earlier versions of NetBSD don't add duplicate LLADDR's if the interface - * is brought up and one already exists. */ -#define CAN_ADD_LLADDR(ifp) (1) -#define CAN_DROP_LLADDR(ifp) (1) #else /* We have no control over the OS adding the LLADDR, so just let it do it * as we cannot force our own view on it. */ @@ -1648,8 +1643,6 @@ ipv6_start(struct interface *ifp) /* Load existing routes */ if_initrt6(ifp->ctx); - if (!IN6_IS_ADDR_UNSPECIFIED(&ifp->options->req_addr6)) - ipv6_buildroutes(ifp->ctx); return 0; } -- 2.47.2