From: Roy Marples Date: Fri, 3 Oct 2014 17:54:06 +0000 (+0000) Subject: Rename dhcp6_prefix to delegated_dhcp6_prefix incase a user makes a X-Git-Tag: v6.5.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=369d1314ded2d0ebc3bbbefe5278d278d687366a;p=thirdparty%2Fdhcpcd.git Rename dhcp6_prefix to delegated_dhcp6_prefix incase a user makes a DHCPv6 option just called prefix. Send delegated interfaces to listeners as well. --- diff --git a/dhcp6.c b/dhcp6.c index 9adbec21..617c19f0 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -1175,6 +1175,9 @@ dhcp6_dadcompleted(const struct interface *ifp) const struct ipv6_addr *ap; state = D6_CSTATE(ifp); + if (!TAILQ_FIRST(&state->addrs)) + return 0; + TAILQ_FOREACH(ap, &state->addrs, next) { if (ap->flags & IPV6_AF_ADDED && !(ap->flags & IPV6_AF_DADCOMPLETED)) @@ -3393,13 +3396,13 @@ delegated: } } if (env && i) { - i += strlen(prefix) + strlen("_dhcp6_prefix="); + i += strlen(prefix) + strlen("_delegated_dhcp6_prefix="); v = val = env[n] = malloc(i); if (v == NULL) { syslog(LOG_ERR, "%s: %m", __func__); return -1; } - v += snprintf(val, i, "%s_dhcp6_prefix=", prefix); + v += snprintf(val, i, "%s_delegated_dhcp6_prefix=", prefix); TAILQ_FOREACH(ap, &state->addrs, next) { if (ap->delegating_iface) { /* Can't use stpcpy(3) due to "security" */ diff --git a/dhcp6.h b/dhcp6.h index e82a9c4b..d037c788 100644 --- a/dhcp6.h +++ b/dhcp6.h @@ -208,7 +208,7 @@ struct dhcp6_state { #define D6_CSTATE(ifp) \ ((const struct dhcp6_state *)(ifp)->if_data[IF_DATA_DHCP6]) #define D6_STATE_RUNNING(ifp) \ - (D6_CSTATE((ifp)) && D6_CSTATE((ifp))->new && \ + (D6_CSTATE((ifp)) && \ D6_CSTATE((ifp))->reason && dhcp6_dadcompleted((ifp))) #define D6_FIRST_OPTION(m) \ diff --git a/dhcpcd-run-hooks.8.in b/dhcpcd-run-hooks.8.in index e287951c..2aafe89b 100644 --- a/dhcpcd-run-hooks.8.in +++ b/dhcpcd-run-hooks.8.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 1, 2014 +.Dd August 3, 2014 .Dt DHCPCD-RUN-HOOKS 8 .Os .Sh NAME @@ -136,7 +136,7 @@ and .Ev $RC_SVCNAME . The following variables will then be set, along with any protocol supplied ones. -.Bl -tag -width xnew_dhcp6_prefix +.Bl -tag -width xnew_delegated_dhcp6_prefix .It Ev $interface the name of the interface. .It Ev $reason @@ -194,7 +194,7 @@ requirements specified in .It Ev $profile the name of the profile selected from .Xr dhcpcd.conf 5 . -.It Ev $new_dhcp6_prefix +.It Ev $new_delegated_dhcp6_prefix space separated list of delegated prefixes. .El .Sh FILES diff --git a/script.c b/script.c index 2419037d..870cdf26 100644 --- a/script.c +++ b/script.c @@ -462,9 +462,7 @@ dumplease: } #endif #ifdef INET6 - if (dhcp6 && d6_state && - (d6_state->new || d6_state->state == DH6S_DELEGATED)) - { + if (dhcp6 && D6_STATE_RUNNING(ifp)) { n = dhcp6_env(NULL, NULL, ifp, d6_state->new, d6_state->new_len); if (n > 0) {