]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove ND6 Advertisement from SMALL builds.
authorRoy Marples <roy@marples.name>
Thu, 25 Jul 2019 16:20:41 +0000 (17:20 +0100)
committerRoy Marples <roy@marples.name>
Thu, 25 Jul 2019 16:20:41 +0000 (17:20 +0100)
This is quite a saving and is only used for IP6 address sharing
which only works on NetBSD.

BUILDING.md
src/dhcp6.c
src/ipv6.c
src/ipv6.h
src/ipv6nd.c

index d5c4b53eab5529671775e756241e9fdbebdcca23..d9418c8e320098bf97c296028bafd8542d2fe7b5 100644 (file)
@@ -8,8 +8,9 @@ To compile small dhcpcd, maybe to be used for installation media where
 size is a concern, you can use the `--small` configure option to enable
 a reduced feature set within dhcpcd.
 Currently this just removes non important options out of
-`dhcpcd-definitions.conf`, the logfile option and
-support for DHCPv6 Prefix Delegation.
+`dhcpcd-definitions.conf`, the logfile option,
+DHCPv6 Prefix Delegation and IPv6 address announcement *(to prefer an
+address on another interface)*.
 Other features maybe dropped as and when required.
 dhcpcd can also be made smaller by removing the IPv4 or IPv6 stack:
   *  `--disable-inet`
index 42face2d79fa3b40257dd683271588b5b172e708..337a8367529b6c859d2eda92fe89e0ef26c401c6 100644 (file)
@@ -1523,7 +1523,9 @@ dhcp6_dadcallback(void *arg)
                                if (valid)
                                        dhcpcd_daemonise(ifp->ctx);
                        }
+#ifdef ND6_ADVERTISE
                        ipv6nd_advertise(ia);
+#endif
                }
        }
 }
@@ -3927,16 +3929,20 @@ dhcp6_free(struct interface *ifp)
 void
 dhcp6_abort(struct interface *ifp)
 {
+#ifdef ND6_ADVERTISE
        struct dhcp6_state *state;
        struct ipv6_addr *ia;
+#endif
 
        eloop_timeout_delete(ifp->ctx->eloop, dhcp6_start1, ifp);
+#ifdef ND6_ADVERTISE
        state = D6_STATE(ifp);
        if (state == NULL)
                return;
        TAILQ_FOREACH(ia, &state->addrs, next) {
                ipv6nd_advertise(ia);
        }
+#endif
 }
 
 void
index e33f0bdfc1f654f2b212c894bda4f648c5379e95..0a3ba8c1e0bb8a6639c79fb422e8b5faa75adbce 100644 (file)
@@ -616,8 +616,10 @@ ipv6_deleteaddr(struct ipv6_addr *ia)
                }
        }
 
+#ifdef ND6_ADVERTISE
        /* Advertise the address if it exists on another interface. */
        ipv6nd_advertise(ia);
+#endif
 }
 
 static int
@@ -625,8 +627,10 @@ ipv6_addaddr1(struct ipv6_addr *ia, const struct timespec *now)
 {
        struct interface *ifp;
        uint32_t pltime, vltime;
-       bool vltime_was_zero;
        __printflike(1, 2) void (*logfunc)(const char *, ...);
+#ifndef SMALL
+       bool vltime_was_zero;
+#endif
 #ifdef __sun
        struct ipv6_state *state;
        struct ipv6_addr *ia2;
@@ -694,7 +698,9 @@ ipv6_addaddr1(struct ipv6_addr *ia, const struct timespec *now)
                    " seconds",
                    ifp->name, ia->prefix_pltime, ia->prefix_vltime);
 
+#ifndef SMALL
        vltime_was_zero = ia->prefix_vltime == 0;
+#endif
        if (if_address6(RTM_NEWADDR, ia) == -1) {
                logerr(__func__);
                /* Restore real pltime and vltime */
@@ -758,9 +764,11 @@ ipv6_addaddr1(struct ipv6_addr *ia, const struct timespec *now)
        }
 #endif
 
+#ifdef ND6_ADVERTISE
        /* Re-advertise the preferred address to be safe. */
        if (!vltime_was_zero)
                ipv6nd_advertise(ia);
+#endif
 
        return 0;
 }
@@ -1081,9 +1089,11 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
        case RTM_DELADDR:
                if (ia != NULL) {
                        TAILQ_REMOVE(&state->addrs, ia, next);
+#ifdef ND6_ADVERTISE
                        /* Advertise the address if it exists on
                         * another interface. */
                        ipv6nd_advertise(ia);
+#endif
                        /* We'll free it at the end of the function. */
                }
                break;
index 9e2ab6b1c4ca8dc5cca1a27c59d5117f3282fb50..c4c3b1bf7f109a3c99cce7d76680c8b5aa3b2782 100644 (file)
 #  define IN6_IFF_DETACHED     0
 #endif
 
+#ifndef SMALL
+#  define ND6_ADVERTISE
+#endif
+
 #ifdef INET6
 TAILQ_HEAD(ipv6_addrhead, ipv6_addr);
 struct ipv6_addr {
index 1c4d8c84636db964511d341ccc4a3d01f5360f7c..5968bb891cecb72925ceb35f21d7c0a1ac9a4e94 100644 (file)
@@ -389,6 +389,7 @@ ipv6nd_sendrsprobe(void *arg)
        }
 }
 
+#ifdef ND6_ADVERTISE
 static void
 ipv6nd_sendadvertisement(void *arg)
 {
@@ -526,6 +527,7 @@ ipv6nd_advertise(struct ipv6_addr *ia)
        eloop_timeout_delete(ctx->eloop, ipv6nd_sendadvertisement, iaf);
        ipv6nd_sendadvertisement(iaf);
 }
+#endif /* ND6_ADVERTISE */
 
 static void
 ipv6nd_expire(void *arg)
@@ -908,7 +910,9 @@ try_script:
                                        return;
                        }
                }
+#ifdef ND6_ADVERTISE
                ipv6nd_advertise(ia);
+#endif
        }
 }