Do not initialize flag variables before needed.

Consistently use the LLE_ prefix for lla_lookup() and the ND6_ prefix
for nd6_lookup() even though both are defined the same. Use the right
flag variable when checking each.

No real functional change.

MFC after:	4 days
This commit is contained in:
bz 2010-11-17 10:43:20 +00:00
parent 389cf6e631
commit dc5dcc5e85

View File

@ -836,7 +836,7 @@ nd6_lookup(struct in6_addr *addr6, int flags, struct ifnet *ifp)
{ {
struct sockaddr_in6 sin6; struct sockaddr_in6 sin6;
struct llentry *ln; struct llentry *ln;
int llflags = 0; int llflags;
bzero(&sin6, sizeof(sin6)); bzero(&sin6, sizeof(sin6));
sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_len = sizeof(struct sockaddr_in6);
@ -845,13 +845,14 @@ nd6_lookup(struct in6_addr *addr6, int flags, struct ifnet *ifp)
IF_AFDATA_LOCK_ASSERT(ifp); IF_AFDATA_LOCK_ASSERT(ifp);
llflags = 0;
if (flags & ND6_CREATE) if (flags & ND6_CREATE)
llflags |= LLE_CREATE; llflags |= LLE_CREATE;
if (flags & ND6_EXCLUSIVE) if (flags & ND6_EXCLUSIVE)
llflags |= LLE_EXCLUSIVE; llflags |= LLE_EXCLUSIVE;
ln = lla_lookup(LLTABLE6(ifp), llflags, (struct sockaddr *)&sin6); ln = lla_lookup(LLTABLE6(ifp), llflags, (struct sockaddr *)&sin6);
if ((ln != NULL) && (flags & LLE_CREATE)) if ((ln != NULL) && (llflags & LLE_CREATE))
ln->ln_state = ND6_LLINFO_NOSTATE; ln->ln_state = ND6_LLINFO_NOSTATE;
return (ln); return (ln);
@ -1451,7 +1452,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
int do_update; int do_update;
int olladdr; int olladdr;
int llchange; int llchange;
int flags = 0; int flags;
int newstate = 0; int newstate = 0;
uint16_t router = 0; uint16_t router = 0;
struct sockaddr_in6 sin6; struct sockaddr_in6 sin6;
@ -1478,13 +1479,13 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
* Spec says nothing in sections for RA, RS and NA. There's small * Spec says nothing in sections for RA, RS and NA. There's small
* description on it in NS section (RFC 2461 7.2.3). * description on it in NS section (RFC 2461 7.2.3).
*/ */
flags |= lladdr ? ND6_EXCLUSIVE : 0; flags = lladdr ? ND6_EXCLUSIVE : 0;
IF_AFDATA_LOCK(ifp); IF_AFDATA_LOCK(ifp);
ln = nd6_lookup(from, flags, ifp); ln = nd6_lookup(from, flags, ifp);
if (ln == NULL) { if (ln == NULL) {
flags |= LLE_EXCLUSIVE; flags |= ND6_EXCLUSIVE;
ln = nd6_lookup(from, flags |ND6_CREATE, ifp); ln = nd6_lookup(from, flags | ND6_CREATE, ifp);
IF_AFDATA_UNLOCK(ifp); IF_AFDATA_UNLOCK(ifp);
is_newentry = 1; is_newentry = 1;
} else { } else {