MFC r295583, r295584, r295729, r295730:

NDP code cleanup changes.

MFC r295732:
Fix an IPv6 DAD reference count leak.
This commit is contained in:
markj 2016-05-05 23:06:39 +00:00
parent 9add1370b7
commit 5cba75d7c7
5 changed files with 15 additions and 15 deletions

View File

@ -2215,7 +2215,7 @@ nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS)
error = sa6_recoverscope(&d.rtaddr);
if (error != 0)
return (error);
d.flags = dr->flags;
d.flags = dr->raflags;
d.rtlifetime = dr->rtlifetime;
d.expire = dr->expire + (time_second - time_uptime);
d.if_index = dr->ifp->if_index;

View File

@ -235,13 +235,13 @@ struct in6_ndifreq {
((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
TAILQ_HEAD(nd_drhead, nd_defrouter);
struct nd_defrouter {
struct nd_defrouter {
TAILQ_ENTRY(nd_defrouter) dr_entry;
struct in6_addr rtaddr;
u_char flags; /* flags on RA message */
struct in6_addr rtaddr;
u_char raflags; /* flags on RA message */
u_short rtlifetime;
u_long expire;
struct ifnet *ifp;
struct ifnet *ifp;
int installed; /* is installed into kernel routing table */
};
@ -445,7 +445,6 @@ void nd6_dad_stop(struct ifaddr *);
/* nd6_rtr.c */
void nd6_rs_input(struct mbuf *, int, int);
void nd6_ra_input(struct mbuf *, int, int);
void prelist_del(struct nd_prefix *);
void defrouter_reset(void);
void defrouter_select(void);
void defrtrlist_del(struct nd_defrouter *);

View File

@ -1315,9 +1315,10 @@ nd6_dad_start(struct ifaddr *ifa, int delay)
}
if ((dp = nd6_dad_find(ifa, NULL)) != NULL) {
/*
* DAD already in progress. Let the existing entry
* to finish it.
* DAD is already in progress. Let the existing entry
* finish it.
*/
nd6_dad_rele(dp);
return;
}

View File

@ -270,7 +270,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
bzero(&dr0, sizeof(dr0));
dr0.rtaddr = saddr6;
dr0.flags = nd_ra->nd_ra_flags_reserved;
dr0.raflags = nd_ra->nd_ra_flags_reserved;
/*
* Effectively-disable routes from RA messages when
* ND6_IFF_NO_RADR enabled on the receiving interface or
@ -708,7 +708,7 @@ defrouter_select(void)
static int
rtpref(struct nd_defrouter *dr)
{
switch (dr->flags & ND_RA_FLAG_RTPREF_MASK) {
switch (dr->raflags & ND_RA_FLAG_RTPREF_MASK) {
case ND_RA_FLAG_RTPREF_HIGH:
return (RTPREF_HIGH);
case ND_RA_FLAG_RTPREF_MEDIUM:
@ -722,7 +722,7 @@ rtpref(struct nd_defrouter *dr)
* serious bug of kernel internal. We thus always bark here.
* Or, can we even panic?
*/
log(LOG_ERR, "rtpref: impossible RA flag %x\n", dr->flags);
log(LOG_ERR, "rtpref: impossible RA flag %x\n", dr->raflags);
return (RTPREF_INVALID);
}
/* NOTREACHED */
@ -744,7 +744,7 @@ defrtrlist_update(struct nd_defrouter *new)
oldpref = rtpref(dr);
/* override */
dr->flags = new->flags; /* xxx flag check */
dr->raflags = new->raflags; /* XXX flag check */
dr->rtlifetime = new->rtlifetime;
dr->expire = new->expire;
@ -937,9 +937,9 @@ prelist_remove(struct nd_prefix *pr)
/* unlink ndpr_entry from nd_prefix list */
LIST_REMOVE(pr, ndpr_entry);
/* free list of routers that adversed the prefix */
/* free list of routers that advertised the prefix */
LIST_FOREACH_SAFE(pfr, &pr->ndpr_advrtrs, pfr_entry, next) {
free(pfr, M_IP6NDP);
pfxrtr_del(pfr);
}
free(pr, M_IP6NDP);

View File

@ -416,7 +416,7 @@ sa6_recoverscope(struct sockaddr_in6 *sin6)
zoneid != sin6->sin6_scope_id) {
log(LOG_NOTICE,
"%s: embedded scope mismatch: %s%%%d. "
"sin6_scope_id was overridden.", __func__,
"sin6_scope_id was overridden\n", __func__,
ip6_sprintf(ip6buf, &sin6->sin6_addr),
sin6->sin6_scope_id);
}