This is controllable via noipv6 and noipv6rs options.
ifo->options &=
~(DHCPCD_IPV6RS | DHCPCD_DHCP6 | DHCPCD_WAITIP6);
- if (ifo->options & DHCPCD_SLAACPRIVATE &&
- !(ifp->ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST)))
- ifo->options |= DHCPCD_IPV6RA_OWN;
-
/* We want to disable kernel interface RA as early as possible. */
if (ifo->options & DHCPCD_IPV6 &&
!(ifp->ctx->options & DHCPCD_DUMPLEASE))
/* If not doing any DHCP, disable the RDNSS requirement. */
if (!(ifo->options & (DHCPCD_DHCP | DHCPCD_DHCP6)))
ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS;
- ra_global = if_checkipv6(ifp->ctx, NULL,
- ifp->ctx->options & DHCPCD_IPV6RA_OWN ? 1 : 0);
- ra_iface = if_checkipv6(ifp->ctx, ifp,
- ifp->options->options & DHCPCD_IPV6RA_OWN ? 1 : 0);
+ ra_global = if_checkipv6(ifp->ctx, NULL);
+ ra_iface = if_checkipv6(ifp->ctx, ifp);
if (ra_global == -1 || ra_iface == -1)
ifo->options &= ~DHCPCD_IPV6RS;
- else if (ra_iface == 0 &&
- !(ifp->ctx->options & DHCPCD_TEST))
- ifo->options |= DHCPCD_IPV6RA_OWN;
}
if (!(ifo->options & DHCPCD_IAID)) {
ipv6nd_expire(ifp, RTR_CARRIER_EXPIRE);
#endif
/* RFC4941 Section 3.5 */
- if (ifp->options->options & DHCPCD_IPV6RA_OWN)
- ipv6_gentempifid(ifp);
+ ipv6_gentempifid(ifp);
dhcpcd_startinterface(ifp);
}
}
Set this option so to make
.Nm dhcpcd
always fork on an RA.
-.It Ic ipv6ra_own
-Disables kernel IPv6 Router Advertisement processing so dhcpcd can manage
-addresses and routes.
-.It Ic ipv6ra_own_default
-Each time dhcpcd receives an IPv6 Router Adveristment, dhcpcd will manage
-the default route only.
-This allows dhcpcd to prefer an interface for outbound traffic based on metric
-and/or user selection rather than the kernel.
.It Ic ipv6rs
Enables IPv6 Router Advertisement solicitation.
This is on by default, but is documented here in the case where it is disabled
#endif
int
-if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
+if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp)
{
struct priv *priv;
int s, ra;
flags = (int)nd.ndi.flags;
#ifdef ND6_IFF_AUTO_LINKLOCAL
- if (own && flags & ND6_IFF_AUTO_LINKLOCAL) {
+ if (!(ctx->options & DHCPCD_TEST) &&
+ flags & ND6_IFF_AUTO_LINKLOCAL)
+ {
syslog(LOG_DEBUG,
"%s: disabling Kernel IPv6 auto link-local support",
ifp->name);
#endif
#ifdef ND6_IFF_ACCEPT_RTADV
- if (own && flags & ND6_IFF_ACCEPT_RTADV) {
+ if (!(ctx->options & DHCPCD_TEST) &&
+ flags & ND6_IFF_ACCEPT_RTADV)
+ {
syslog(LOG_DEBUG,
"%s: disabling Kernel IPv6 RA support",
ifp->name);
flags &= ~ND6_IFF_ACCEPT_RTADV;
}
#ifdef ND6_IFF_OVERRIDE_RTADV
- if (own && flags & ND6_IFF_OVERRIDE_RTADV)
+ if (!(ctx->options & DHCPCD_TEST) &&
+ flags & ND6_IFF_OVERRIDE_RTADV)
flags &= ~ND6_IFF_OVERRIDE_RTADV;
#endif
#endif
#endif
if (nd.ndi.flags != (uint32_t)flags) {
+ if (ctx->options & DHCPCD_TEST) {
+ syslog(LOG_WARNING,
+ "%s: interface not IPv6 enabled",
+ ifp->name);
+ return -1;
+ }
nd.ndi.flags = (uint32_t)flags;
if (ioctl(s, SIOCSIFINFO_FLAGS, &nd) == -1) {
syslog(LOG_ERR, "%s: SIOCSIFINFO_FLAGS: %m",
* error as such so just log it and continue */
syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
"IPV6CTL_ACCEPT_RTADV: %m");
- else if (ra != 0 && own) {
+ else if (ra != 0 && !(ctx->options & DHCPCD_TEST)) {
syslog(LOG_DEBUG, "disabling Kernel IPv6 RA support");
if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 0) == -1) {
syslog(LOG_ERR, "IPV6CTL_ACCEPT_RTADV: %m");
ra = 0;
#else
ra = 0;
- if (own) {
+ if (!(ctx->options & DHCPCD_TEST)) {
#endif
/* Flush the kernel knowledge of advertised routers
* and prefixes so the kernel does not expire prefixes
static const char *prefix = "/proc/sys/net/ipv6/conf";
int
-if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
+if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp)
{
const char *ifname;
int ra;
if (ifp == NULL)
ifname = "all";
- else if (own) {
+ else if (!(ctx->options & DHCPCD_TEST)) {
if (if_disable_autolinklocal(ctx, ifp->index) == -1)
syslog(LOG_DEBUG, "%s: if_disable_autolinklocal: %m",
ifp->name);
snprintf(path, sizeof(path), "%s/%s/autoconf", prefix, ifname);
ra = check_proc_int(path);
if (ra != 1) {
- if (!own)
+ if (ctx->options & DHCPCD_TEST)
syslog(LOG_WARNING, "%s: IPv6 kernel autoconf disabled",
ifname);
- } else if (ra != -1 && own) {
+ } else if (ra != -1 && !(ctx->options & DHCPCD_TEST)) {
if (write_path(path, "0") == -1) {
syslog(LOG_ERR, "write_path: %s: %m", path);
return -1;
/* The sysctl probably doesn't exist, but this isn't an
* error as such so just log it and continue */
syslog(errno == ENOENT ? LOG_DEBUG:LOG_WARNING, "%s: %m", path);
- else if (ra != 0 && own) {
+ else if (ra != 0 && !(ctx->options & DHCPCD_TEST)) {
syslog(LOG_DEBUG, "%s: disabling kernel IPv6 RA support",
ifname);
if (write_path(path, "0") == -1) {
#define O_IPV6RS O_BASE + 4
#define O_NOIPV6RS O_BASE + 5
#define O_IPV6RA_FORK O_BASE + 6
-#define O_IPV6RA_OWN O_BASE + 7
-#define O_IPV6RA_OWN_D O_BASE + 8
+// unused O_BASE + 7
+// unused O_BASE + 8
#define O_NOALIAS O_BASE + 9
#define O_IA_NA O_BASE + 10
#define O_IA_TA O_BASE + 11
{"ipv6ra_autoconf", no_argument, NULL, O_IPV6RA_AUTOCONF},
{"ipv6ra_noautoconf", no_argument, NULL, O_IPV6RA_NOAUTOCONF},
{"ipv6ra_fork", no_argument, NULL, O_IPV6RA_FORK},
- {"ipv6ra_own", no_argument, NULL, O_IPV6RA_OWN},
- {"ipv6ra_own_default", no_argument, NULL, O_IPV6RA_OWN_D},
{"ipv4", no_argument, NULL, O_IPV4},
{"noipv4", no_argument, NULL, O_NOIPV4},
{"ipv6", no_argument, NULL, O_IPV6},
case O_IPV6RA_FORK:
ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS;
break;
- case O_IPV6RA_OWN:
- ifo->options |= DHCPCD_IPV6RA_OWN;
- break;
- case O_IPV6RA_OWN_D:
- ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT;
- break;
case O_IPV6RA_AUTOCONF:
ifo->options |= DHCPCD_IPV6RA_AUTOCONF;
break;
#define DHCPCD_DUMPLEASE (1ULL << 30)
#define DHCPCD_IPV6RS (1ULL << 31)
#define DHCPCD_IPV6RA_REQRDNSS (1ULL << 32)
-#define DHCPCD_IPV6RA_OWN (1ULL << 33)
-#define DHCPCD_IPV6RA_OWN_DEFAULT (1ULL << 34)
+// unused (1ULL << 33)
+// unused (1ULL << 34)
#define DHCPCD_IPV4 (1ULL << 35)
#define DHCPCD_FORKED (1ULL << 36)
#define DHCPCD_IPV6 (1ULL << 37)
int
if_checkipv6(__unused struct dhcpcd_ctx *ctx,
- __unused const struct interface *ifp, int __unused own)
+ __unused const struct interface *ifp)
{
return 0;
#endif
#ifdef INET6
-int if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *, int);
+int if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *);
#ifdef IPV6_MANAGETEMPADDR
int ip6_use_tempaddr(const char *ifname);
int ip6_temp_preferred_lifetime(const char *ifname);
if (ap->flags & IPV6_AF_TEMPORARY &&
ap->prefix_pltime &&
ap->prefix_vltime &&
- ap->iface->options->options & DHCPCD_IPV6RA_OWN &&
ip6_use_tempaddr(ap->iface->name))
eloop_timeout_add_sec(ap->iface->ctx->eloop,
(time_t)ap->prefix_pltime - REGEN_ADVANCE,
/* Regenerate new ids */
if (ifp->options &&
- ifp->options->options & DHCPCD_IPV6RA_OWN &&
ip6_use_tempaddr(ifp->name))
ipv6_regentempifid(ifp);
}
if (IPV6_CSTATE(ifp)) {
/* Regenerate new ids */
- if (ifp->options->options & DHCPCD_IPV6RA_OWN &&
- ip6_use_tempaddr(ifp->name))
+ if (ip6_use_tempaddr(ifp->name))
ipv6_regentempifid(ifp);
}
TAILQ_FOREACH(rap, ctx->ra_routers, next) {
if (rap->expired != expired)
continue;
- if (rap->iface->options->options & DHCPCD_IPV6RA_OWN) {
- TAILQ_FOREACH(addr, &rap->addrs, next) {
- if (addr->prefix_vltime == 0)
- continue;
- rt = inet6_makeprefix(rap->iface, rap, addr);
- if (rt) {
- TAILQ_INSERT_TAIL(routes, rt, rt_next);
- n++;
- }
+ TAILQ_FOREACH(addr, &rap->addrs, next) {
+ if (addr->prefix_vltime == 0)
+ continue;
+ rt = inet6_makeprefix(rap->iface, rap, addr);
+ if (rt) {
+ TAILQ_INSERT_TAIL(routes, rt, rt_next);
+ n++;
}
}
- if (rap->lifetime && rap->iface->options->options &
- (DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT))
- {
+ if (rap->lifetime) {
rt = inet6_makerouter(rap);
if (rt) {
TAILQ_INSERT_TAIL(routes, rt, rt_next);
ctx->options;
#ifdef INET6
if (!have_default &&
- (o & DHCPCD_IPV6RA_OWN_DEFAULT) &&
- !(o & DHCPCD_IPV6RA_OWN) &&
rt->rt_dest.sa_family == AF_INET6 &&
sa_is_unspecified(&rt->rt_dest))
have_default = true;