]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove hack to add IPv6 LL address as early as possible.
authorRoy Marples <roy@marples.name>
Tue, 4 Oct 2016 09:40:56 +0000 (09:40 +0000)
committerRoy Marples <roy@marples.name>
Tue, 4 Oct 2016 09:40:56 +0000 (09:40 +0000)
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
ipv6.c

index 7e58c7e7d4e9923a78cbfaec826dba7945b8d8c3..8b8f1220e021a7fecc63ed9ed179264487c15b9b 100644 (file)
--- 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 74050a1e0365936025690c493a5df59d36f186fa..ff48c44ab1dd9c3c703e0209f5011b591513d6b4 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
 #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;
 }