remove unnecessary state, ND6_LLINFO_WAITDELETE, from neighbor cache
state machine. no need for RTF_REJECT on neighbor cache entires, they are leftover from ARP code. sync with kame.
This commit is contained in:
parent
baf0985f2a
commit
e1196a8f6e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nd6.c,v 1.40 2001/02/21 17:23:09 itojun Exp $ */
|
||||
/* $NetBSD: nd6.c,v 1.41 2001/02/23 06:41:50 itojun Exp $ */
|
||||
/* $KAME: nd6.c,v 1.131 2001/02/21 16:28:18 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -509,9 +509,6 @@ nd6_timer(ignored_arg)
|
||||
} else
|
||||
next = nd6_free(rt);
|
||||
break;
|
||||
case ND6_LLINFO_WAITDELETE:
|
||||
next = nd6_free(rt);
|
||||
break;
|
||||
}
|
||||
ln = next;
|
||||
}
|
||||
@ -646,29 +643,6 @@ nd6_purge(ifp)
|
||||
}
|
||||
ln = nln;
|
||||
}
|
||||
|
||||
/*
|
||||
* Neighbor cache entry for interface route will be retained
|
||||
* with ND6_LLINFO_WAITDELETE state, by nd6_free(). Nuke it.
|
||||
*/
|
||||
ln = llinfo_nd6.ln_next;
|
||||
while (ln && ln != &llinfo_nd6) {
|
||||
struct rtentry *rt;
|
||||
struct sockaddr_dl *sdl;
|
||||
|
||||
nln = ln->ln_next;
|
||||
rt = ln->ln_rt;
|
||||
if (rt && rt->rt_gateway &&
|
||||
rt->rt_gateway->sa_family == AF_LINK) {
|
||||
sdl = (struct sockaddr_dl *)rt->rt_gateway;
|
||||
if (sdl->sdl_index == ifp->if_index) {
|
||||
rtrequest(RTM_DELETE, rt_key(rt),
|
||||
(struct sockaddr *)0, rt_mask(rt), 0,
|
||||
(struct rtentry **)0);
|
||||
}
|
||||
}
|
||||
ln = nln;
|
||||
}
|
||||
}
|
||||
|
||||
struct rtentry *
|
||||
@ -825,7 +799,6 @@ nd6_free(rt)
|
||||
struct rtentry *rt;
|
||||
{
|
||||
struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo, *next;
|
||||
struct sockaddr_dl *sdl;
|
||||
struct in6_addr in6 = ((struct sockaddr_in6 *)rt_key(rt))->sin6_addr;
|
||||
struct nd_defrouter *dr;
|
||||
|
||||
@ -883,15 +856,6 @@ nd6_free(rt)
|
||||
splx(s);
|
||||
}
|
||||
|
||||
if (rt->rt_refcnt > 0 && (sdl = SDL(rt->rt_gateway)) &&
|
||||
sdl->sdl_family == AF_LINK) {
|
||||
sdl->sdl_alen = 0;
|
||||
ln->ln_state = ND6_LLINFO_WAITDELETE;
|
||||
ln->ln_asked = 0;
|
||||
rt->rt_flags &= ~RTF_REJECT;
|
||||
return ln->ln_next;
|
||||
}
|
||||
|
||||
/*
|
||||
* Before deleting the entry, remember the next entry as the
|
||||
* return value. We need this because pfxlist_onlink_check() above
|
||||
@ -1040,14 +1004,12 @@ nd6_resolve(ifp, rt, m, dst, desten)
|
||||
* XXX Does the code conform to rate-limiting rule?
|
||||
* (RFC 2461 7.2.2)
|
||||
*/
|
||||
if (ln->ln_state == ND6_LLINFO_WAITDELETE ||
|
||||
ln->ln_state == ND6_LLINFO_NOSTATE)
|
||||
if (ln->ln_state == ND6_LLINFO_NOSTATE)
|
||||
ln->ln_state = ND6_LLINFO_INCOMPLETE;
|
||||
if (ln->ln_hold)
|
||||
m_freem(ln->ln_hold);
|
||||
ln->ln_hold = m;
|
||||
if (ln->ln_expire) {
|
||||
rt->rt_flags &= ~RTF_REJECT;
|
||||
if (ln->ln_asked < nd6_mmaxtries &&
|
||||
ln->ln_expire < time_second) {
|
||||
ln->ln_asked++;
|
||||
@ -1679,7 +1641,6 @@ fail:
|
||||
ln->ln_state = newstate;
|
||||
|
||||
if (ln->ln_state == ND6_LLINFO_STALE) {
|
||||
rt->rt_flags &= ~RTF_REJECT;
|
||||
if (ln->ln_hold) {
|
||||
#ifdef OLDIP6OUTPUT
|
||||
(*ifp->if_output)(ifp, ln->ln_hold,
|
||||
@ -1867,9 +1828,6 @@ nd6_output(ifp, origifp, m0, dst, rt0)
|
||||
*/
|
||||
if (!nd6_is_addr_neighbor(gw6, ifp) ||
|
||||
in6ifa_ifpwithaddr(ifp, &gw6->sin6_addr)) {
|
||||
if (rt->rt_flags & RTF_REJECT)
|
||||
senderr(EHOSTDOWN);
|
||||
|
||||
/*
|
||||
* We allow this kind of tricky route only
|
||||
* when the outgoing interface is p2p.
|
||||
@ -1890,8 +1848,6 @@ nd6_output(ifp, origifp, m0, dst, rt0)
|
||||
senderr(EHOSTUNREACH);
|
||||
}
|
||||
}
|
||||
if (rt->rt_flags & RTF_REJECT)
|
||||
senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1961,14 +1917,12 @@ nd6_output(ifp, origifp, m0, dst, rt0)
|
||||
* XXX Does the code conform to rate-limiting rule?
|
||||
* (RFC 2461 7.2.2)
|
||||
*/
|
||||
if (ln->ln_state == ND6_LLINFO_WAITDELETE ||
|
||||
ln->ln_state == ND6_LLINFO_NOSTATE)
|
||||
if (ln->ln_state == ND6_LLINFO_NOSTATE)
|
||||
ln->ln_state = ND6_LLINFO_INCOMPLETE;
|
||||
if (ln->ln_hold)
|
||||
m_freem(ln->ln_hold);
|
||||
ln->ln_hold = m;
|
||||
if (ln->ln_expire) {
|
||||
rt->rt_flags &= ~RTF_REJECT;
|
||||
if (ln->ln_asked < nd6_mmaxtries &&
|
||||
ln->ln_expire < time_second) {
|
||||
ln->ln_asked++;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: nd6.h,v 1.18 2001/02/08 12:57:55 itojun Exp $ */
|
||||
/* $KAME: nd6.h,v 1.46 2001/02/08 10:57:00 itojun Exp $ */
|
||||
/* $NetBSD: nd6.h,v 1.19 2001/02/23 06:41:50 itojun Exp $ */
|
||||
/* $KAME: nd6.h,v 1.52 2001/02/19 04:40:37 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -54,7 +54,14 @@ struct llinfo_nd6 {
|
||||
};
|
||||
|
||||
#define ND6_LLINFO_NOSTATE -2
|
||||
#define ND6_LLINFO_WAITDELETE -1
|
||||
/*
|
||||
* We don't need the WAITDELETE state any more, but we keep the definition
|
||||
* in a comment line instead of removing it. This is necessary to avoid
|
||||
* unintentionally reusing the value for another purpose, which might
|
||||
* affect backward compatibility with old applications.
|
||||
* (20000711 jinmei@kame.net)
|
||||
*/
|
||||
/* #define ND6_LLINFO_WAITDELETE -1 */
|
||||
#define ND6_LLINFO_INCOMPLETE 0
|
||||
#define ND6_LLINFO_REACHABLE 1
|
||||
#define ND6_LLINFO_STALE 2
|
||||
|
Loading…
Reference in New Issue
Block a user