summaryrefslogtreecommitdiffstats
path: root/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2015-09-13 07:46:01 +0000
committerRoy Marples <roy@marples.name>2015-09-13 07:46:01 +0000
commit93d842473e4d439ec797fc324fc9ce3f4a2848aa (patch)
treebac6f9276db8b95c18185fbd8037f1023d1b3475 /if-bsd.c
parentc0ba4e05fac22780a2e3d8c458970f89ba3ba4cc (diff)
downloaddhcpcd-93d842473e4d439ec797fc324fc9ce3f4a2848aa.tar.xz
Change the BSD IPv6 interface setup order to ensure we have a better chance of eensuring any LLADDR we add doesn't cause a duplicate by the kernel.
Diffstat (limited to 'if-bsd.c')
-rw-r--r--if-bsd.c65
1 files changed, 36 insertions, 29 deletions
diff --git a/if-bsd.c b/if-bsd.c
index 239b55b1..772f60d8 100644
--- 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;