From: Roy Marples Date: Thu, 25 Jul 2019 16:20:41 +0000 (+0100) Subject: Remove ND6 Advertisement from SMALL builds. X-Git-Tag: v8.0.2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b3d01262b72da8312d696e236a7183e5e0148ef;p=thirdparty%2Fdhcpcd.git Remove ND6 Advertisement from SMALL builds. This is quite a saving and is only used for IP6 address sharing which only works on NetBSD. --- diff --git a/BUILDING.md b/BUILDING.md index d5c4b53e..d9418c8e 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -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` diff --git a/src/dhcp6.c b/src/dhcp6.c index 42face2d..337a8367 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -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 diff --git a/src/ipv6.c b/src/ipv6.c index e33f0bdf..0a3ba8c1 100644 --- a/src/ipv6.c +++ b/src/ipv6.c @@ -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; diff --git a/src/ipv6.h b/src/ipv6.h index 9e2ab6b1..c4c3b1bf 100644 --- a/src/ipv6.h +++ b/src/ipv6.h @@ -149,6 +149,10 @@ # define IN6_IFF_DETACHED 0 #endif +#ifndef SMALL +# define ND6_ADVERTISE +#endif + #ifdef INET6 TAILQ_HEAD(ipv6_addrhead, ipv6_addr); struct ipv6_addr { diff --git a/src/ipv6nd.c b/src/ipv6nd.c index 1c4d8c84..5968bb89 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -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 } }