sync with KAME in the following points:
- fixed typos - improved some comment descriptions - use NULL, instead of 0, to denote a NULL pointer - avoid embedding a magic number in the code - use nd6log() instead of log() to record NDP-specific logs - nuked an unnecessay white space Obtained from: KAME MFC after: 1 day
This commit is contained in:
parent
2043307751
commit
21f42e535f
@ -511,8 +511,10 @@ icmp6_input(mp, offp, proto)
|
||||
icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_timeexceed);
|
||||
switch (code) {
|
||||
case ICMP6_TIME_EXCEED_TRANSIT:
|
||||
code = PRC_TIMXCEED_INTRANS;
|
||||
break;
|
||||
case ICMP6_TIME_EXCEED_REASSEMBLY:
|
||||
code += PRC_TIMXCEED_INTRANS;
|
||||
code = PRC_TIMXCEED_REASS;
|
||||
break;
|
||||
default:
|
||||
goto badcode;
|
||||
|
@ -166,6 +166,12 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
|
||||
e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report the addition/removal of the address to the routing socket.
|
||||
* XXX: since we called rtinit for a p2p interface with a destination,
|
||||
* we end up reporting twice in such a case. Should we rather
|
||||
* omit the second report?
|
||||
*/
|
||||
if (nrt) {
|
||||
RT_LOCK(nrt);
|
||||
/*
|
||||
@ -180,14 +186,6 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
|
||||
nrt->rt_ifa = ifa;
|
||||
}
|
||||
|
||||
/*
|
||||
* Report the addition/removal of the address to the routing
|
||||
* socket.
|
||||
*
|
||||
* XXX: since we called rtinit for a p2p interface with a
|
||||
* destination, we end up reporting twice in such a case.
|
||||
* Should we rather omit the second report?
|
||||
*/
|
||||
rt_newaddrmsg(cmd, ifa, e, nrt);
|
||||
if (cmd == RTM_DELETE) {
|
||||
rtfree(nrt);
|
||||
@ -239,8 +237,7 @@ in6_ifremloop(struct ifaddr *ifa)
|
||||
* (see comments in net/net_osdep.h). Even for variants that do remove
|
||||
* cloned routes, they could fail to remove the cloned routes when
|
||||
* we handle multple addresses that share a common prefix.
|
||||
* So, we should remove the route corresponding to the deleted address
|
||||
* regardless of the result of in6_is_ifloop_auto().
|
||||
* So, we should remove the route corresponding to the deleted address.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -430,8 +427,7 @@ in6_control(so, cmd, data, ifp, td)
|
||||
case SIOCSIFNETMASK_IN6:
|
||||
/*
|
||||
* Since IPv6 allows a node to assign multiple addresses
|
||||
* on a single interface, SIOCSIFxxx ioctls are not suitable
|
||||
* and should be unused.
|
||||
* on a single interface, SIOCSIFxxx ioctls are deprecated.
|
||||
*/
|
||||
/* we decided to obsolete this command (20000704) */
|
||||
return (EINVAL);
|
||||
@ -439,10 +435,10 @@ in6_control(so, cmd, data, ifp, td)
|
||||
case SIOCDIFADDR_IN6:
|
||||
/*
|
||||
* for IPv4, we look for existing in_ifaddr here to allow
|
||||
* "ifconfig if0 delete" to remove first IPv4 address on the
|
||||
* interface. For IPv6, as the spec allow multiple interface
|
||||
* address from the day one, we consider "remove the first one"
|
||||
* semantics to be not preferable.
|
||||
* "ifconfig if0 delete" to remove the first IPv4 address on
|
||||
* the interface. For IPv6, as the spec allows multiple
|
||||
* interface address from the day one, we consider "remove the
|
||||
* first one" semantics to be not preferable.
|
||||
*/
|
||||
if (ia == NULL)
|
||||
return (EADDRNOTAVAIL);
|
||||
@ -981,6 +977,7 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
* not just go to unlink.
|
||||
*/
|
||||
|
||||
/* Join necessary multicast groups */
|
||||
if ((ifp->if_flags & IFF_MULTICAST) != 0) {
|
||||
struct sockaddr_in6 mltaddr, mltmask;
|
||||
struct in6_multi *in6m;
|
||||
@ -988,7 +985,7 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
|
||||
/* join solicited multicast addr for new host id */
|
||||
bzero(&llsol, sizeof(struct in6_addr));
|
||||
llsol.s6_addr16[0] = htons(0xff02);
|
||||
llsol.s6_addr32[0] = IPV6_ADDR_INT32_MLL;
|
||||
llsol.s6_addr32[1] = 0;
|
||||
llsol.s6_addr32[2] = htonl(1);
|
||||
llsol.s6_addr32[3] = ifra->ifra_addr.sin6_addr.s6_addr32[3];
|
||||
@ -1013,6 +1010,7 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
mltmask.sin6_len = sizeof(struct sockaddr_in6);
|
||||
mltmask.sin6_family = AF_INET6;
|
||||
mltmask.sin6_addr = in6mask32;
|
||||
#define MLTMASK_LEN 4 /* mltmask's masklen (=32bit=4octet) */
|
||||
|
||||
/*
|
||||
* join link-local all-nodes address
|
||||
@ -1033,12 +1031,9 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
*/
|
||||
rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL);
|
||||
if (rt) {
|
||||
/*
|
||||
* 32bit came from "mltmask"
|
||||
*/
|
||||
if (memcmp(&mltaddr.sin6_addr,
|
||||
&((struct sockaddr_in6 *)rt_key(rt))->sin6_addr,
|
||||
32 / 8)) {
|
||||
MLTMASK_LEN)) {
|
||||
RTFREE_LOCKED(rt);
|
||||
rt = NULL;
|
||||
}
|
||||
@ -1100,10 +1095,9 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
/* XXX: again, do we really need the route? */
|
||||
rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL);
|
||||
if (rt) {
|
||||
/* 32bit came from "mltmask" */
|
||||
if (memcmp(&mltaddr.sin6_addr,
|
||||
&((struct sockaddr_in6 *)rt_key(rt))->sin6_addr,
|
||||
32 / 8)) {
|
||||
MLTMASK_LEN)) {
|
||||
RTFREE_LOCKED(rt);
|
||||
rt = NULL;
|
||||
}
|
||||
@ -1130,6 +1124,7 @@ in6_update_ifa(ifp, ifra, ia)
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
#undef MLTMASK_LEN
|
||||
}
|
||||
|
||||
return (error);
|
||||
@ -1187,7 +1182,7 @@ in6_purgeaddr(ifa)
|
||||
struct in6_multi *in6m;
|
||||
struct in6_addr llsol;
|
||||
bzero(&llsol, sizeof(struct in6_addr));
|
||||
llsol.s6_addr16[0] = htons(0xff02);
|
||||
llsol.s6_addr32[0] = IPV6_ADDR_INT32_MLL;
|
||||
llsol.s6_addr32[1] = 0;
|
||||
llsol.s6_addr32[2] = htonl(1);
|
||||
llsol.s6_addr32[3] =
|
||||
|
@ -186,8 +186,8 @@ generate_tmp_ifid(seed0, seed1, ret)
|
||||
* use a random non-zero value as the last resort.
|
||||
*/
|
||||
if (bcmp(nullbuf, ret, sizeof(nullbuf)) == 0) {
|
||||
log(LOG_INFO,
|
||||
"generate_tmp_ifid: computed MD5 value is zero.\n");
|
||||
nd6log((LOG_INFO,
|
||||
"generate_tmp_ifid: computed MD5 value is zero.\n"));
|
||||
|
||||
val32 = arc4random();
|
||||
val32 = 1 + (val32 % (0xffffffff - 1));
|
||||
@ -467,7 +467,7 @@ in6_ifattach_linklocal(ifp, altifp)
|
||||
|
||||
/*
|
||||
* Now call in6_update_ifa() to do a bunch of procedures to configure
|
||||
* a link-local address. We can set NULL to the 3rd argument, because
|
||||
* a link-local address. We can set the 3rd argument to NULL, because
|
||||
* we know there's no other link-local address on the interface
|
||||
* and therefore we are adding one (instead of updating one).
|
||||
*/
|
||||
@ -479,10 +479,10 @@ in6_ifattach_linklocal(ifp, altifp)
|
||||
* suppress it. (jinmei@kame.net 20010130)
|
||||
*/
|
||||
if (error != EAFNOSUPPORT)
|
||||
log(LOG_NOTICE, "in6_ifattach_linklocal: failed to "
|
||||
nd6log((LOG_NOTICE, "in6_ifattach_linklocal: failed to "
|
||||
"configure a link-local address on %s "
|
||||
"(errno=%d)\n",
|
||||
if_name(ifp), error);
|
||||
if_name(ifp), error));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -590,9 +590,9 @@ in6_ifattach_loopback(ifp)
|
||||
* NULL to the 3rd arg.
|
||||
*/
|
||||
if ((error = in6_update_ifa(ifp, &ifra, NULL)) != 0) {
|
||||
log(LOG_ERR, "in6_ifattach_loopback: failed to configure "
|
||||
nd6log((LOG_ERR, "in6_ifattach_loopback: failed to configure "
|
||||
"the loopback address on %s (errno=%d)\n",
|
||||
if_name(ifp), error);
|
||||
if_name(ifp), error));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ in6_nigroup(ifp, name, namelen, in6)
|
||||
MD5Final(digest, &ctxt);
|
||||
|
||||
bzero(in6, sizeof(*in6));
|
||||
in6->s6_addr16[0] = htons(0xff02);
|
||||
in6->s6_addr16[0] = IPV6_ADDR_INT16_MLL;
|
||||
in6->s6_addr8[11] = 2;
|
||||
bcopy(digest, &in6->s6_addr32[3], sizeof(in6->s6_addr32[3]));
|
||||
if (in6_setscope(in6, ifp, NULL))
|
||||
@ -695,9 +695,9 @@ in6_ifattach(ifp, altifp)
|
||||
* usually, we require multicast capability to the interface
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_MULTICAST) == 0) {
|
||||
log(LOG_INFO, "in6_ifattach: "
|
||||
nd6log((LOG_INFO, "in6_ifattach: "
|
||||
"%s is not multicast capable, IPv6 not enabled\n",
|
||||
if_name(ifp));
|
||||
if_name(ifp)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ nd6_setmtu0(ifp, ndi)
|
||||
case IFT_FDDI:
|
||||
ndi->maxmtu = MIN(FDDIIPMTU, ifp->if_mtu); /* RFC2467 */
|
||||
break;
|
||||
case IFT_ISO88025:
|
||||
case IFT_ISO88025:
|
||||
ndi->maxmtu = MIN(ISO88025_MAX_MTU, ifp->if_mtu);
|
||||
break;
|
||||
default:
|
||||
@ -260,11 +260,11 @@ nd6_option(ndopts)
|
||||
struct nd_opt_hdr *nd_opt;
|
||||
int olen;
|
||||
|
||||
if (!ndopts)
|
||||
if (ndopts == NULL)
|
||||
panic("ndopts == NULL in nd6_option");
|
||||
if (!ndopts->nd_opts_last)
|
||||
if (ndopts->nd_opts_last == NULL)
|
||||
panic("uninitialized ndopts in nd6_option");
|
||||
if (!ndopts->nd_opts_search)
|
||||
if (ndopts->nd_opts_search == NULL)
|
||||
return NULL;
|
||||
if (ndopts->nd_opts_done)
|
||||
return NULL;
|
||||
@ -312,16 +312,16 @@ nd6_options(ndopts)
|
||||
struct nd_opt_hdr *nd_opt;
|
||||
int i = 0;
|
||||
|
||||
if (!ndopts)
|
||||
if (ndopts == NULL)
|
||||
panic("ndopts == NULL in nd6_options");
|
||||
if (!ndopts->nd_opts_last)
|
||||
if (ndopts->nd_opts_last == NULL)
|
||||
panic("uninitialized ndopts in nd6_options");
|
||||
if (!ndopts->nd_opts_search)
|
||||
if (ndopts->nd_opts_search == NULL)
|
||||
return 0;
|
||||
|
||||
while (1) {
|
||||
nd_opt = nd6_option(ndopts);
|
||||
if (!nd_opt && !ndopts->nd_opts_last) {
|
||||
if (nd_opt == NULL && ndopts->nd_opts_last == NULL) {
|
||||
/*
|
||||
* Message validation requires that all included
|
||||
* options have a length that is greater than zero.
|
||||
@ -331,7 +331,7 @@ nd6_options(ndopts)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!nd_opt)
|
||||
if (nd_opt == NULL)
|
||||
goto skip1;
|
||||
|
||||
switch (nd_opt->nd_opt_type) {
|
||||
@ -775,10 +775,10 @@ nd6_lookup(addr6, create, ifp)
|
||||
* destination and allocate an interface route.
|
||||
*/
|
||||
RTFREE_LOCKED(rt);
|
||||
rt = 0;
|
||||
rt = NULL;
|
||||
}
|
||||
}
|
||||
if (!rt) {
|
||||
if (rt == NULL) {
|
||||
if (create && ifp) {
|
||||
int e;
|
||||
|
||||
@ -838,11 +838,10 @@ nd6_lookup(addr6, create, ifp)
|
||||
rt->rt_gateway->sa_family != AF_LINK || rt->rt_llinfo == NULL ||
|
||||
(ifp && rt->rt_ifa->ifa_ifp != ifp)) {
|
||||
if (create) {
|
||||
log(LOG_DEBUG,
|
||||
nd6log((LOG_DEBUG,
|
||||
"nd6_lookup: failed to lookup %s (if = %s)\n",
|
||||
ip6_sprintf(addr6),
|
||||
ifp ? if_name(ifp) : "unspec");
|
||||
/* xxx more logs... kazu */
|
||||
ifp ? if_name(ifp) : "unspec"));
|
||||
}
|
||||
RT_UNLOCK(rt);
|
||||
return (NULL);
|
||||
@ -1050,16 +1049,16 @@ nd6_nud_hint(rt, dst6, force)
|
||||
* If the caller specified "rt", use that. Otherwise, resolve the
|
||||
* routing table by supplied "dst6".
|
||||
*/
|
||||
if (!rt) {
|
||||
if (!dst6)
|
||||
if (rt == NULL) {
|
||||
if (dst6 == NULL)
|
||||
return;
|
||||
if (!(rt = nd6_lookup(dst6, 0, NULL)))
|
||||
if ((rt = nd6_lookup(dst6, 0, NULL)) == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((rt->rt_flags & RTF_GATEWAY) != 0 ||
|
||||
(rt->rt_flags & RTF_LLINFO) == 0 ||
|
||||
!rt->rt_llinfo || !rt->rt_gateway ||
|
||||
rt->rt_llinfo == NULL || rt->rt_gateway == NULL ||
|
||||
rt->rt_gateway->sa_family != AF_LINK) {
|
||||
/* This is not a host route. */
|
||||
return;
|
||||
@ -1217,7 +1216,7 @@ nd6_rtrequest(req, rt, info)
|
||||
*/
|
||||
R_Malloc(ln, struct llinfo_nd6 *, sizeof(*ln));
|
||||
rt->rt_llinfo = (caddr_t)ln;
|
||||
if (!ln) {
|
||||
if (ln == NULL) {
|
||||
log(LOG_DEBUG, "nd6_rtrequest: malloc failed\n");
|
||||
break;
|
||||
}
|
||||
@ -1290,7 +1289,7 @@ nd6_rtrequest(req, rt, info)
|
||||
int error;
|
||||
|
||||
llsol = SIN6(rt_key(rt))->sin6_addr;
|
||||
llsol.s6_addr16[0] = htons(0xff02);
|
||||
llsol.s6_addr32[0] = IPV6_ADDR_INT32_MLL;
|
||||
llsol.s6_addr32[1] = 0;
|
||||
llsol.s6_addr32[2] = htonl(1);
|
||||
llsol.s6_addr8[12] = 0xff;
|
||||
@ -1306,7 +1305,7 @@ nd6_rtrequest(req, rt, info)
|
||||
break;
|
||||
|
||||
case RTM_DELETE:
|
||||
if (!ln)
|
||||
if (ln == NULL)
|
||||
break;
|
||||
/* leave from solicited node multicast for proxy ND */
|
||||
if ((rt->rt_flags & RTF_ANNOUNCE) != 0 &&
|
||||
@ -1315,7 +1314,7 @@ nd6_rtrequest(req, rt, info)
|
||||
struct in6_multi *in6m;
|
||||
|
||||
llsol = SIN6(rt_key(rt))->sin6_addr;
|
||||
llsol.s6_addr16[0] = htons(0xff02);
|
||||
llsol.s6_addr32[0] = IPV6_ADDR_INT32_MLL;
|
||||
llsol.s6_addr32[1] = 0;
|
||||
llsol.s6_addr32[2] = htonl(1);
|
||||
llsol.s6_addr8[12] = 0xff;
|
||||
@ -1426,24 +1425,26 @@ nd6_ioctl(cmd, data, ifp)
|
||||
|
||||
break;
|
||||
case OSIOCGIFINFO_IN6:
|
||||
#define ND ndi->ndi
|
||||
/* XXX: old ndp(8) assumes a positive value for linkmtu. */
|
||||
bzero(&ndi->ndi, sizeof(ndi->ndi));
|
||||
ndi->ndi.linkmtu = IN6_LINKMTU(ifp);
|
||||
ndi->ndi.maxmtu = ND_IFINFO(ifp)->maxmtu;
|
||||
ndi->ndi.basereachable = ND_IFINFO(ifp)->basereachable;
|
||||
ndi->ndi.reachable = ND_IFINFO(ifp)->reachable;
|
||||
ndi->ndi.retrans = ND_IFINFO(ifp)->retrans;
|
||||
ndi->ndi.flags = ND_IFINFO(ifp)->flags;
|
||||
ndi->ndi.recalctm = ND_IFINFO(ifp)->recalctm;
|
||||
ndi->ndi.chlim = ND_IFINFO(ifp)->chlim;
|
||||
bzero(&ND, sizeof(ND));
|
||||
ND.linkmtu = IN6_LINKMTU(ifp);
|
||||
ND.maxmtu = ND_IFINFO(ifp)->maxmtu;
|
||||
ND.basereachable = ND_IFINFO(ifp)->basereachable;
|
||||
ND.reachable = ND_IFINFO(ifp)->reachable;
|
||||
ND.retrans = ND_IFINFO(ifp)->retrans;
|
||||
ND.flags = ND_IFINFO(ifp)->flags;
|
||||
ND.recalctm = ND_IFINFO(ifp)->recalctm;
|
||||
ND.chlim = ND_IFINFO(ifp)->chlim;
|
||||
break;
|
||||
case SIOCGIFINFO_IN6:
|
||||
ndi->ndi = *ND_IFINFO(ifp);
|
||||
ndi->ndi.linkmtu = IN6_LINKMTU(ifp);
|
||||
ND = *ND_IFINFO(ifp);
|
||||
ND.linkmtu = IN6_LINKMTU(ifp);
|
||||
break;
|
||||
case SIOCSIFINFO_FLAGS:
|
||||
ND_IFINFO(ifp)->flags = ndi->ndi.flags;
|
||||
ND_IFINFO(ifp)->flags = ND.flags;
|
||||
break;
|
||||
#undef ND
|
||||
case SIOCSNDFLUSH_IN6: /* XXX: the ioctl name is confusing... */
|
||||
/* flush default router list */
|
||||
/*
|
||||
@ -1559,9 +1560,9 @@ nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code)
|
||||
int llchange;
|
||||
int newstate = 0;
|
||||
|
||||
if (!ifp)
|
||||
if (ifp == NULL)
|
||||
panic("ifp == NULL in nd6_cache_lladdr");
|
||||
if (!from)
|
||||
if (from == NULL)
|
||||
panic("from == NULL in nd6_cache_lladdr");
|
||||
|
||||
/* nothing must be updated for unspecified address */
|
||||
@ -1579,7 +1580,7 @@ nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code)
|
||||
*/
|
||||
|
||||
rt = nd6_lookup(from, 0, ifp);
|
||||
if (!rt) {
|
||||
if (rt == NULL) {
|
||||
#if 0
|
||||
/* nothing must be done if there's no lladdr */
|
||||
if (!lladdr || !lladdrlen)
|
||||
@ -1595,7 +1596,7 @@ nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code)
|
||||
is_newentry = 0;
|
||||
}
|
||||
|
||||
if (!rt)
|
||||
if (rt == NULL)
|
||||
return NULL;
|
||||
if ((rt->rt_flags & (RTF_GATEWAY | RTF_LLINFO)) != RTF_LLINFO) {
|
||||
fail:
|
||||
@ -1603,9 +1604,9 @@ nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code)
|
||||
return NULL;
|
||||
}
|
||||
ln = (struct llinfo_nd6 *)rt->rt_llinfo;
|
||||
if (!ln)
|
||||
if (ln == NULL)
|
||||
goto fail;
|
||||
if (!rt->rt_gateway)
|
||||
if (rt->rt_gateway == NULL)
|
||||
goto fail;
|
||||
if (rt->rt_gateway->sa_family != AF_LINK)
|
||||
goto fail;
|
||||
@ -1641,15 +1642,15 @@ nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code)
|
||||
}
|
||||
|
||||
if (!is_newentry) {
|
||||
if ((!olladdr && lladdr) || /* (3) */
|
||||
(olladdr && lladdr && llchange)) { /* (5) */
|
||||
if ((!olladdr && lladdr != NULL) || /* (3) */
|
||||
(olladdr && lladdr != NULL && llchange)) { /* (5) */
|
||||
do_update = 1;
|
||||
newstate = ND6_LLINFO_STALE;
|
||||
} else /* (1-2,4) */
|
||||
do_update = 0;
|
||||
} else {
|
||||
do_update = 1;
|
||||
if (!lladdr) /* (6) */
|
||||
if (lladdr == NULL) /* (6) */
|
||||
newstate = ND6_LLINFO_NOSTATE;
|
||||
else /* (7) */
|
||||
newstate = ND6_LLINFO_STALE;
|
||||
@ -1900,7 +1901,7 @@ nd6_output(ifp, origifp, m0, dst, rt0)
|
||||
(rt = nd6_lookup(&dst->sin6_addr, 1, ifp)) != NULL)
|
||||
ln = (struct llinfo_nd6 *)rt->rt_llinfo;
|
||||
}
|
||||
if (!ln || !rt) {
|
||||
if (ln == NULL || rt == NULL) {
|
||||
if ((ifp->if_flags & IFF_POINTOPOINT) == 0 &&
|
||||
!(ND_IFINFO(ifp)->flags & ND6_IFF_PERFORMNUD)) {
|
||||
log(LOG_DEBUG,
|
||||
|
@ -203,14 +203,14 @@ nd6_ns_input(m, off, icmp6len)
|
||||
#ifdef DEV_CARP
|
||||
if (ifp->if_carp)
|
||||
ifa = carp_iamatch6(ifp->if_carp, &taddr6);
|
||||
if (!ifa)
|
||||
if (ifa == NULL)
|
||||
ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6);
|
||||
#else
|
||||
ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6);
|
||||
#endif
|
||||
|
||||
/* (2) check. */
|
||||
if (!ifa) {
|
||||
if (ifa == NULL) {
|
||||
struct rtentry *rt;
|
||||
struct sockaddr_in6 tsin6;
|
||||
int need_proxy;
|
||||
@ -671,7 +671,7 @@ nd6_na_input(m, off, icmp6len)
|
||||
* If the link-layer has address, and no lladdr option came,
|
||||
* discard the packet.
|
||||
*/
|
||||
if (ifp->if_addrlen && !lladdr)
|
||||
if (ifp->if_addrlen && lladdr == NULL)
|
||||
goto freeit;
|
||||
|
||||
/*
|
||||
@ -704,7 +704,7 @@ nd6_na_input(m, off, icmp6len)
|
||||
/*
|
||||
* Check if the link-layer address has changed or not.
|
||||
*/
|
||||
if (!lladdr)
|
||||
if (lladdr == NULL)
|
||||
llchange = 0;
|
||||
else {
|
||||
if (sdl->sdl_alen) {
|
||||
@ -735,7 +735,7 @@ nd6_na_input(m, off, icmp6len)
|
||||
* 1 1 y n (2a) L *->REACHABLE
|
||||
* 1 1 y y (2a) L *->REACHABLE
|
||||
*/
|
||||
if (!is_override && (lladdr && llchange)) { /* (1) */
|
||||
if (!is_override && (lladdr != NULL && llchange)) { /* (1) */
|
||||
/*
|
||||
* If state is REACHABLE, make it STALE.
|
||||
* no other updates should be done.
|
||||
@ -746,12 +746,12 @@ nd6_na_input(m, off, icmp6len)
|
||||
}
|
||||
goto freeit;
|
||||
} else if (is_override /* (2a) */
|
||||
|| (!is_override && (lladdr && !llchange)) /* (2b) */
|
||||
|| !lladdr) { /* (2c) */
|
||||
|| (!is_override && (lladdr != NULL && !llchange)) /* (2b) */
|
||||
|| lladdr == NULL) { /* (2c) */
|
||||
/*
|
||||
* Update link-local address, if any.
|
||||
*/
|
||||
if (lladdr) {
|
||||
if (lladdr != NULL) {
|
||||
sdl->sdl_alen = ifp->if_addrlen;
|
||||
bcopy(lladdr, LLADDR(sdl), ifp->if_addrlen);
|
||||
}
|
||||
@ -769,7 +769,7 @@ nd6_na_input(m, off, icmp6len)
|
||||
ND_IFINFO(ifp)->reachable;
|
||||
}
|
||||
} else {
|
||||
if (lladdr && llchange) {
|
||||
if (lladdr != NULL && llchange) {
|
||||
ln->ln_state = ND6_LLINFO_STALE;
|
||||
ln->ln_expire = time_second + nd6_gctimer;
|
||||
}
|
||||
@ -1120,7 +1120,7 @@ nd6_dad_start(ifa, tick)
|
||||
ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
|
||||
return;
|
||||
}
|
||||
if (!ifa->ifa_ifp)
|
||||
if (ifa->ifa_ifp == NULL)
|
||||
panic("nd6_dad_start: ifa->ifa_ifp == NULL");
|
||||
if (!(ifa->ifa_ifp->if_flags & IFF_UP)) {
|
||||
return;
|
||||
@ -1372,7 +1372,7 @@ nd6_dad_ns_input(ifa)
|
||||
struct dadq *dp;
|
||||
int duplicate;
|
||||
|
||||
if (!ifa)
|
||||
if (ifa == NULL)
|
||||
panic("ifa == NULL in nd6_dad_ns_input");
|
||||
|
||||
ia = (struct in6_ifaddr *)ifa;
|
||||
@ -1394,7 +1394,7 @@ nd6_dad_ns_input(ifa)
|
||||
* if I'm yet to start DAD, someone else started using this address
|
||||
* first. I have a duplicate and you win.
|
||||
*/
|
||||
if (!dp || dp->dad_ns_ocount == 0)
|
||||
if (dp == NULL || dp->dad_ns_ocount == 0)
|
||||
duplicate++;
|
||||
|
||||
/* XXX more checks for loopback situation - see nd6_dad_timer too */
|
||||
@ -1418,7 +1418,7 @@ nd6_dad_na_input(ifa)
|
||||
{
|
||||
struct dadq *dp;
|
||||
|
||||
if (!ifa)
|
||||
if (ifa == NULL)
|
||||
panic("ifa == NULL in nd6_dad_na_input");
|
||||
|
||||
dp = nd6_dad_find(ifa);
|
||||
|
@ -1239,7 +1239,7 @@ pfxlist_onlink_check()
|
||||
break;
|
||||
}
|
||||
|
||||
if (pr) {
|
||||
if (pr == NULL) {
|
||||
/*
|
||||
* There is at least one prefix that has a reachable router.
|
||||
* Detach prefixes which have no reachable advertising
|
||||
@ -1300,7 +1300,7 @@ pfxlist_onlink_check()
|
||||
if ((e = nd6_prefix_offlink(pr)) != 0) {
|
||||
nd6log((LOG_ERR,
|
||||
"pfxlist_onlink_check: failed to "
|
||||
"make %s/%d offlink, errno=%d\n",
|
||||
"make %s/%d onlink, errno=%d\n",
|
||||
ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
|
||||
pr->ndpr_plen, e));
|
||||
}
|
||||
@ -1382,8 +1382,8 @@ nd6_prefix_onlink(pr)
|
||||
if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) {
|
||||
nd6log((LOG_ERR,
|
||||
"nd6_prefix_onlink: %s/%d is already on-link\n",
|
||||
ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen);
|
||||
return (EEXIST));
|
||||
ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen));
|
||||
return (EEXIST);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user