]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove more prefix delegation code for small binaries.
authorRoy Marples <roy@marples.name>
Tue, 9 May 2017 11:40:28 +0000 (12:40 +0100)
committerRoy Marples <roy@marples.name>
Tue, 9 May 2017 11:40:28 +0000 (12:40 +0100)
src/dhcp6.c
src/ipv6.c
src/ipv6.h

index 7d9b20a845ad9cd81b22f5c14a5ef6e634609e8f..f75057659df51d336381059fb6ecf771f600acd1 100644 (file)
@@ -1353,7 +1353,11 @@ dhcp6_dadcallback(void *arg)
                {
                        struct ipv6_addr *ap2;
 
+#ifdef SMALL
+                       valid = true;
+#else
                        valid = (ap->delegating_prefix == NULL);
+#endif
                        TAILQ_FOREACH(ap2, &state->addrs, next) {
                                if (ap2->flags & IPV6_AF_ADDED &&
                                    !(ap2->flags & IPV6_AF_DADCOMPLETED))
@@ -1366,8 +1370,10 @@ dhcp6_dadcallback(void *arg)
                                logdebugx("%s: DHCPv6 DAD completed",
                                    ifp->name);
                                script_runreason(ifp,
-                                   ap->delegating_prefix ?
-                                   "DELEGATED6" : state->reason);
+#ifndef SMALL
+                                   ap->delegating_prefix ? "DELEGATED6" :
+#endif
+                                   state->reason);
                                if (valid)
                                        dhcpcd_daemonise(ifp->ctx);
                        }
@@ -2184,6 +2190,7 @@ dhcp6_deprecateaddrs(struct ipv6_addrhead *addrs)
                else
                        continue;
 
+#ifndef SMALL
                /* If we delegated from this prefix, deprecate or remove
                 * the delegations. */
                if (ia->flags & IPV6_AF_DELEGATEDPFX) {
@@ -2204,6 +2211,7 @@ dhcp6_deprecateaddrs(struct ipv6_addrhead *addrs)
                        if (touched)
                                ipv6_addaddrs(&ia->pd_pfxs);
                }
+#endif
 
                if (ia->flags & IPV6_AF_REQUEST) {
                        ia->prefix_vltime = ia->prefix_pltime = 0;
@@ -2548,9 +2556,12 @@ dhcp6_script_try_run(struct interface *ifp, int delegated)
                            ipv6_iffindaddr(ap->iface, &ap->addr,
                                            IN6_IFF_TENTATIVE))
                                ap->flags |= IPV6_AF_DADCOMPLETED;
-                       if ((ap->flags & IPV6_AF_DADCOMPLETED) == 0 &&
-                           ((delegated && ap->delegating_prefix) ||
-                           (!delegated && !ap->delegating_prefix)))
+                       if ((ap->flags & IPV6_AF_DADCOMPLETED) == 0
+#ifndef SMALL
+                           && ((delegated && ap->delegating_prefix) ||
+                           (!delegated && !ap->delegating_prefix))
+#endif
+                           )
                        {
                                completed = 0;
                                break;
@@ -3583,9 +3594,11 @@ dhcp6_env(char **env, const char *prefix, const struct interface *ifp,
        char *pfx;
        uint32_t en;
        const struct dhcpcd_ctx *ctx;
+#ifndef SMALL
        const struct dhcp6_state *state;
        const struct ipv6_addr *ap;
        char *v, *val;
+#endif
 
        n = 0;
        if (m == NULL)
@@ -3686,6 +3699,7 @@ dhcp6_env(char **env, const char *prefix, const struct interface *ifp,
        free(pfx);
 
 delegated:
+#ifndef SMALL
         /* Needed for Delegated Prefixes */
        state = D6_CSTATE(ifp);
        i = 0;
@@ -3717,6 +3731,7 @@ delegated:
         }
        if (i)
                n++;
+#endif
 
        return (ssize_t)n;
 }
index b4214883e5d00f26996110cca78870bb4de3b244..bd385694b07df4a498c684352e727cd37a83f564 100644 (file)
@@ -582,12 +582,16 @@ static void
 ipv6_deletedaddr(struct ipv6_addr *ia)
 {
 
+#ifdef SMALL
+       UNUSED(ia);
+#else
        /* NOREJECT is set if we delegated exactly the prefix to another
         * address.
         * This can only be one address, so just clear the flag.
         * This should ensure the reject route will be restored. */
        if (ia->delegating_prefix != NULL)
                ia->delegating_prefix->flags &= ~IPV6_AF_NOREJECT;
+#endif
 }
 
 static void
@@ -723,8 +727,10 @@ ipv6_addaddr1(struct ipv6_addr *ap, const struct timespec *now)
 
        ap->flags &= ~IPV6_AF_NEW;
        ap->flags |= IPV6_AF_ADDED;
+#ifndef SMALL
        if (ap->delegating_prefix != NULL)
                ap->flags |= IPV6_AF_DELEGATED;
+#endif
 
 #ifdef IPV6_POLLADDRFLAG
        eloop_timeout_delete(ap->iface->ctx->eloop,
@@ -948,6 +954,7 @@ ipv6_addaddrs(struct ipv6_addrhead *addrs)
 void
 ipv6_freeaddr(struct ipv6_addr *ap)
 {
+#ifndef SMALL
        struct ipv6_addr *ia;
 
        /* Forget the reference */
@@ -958,6 +965,7 @@ ipv6_freeaddr(struct ipv6_addr *ap)
        } else if (ap->delegating_prefix != NULL) {
                TAILQ_REMOVE(&ap->delegating_prefix->pd_pfxs, ap, pd_next);
        }
+#endif
 
        eloop_q_timeout_delete(ap->iface->ctx->eloop, 0, NULL, ap);
        free(ap);
@@ -970,12 +978,17 @@ ipv6_freedrop_addrs(struct ipv6_addrhead *addrs, int drop,
        struct ipv6_addr *ap, *apn, *apf;
        struct timespec now;
 
+#ifdef SMALL
+       UNUSED(ifd);
+#endif
        timespecclear(&now);
        TAILQ_FOREACH_SAFE(ap, addrs, next, apn) {
+#ifndef SMALL
                if (ifd != NULL &&
                    (ap->delegating_prefix == NULL ||
                    ap->delegating_prefix->iface != ifd))
                        continue;
+#endif
                if (drop != 2)
                        TAILQ_REMOVE(addrs, ap, next);
                if (drop && ap->flags & IPV6_AF_ADDED &&
index df6f9fa8512f3f9c5e6714e7d4830996432ba8ea..bd0f900f8fa9f2c029ae172f4d133cf626a80ba8 100644 (file)
@@ -166,12 +166,14 @@ struct ipv6_addr {
        uint8_t iaid[4];
        uint16_t ia_type;
 
+#ifndef SMALL
        struct ipv6_addr *delegating_prefix;
        struct ipv6_addrhead pd_pfxs;
        TAILQ_ENTRY(ipv6_addr) pd_next;
 
        uint8_t prefix_exclude_len;
        struct in6_addr prefix_exclude;
+#endif
 
        void (*dadcallback)(void *);
        int dadcounter;