]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Rename dhcp6_prefix to delegated_dhcp6_prefix incase a user makes a
authorRoy Marples <roy@marples.name>
Fri, 3 Oct 2014 17:54:06 +0000 (17:54 +0000)
committerRoy Marples <roy@marples.name>
Fri, 3 Oct 2014 17:54:06 +0000 (17:54 +0000)
DHCPv6 option just called prefix.
Send delegated interfaces to listeners as well.

dhcp6.c
dhcp6.h
dhcpcd-run-hooks.8.in
script.c

diff --git a/dhcp6.c b/dhcp6.c
index 9adbec2126a80782e4020cf9eeea42bdedd791c4..617c19f067fade0c89f6c229b3ce5dd8b3a63730 100644 (file)
--- 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 e82a9c4b07da6d4902e35e39603034cbeee5a26f..d037c788f347da04f7d66789dddf17235a605b66 100644 (file)
--- 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)                                                    \
index e287951c1c26262c787accac648b3d486057d0de..2aafe89bdb23d6617554511c6fbea19b2b9dbde8 100644 (file)
@@ -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
index 2419037d243a32408d0269e86e7a63570f9123a0..870cdf26b866439fd5620bd7d1a2a8f55ca70b59 100644 (file)
--- 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) {