diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -323,8 +323,7 @@ struct prf_ra { u_char onlink : 1; u_char autonomous : 1; - u_char ra_derived: 1; - u_char reserved : 5; + u_char reserved : 6; } prf_ra; u_char prf_reserved1; u_short prf_reserved2; @@ -355,7 +354,6 @@ #define ipr_raf_onlink ipr_flags.prf_ra.onlink #define ipr_raf_auto ipr_flags.prf_ra.autonomous -#define ipr_raf_ra_derived ipr_flags.prf_ra.ra_derived #define ipr_statef_onlink ipr_flags.prf_state.onlink diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -242,7 +242,6 @@ #define ndpr_raf ndpr_flags #define ndpr_raf_onlink ndpr_flags.onlink #define ndpr_raf_auto ndpr_flags.autonomous -#define ndpr_raf_ra_derived ndpr_flags.ra_derived #define ndpr_raf_router ndpr_flags.router struct nd_pfxrouter { diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -84,11 +84,13 @@ #include +#define ND6_PREFIX_FROM_ROUTER(pr) \ + (!LIST_EMPTY(&(pr)->ndpr_advrtrs) || \ + ((pr)->ndpr_stateflags & NDPRF_DETACHED) == NDPRF_DETACHED) + #define ND6_SLOWTIMER_INTERVAL (60 * 60) /* 1 hour */ #define ND6_RECALC_REACHTM_INTERVAL (60 * 120) /* 2 hours */ -#define SIN6(s) ((const struct sockaddr_in6 *)(s)) - MALLOC_DEFINE(M_IP6NDP, "ip6ndp", "IPv6 Neighbor Discovery"); VNET_DEFINE_STATIC(int, nd6_prune) = 1; @@ -1800,7 +1802,7 @@ ND6_WLOCK(); LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, next) { - if (pr->ndpr_raf_ra_derived) + if (ND6_PREFIX_FROM_ROUTER(pr)) nd6_prefix_unlink(pr, &prl); } ND6_WUNLOCK(); @@ -2678,8 +2680,6 @@ ND6_RLOCK(); LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { - if (!pr->ndpr_raf_ra_derived) - continue; p.prefix = pr->ndpr_prefix; if (sa6_recoverscope(&p.prefix)) { log(LOG_ERR, "scope error in prefix list (%s)\n", diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -520,7 +520,6 @@ ND_OPT_PI_FLAG_ONLINK) ? 1 : 0; pr.ndpr_raf_auto = (pi->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO) ? 1 : 0; - pr.ndpr_raf_ra_derived = 1; pr.ndpr_plen = pi->nd_opt_pi_prefix_len; pr.ndpr_vltime = ntohl(pi->nd_opt_pi_valid_time); pr.ndpr_pltime = ntohl(pi->nd_opt_pi_preferred_time);