Initialize the variable "router", and apply "static_route" flag

across the entire nd6_cache_lladdr() function.
This commit is contained in:
Qing Li 2008-12-16 01:21:19 +00:00
parent 0a65345ca4
commit 3d3728e9f8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186153

View File

@ -1405,9 +1405,10 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
int llchange;
int flags = 0;
int newstate = 0;
uint16_t router;
uint16_t router = 0;
struct sockaddr_in6 sin6;
struct mbuf *chain = NULL;
int static_route = 0;
IF_AFDATA_UNLOCK_ASSERT(ifp);
@ -1441,8 +1442,10 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
is_newentry = 1;
} else {
/* do nothing if static ndp is set */
if (ln->la_flags & LLE_STATIC)
if (ln->la_flags & LLE_STATIC) {
static_route = 1;
goto done;
}
is_newentry = 0;
}
if (ln == NULL)
@ -1600,7 +1603,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
}
if (ln) {
int static_route = (ln->la_flags & LLE_STATIC);
static_route = (ln->la_flags & LLE_STATIC);
router = ln->ln_router;
if (flags & ND6_EXCLUSIVE)
@ -1642,7 +1645,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
LLE_WUNLOCK(ln);
else
LLE_RUNLOCK(ln);
if (ln->la_flags & LLE_STATIC)
if (static_route)
ln = NULL;
}
return (ln);