Mercurial > hg > dhcpcd
changeset 2519:80278d0c53c3 draft
Ensure OWN is set by SLAAC private before initing.
Add a link-local address before running any PREINIT script
as well as at start incase a 3rd party removed it.
Move kernel tweaks to RA to DEBUG messages.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Thu, 05 Jun 2014 11:38:04 +0000 |
| parents | 28182250f3a0 |
| children | 1d6444e11b21 |
| files | dhcpcd.c if-bsd.c if-linux.c |
| diffstat | 3 files changed, 23 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/dhcpcd.c Wed Jun 04 23:54:15 2014 +0000 +++ b/dhcpcd.c Thu Jun 05 11:38:04 2014 +0000 @@ -348,6 +348,9 @@ if (!(ifo->options & DHCPCD_IPV6)) ifo->options &= ~DHCPCD_IPV6RS; + if (ifo->options & DHCPCD_SLAACPRIVATE) + ifo->options |= DHCPCD_IPV6RA_OWN; + /* We want to disable kernel interface RA as early as possible. */ if (ifo->options & DHCPCD_IPV6RS) { ra_global = if_checkipv6(ifp->ctx, NULL, @@ -446,9 +449,6 @@ /* If we are not sending an authentication option, don't require it */ if (!(ifo->auth.options & DHCPCD_AUTH_SEND)) ifo->auth.options &= ~DHCPCD_AUTH_REQUIRE; - - if (ifo->options & DHCPCD_SLAACPRIVATE) - ifo->options |= DHCPCD_IPV6RA_OWN; } int @@ -570,7 +570,9 @@ char buf[DUID_LEN * 3]; /* Add our link-local address before upping the interface - * so our RFC7217 address beats the hwaddr based one */ + * so our RFC7217 address beats the hwaddr based one. + * This is also a safety check incase it was ripped out + * from under us. */ if (ifo->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) { syslog(LOG_ERR, "%s: ipv6_start: %m", ifp->name); ifo->options &= DHCPCD_IPV6; @@ -686,6 +688,15 @@ 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) { + syslog(LOG_ERR, "%s: ipv6_start: %m", ifp->name); + ifo->options &= DHCPCD_IPV6; + } + reason = NULL; /* appease gcc */ if (ifo->options & DHCPCD_LINK) { switch (if_carrier(ifp)) {
--- a/if-bsd.c Wed Jun 04 23:54:15 2014 +0000 +++ b/if-bsd.c Thu Jun 05 11:38:04 2014 +0000 @@ -1029,7 +1029,8 @@ for (; ctx->ra_restore_len > 0; ctx->ra_restore_len--) { #ifdef ND6_IFF_ACCEPT_RTADV if (!(ctx->options & DHCPCD_FORKED)) { - syslog(LOG_INFO, "%s: restoring kernel IPv6 RA support", + syslog(LOG_DEBUG, + "%s: restoring kernel IPv6 RA support", ctx->ra_restore[ctx->ra_restore_len - 1]); if (set_if_nd6_flag( ctx->ra_restore[ctx->ra_restore_len -1], @@ -1051,7 +1052,7 @@ ctx->ra_restore = NULL; if (ctx->ra_kernel_set) { - syslog(LOG_INFO, "restoring kernel IPv6 RA support"); + syslog(LOG_DEBUG, "restoring kernel IPv6 RA support"); if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 1) == -1) syslog(LOG_ERR, "IPV6CTL_ACCEPT_RTADV: %m"); } @@ -1107,15 +1108,6 @@ } #endif -#ifdef ND_IFF_AUTO_LINKLOCAL - if (set_if_nd6_flag(ifname, ND6_IFF_AUTO_LINKLOCAL) == -1) { - syslog(LOG_ERR, - "%s: set_if_nd6_flag: ND6_IFF_AUTO_LINKLOCAL: %m", - ifname); - return -1; - } -#endif - #ifdef ND6_IFF_OVERRIDE_RTADV override = get_if_nd6_flag(ifname, ND6_IFF_OVERRIDE_RTADV); if (override == -1) @@ -1133,7 +1125,7 @@ "%s: get_if_nd6_flag: ND6_IFF_ACCEPT_RTADV: %m", ifname); else if (ra != 0 && own) { - syslog(LOG_INFO, + syslog(LOG_DEBUG, "%s: disabling Kernel IPv6 RA support", ifname); if (del_if_nd6_flag(ifname, ND6_IFF_ACCEPT_RTADV) @@ -1191,7 +1183,7 @@ syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, "IPV6CTL_ACCEPT_RTADV: %m"); else if (ra != 0 && own) { - syslog(LOG_INFO, "disabling Kernel IPv6 RA support"); + syslog(LOG_DEBUG, "disabling Kernel IPv6 RA support"); if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 0) == -1) { syslog(LOG_ERR, "IPV6CTL_ACCEPT_RTADV: %m"); return ra;
--- a/if-linux.c Wed Jun 04 23:54:15 2014 +0000 +++ b/if-linux.c Thu Jun 05 11:38:04 2014 +0000 @@ -1230,7 +1230,8 @@ for (; ctx->ra_restore_len > 0; ctx->ra_restore_len--) { if (!(ctx->options & DHCPCD_FORKED)) { - syslog(LOG_INFO, "%s: restoring kernel IPv6 RA support", + syslog(LOG_DEBUG, + "%s: restoring kernel IPv6 RA support", ctx->ra_restore[ctx->ra_restore_len - 1]); snprintf(path, sizeof(path), "%s/%s/accept_ra", prefix, ctx->ra_restore[ctx->ra_restore_len - 1]); @@ -1276,7 +1277,7 @@ syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, "%s: %m", path); else if (ra != 0 && own) { - syslog(LOG_INFO, "%s: disabling kernel IPv6 RA support", + syslog(LOG_DEBUG, "%s: disabling kernel IPv6 RA support", ifname); if (write_path(path, "0") == -1) { syslog(LOG_ERR, "write_path: %s: %m", path);
