Remove ND6 Advertisement from SMALL builds.

This is quite a saving and is only used for IP6 address sharing
which only works on NetBSD.
This commit is contained in:
Roy Marples 2019-07-25 17:20:41 +01:00
parent 9f9cacad4c
commit 7b3d01262b
5 changed files with 28 additions and 3 deletions

View 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`

View 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

View 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;

View File

@ -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 {

View 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
}
}