summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-01-06 10:10:59 +0000
committerRoy Marples <roy@marples.name>2019-01-06 10:10:59 +0000
commit12489da256cfd51afb736b278b88510e5e4303e7 (patch)
tree4acf18d0785a17a5d59f857e3ee8525e39d4f06d
parent2f2db8dcf1a3acd87accc71951cae044118edcbf (diff)
downloaddhcpcd-12489da256cfd51afb736b278b88510e5e4303e7.tar.xz
ip6: Install not on link routes with a gateway of the router
This allows a secondary router to broadcast prefixes it controls without being a default router itself.
-rw-r--r--src/ipv6.c12
-rw-r--r--src/ipv6nd.c12
2 files changed, 10 insertions, 14 deletions
diff --git a/src/ipv6.c b/src/ipv6.c
index 38cb06d8..1f1e36c0 100644
--- a/src/ipv6.c
+++ b/src/ipv6.c
@@ -2151,13 +2151,11 @@ inet6_makeprefix(struct interface *ifp, const struct ra *rap,
}
/* There is no point in trying to manage a /128 prefix,
- * ones without a lifetime or ones not on link or delegated */
- if (addr->prefix_len == 128 ||
- addr->prefix_vltime == 0 ||
- !(addr->flags & (IPV6_AF_ONLINK | IPV6_AF_DELEGATEDPFX)))
+ * ones without a lifetime. */
+ if (addr->prefix_len == 128 || addr->prefix_vltime == 0)
return NULL;
- /* Don't install a reject route when not creating bigger prefixes */
+ /* Don't install a reject route when not creating bigger prefixes. */
if (addr->flags & IPV6_AF_NOREJECT)
return NULL;
@@ -2189,7 +2187,9 @@ inet6_makeprefix(struct interface *ifp, const struct ra *rap,
#ifndef __linux__
sa_in6_init(&rt->rt_gateway, &in6addr_loopback);
#endif
- } else
+ } else if (!(addr->flags & IPV6_AF_ONLINK))
+ sa_in6_init(&rt->rt_gateway, &rap->from);
+ else
rt->rt_gateway.sa_family = AF_UNSPEC;
sa_in6_init(&rt->rt_ifa, &addr->addr);
return rt;
diff --git a/src/ipv6nd.c b/src/ipv6nd.c
index d6dc749d..9a53fc92 100644
--- a/src/ipv6nd.c
+++ b/src/ipv6nd.c
@@ -1096,12 +1096,6 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx, struct interface *ifp,
if (ap == NULL) {
unsigned int flags;
- if (!(pi.nd_opt_pi_flags_reserved &
- ND_OPT_PI_FLAG_AUTO) &&
- !(pi.nd_opt_pi_flags_reserved &
- ND_OPT_PI_FLAG_ONLINK))
- continue;
-
flags = IPV6_AF_RAPFX;
if (pi.nd_opt_pi_flags_reserved &
ND_OPT_PI_FLAG_AUTO &&
@@ -1114,7 +1108,8 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx, struct interface *ifp,
if (ap == NULL)
break;
ap->prefix = pi_prefix;
- ap->dadcallback = ipv6nd_dadcallback;
+ if (flags & IPV6_AF_AUTOCONF)
+ ap->dadcallback = ipv6nd_dadcallback;
ap->created = ap->acquired = rap->acquired;
TAILQ_INSERT_TAIL(&rap->addrs, ap, next);
@@ -1124,7 +1119,8 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx, struct interface *ifp,
* temporary address also exists then
* extend the existing one rather than
* create a new one */
- if (ipv6_iffindaddr(ifp, &ap->addr,
+ if (flags & IPV6_AF_AUTOCONF &&
+ ipv6_iffindaddr(ifp, &ap->addr,
IN6_IFF_NOTUSEABLE) &&
ipv6_settemptime(ap, 0))
new_ap = 0;