]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Change the BSD IPv6 interface setup order to ensure we have a better chance of eensur...
authorRoy Marples <roy@marples.name>
Sun, 13 Sep 2015 07:46:01 +0000 (07:46 +0000)
committerRoy Marples <roy@marples.name>
Sun, 13 Sep 2015 07:46:01 +0000 (07:46 +0000)
if-bsd.c

index 239b55b124a8cd8efba921b360b7a60a8d4fd4e6..772f60d80db3ea769668717bb0dc8f7363f90708 100644 (file)
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -1470,24 +1470,6 @@ _if_checkipv6(int s, struct dhcpcd_ctx *ctx,
                int override;
 #endif
 
-#ifdef ND6_IFF_IFDISABLED
-               if (del_if_nd6_flag(s, ifp, ND6_IFF_IFDISABLED) == -1) {
-                       logger(ifp->ctx, LOG_ERR,
-                           "%s: del_if_nd6_flag: ND6_IFF_IFDISABLED: %m",
-                           ifp->name);
-                       return -1;
-               }
-#endif
-
-#ifdef ND6_IFF_PERFORMNUD
-               if (set_if_nd6_flag(s, ifp, ND6_IFF_PERFORMNUD) == -1) {
-                       logger(ifp->ctx, LOG_ERR,
-                           "%s: set_if_nd6_flag: ND6_IFF_PERFORMNUD: %m",
-                           ifp->name);
-                       return -1;
-               }
-#endif
-
 #ifdef ND6_IFF_AUTO_LINKLOCAL
                if (own) {
                        int all;
@@ -1516,18 +1498,11 @@ _if_checkipv6(int s, struct dhcpcd_ctx *ctx,
                }
 #endif
 
-#ifdef SIOCIFAFATTACH
-               if (af_attach(s, ifp, AF_INET6) == -1) {
-                       logger(ifp->ctx, LOG_ERR,
-                           "%s: af_attach: %m", ifp->name);
-                       return 1;
-               }
-#endif
-
-#ifdef SIOCGIFXFLAGS
-               if (set_ifxflags(s, ifp, own) == -1) {
+#ifdef ND6_IFF_PERFORMNUD
+               if (set_if_nd6_flag(s, ifp, ND6_IFF_PERFORMNUD) == -1) {
                        logger(ifp->ctx, LOG_ERR,
-                           "%s: set_ifxflags: %m", ifp->name);
+                           "%s: set_if_nd6_flag: ND6_IFF_PERFORMNUD: %m",
+                           ifp->name);
                        return -1;
                }
 #endif
@@ -1571,6 +1546,38 @@ _if_checkipv6(int s, struct dhcpcd_ctx *ctx,
                } else if (ra == 0 && !own)
                        logger(ifp->ctx, LOG_WARNING,
                            "%s: IPv6 kernel autoconf disabled", ifp->name);
+#endif
+
+               /* Enabling IPv6 by whatever means must be the
+                * last action undertaken to ensure kernel RS and
+                * LLADDR auto configuration are disabled where applicable. */
+
+#ifdef SIOCIFAFATTACH
+               if (af_attach(s, ifp, AF_INET6) == -1) {
+                       logger(ifp->ctx, LOG_ERR,
+                           "%s: af_attach: %m", ifp->name);
+                       return 1;
+               }
+#endif
+
+#ifdef SIOCGIFXFLAGS
+               if (set_ifxflags(s, ifp, own) == -1) {
+                       logger(ifp->ctx, LOG_ERR,
+                           "%s: set_ifxflags: %m", ifp->name);
+                       return -1;
+               }
+#endif
+
+#ifdef ND6_IFF_IFDISABLED
+               if (del_if_nd6_flag(s, ifp, ND6_IFF_IFDISABLED) == -1) {
+                       logger(ifp->ctx, LOG_ERR,
+                           "%s: del_if_nd6_flag: ND6_IFF_IFDISABLED: %m",
+                           ifp->name);
+                       return -1;
+               }
+#endif
+
+#ifdef ND6_IFF_ACCEPT_RTADV
 #ifdef ND6_IFF_OVERRIDE_RTADV
                if (override == 0 && ra)
                        return ctx->ra_global;