}
/* 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;
#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;
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 &&
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);
* 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;