garbage-collect stale ND entries (default: 1 day).
RFC 2461 5.3. sync with kame.
This commit is contained in:
parent
28e741ef5e
commit
f2a66201fc
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nd6.c,v 1.41 2001/02/23 06:41:50 itojun Exp $ */
|
||||
/* $NetBSD: nd6.c,v 1.42 2001/02/23 08:02:41 itojun Exp $ */
|
||||
/* $KAME: nd6.c,v 1.131 2001/02/21 16:28:18 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -88,6 +88,7 @@ int nd6_delay = 5; /* delay first probe time 5 second */
|
||||
int nd6_umaxtries = 3; /* maximum unicast query */
|
||||
int nd6_mmaxtries = 3; /* maximum multicast query */
|
||||
int nd6_useloopback = 1; /* use loopback interface for local traffic */
|
||||
int nd6_gctimer = (60 * 60 * 24); /* 1 day: garbage collection timer */
|
||||
|
||||
/* preventing too many loops in ND option parsing */
|
||||
int nd6_maxndopt = 10; /* max # of ND options allowed */
|
||||
@ -479,13 +480,18 @@ nd6_timer(ignored_arg)
|
||||
}
|
||||
break;
|
||||
case ND6_LLINFO_REACHABLE:
|
||||
if (ln->ln_expire)
|
||||
if (ln->ln_expire) {
|
||||
ln->ln_state = ND6_LLINFO_STALE;
|
||||
ln->ln_expire = time_second + nd6_gctimer;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
* ND6_LLINFO_STALE state requires nothing for timer
|
||||
* routine.
|
||||
*/
|
||||
|
||||
case ND6_LLINFO_STALE:
|
||||
/* Garbage Collection(RFC 2461 5.3) */
|
||||
if (ln->ln_expire)
|
||||
next = nd6_free(rt);
|
||||
break;
|
||||
|
||||
case ND6_LLINFO_DELAY:
|
||||
if (ndi && (ndi->flags & ND6_IFF_PERFORMNUD) != 0) {
|
||||
/* We need NUD */
|
||||
@ -496,8 +502,10 @@ nd6_timer(ignored_arg)
|
||||
nd6_ns_output(ifp, &dst->sin6_addr,
|
||||
&dst->sin6_addr,
|
||||
ln, 0);
|
||||
} else
|
||||
} else {
|
||||
ln->ln_state = ND6_LLINFO_STALE; /* XXX */
|
||||
ln->ln_expire = time_second + nd6_gctimer;
|
||||
}
|
||||
break;
|
||||
case ND6_LLINFO_PROBE:
|
||||
if (ln->ln_asked < nd6_umaxtries) {
|
||||
@ -1656,6 +1664,7 @@ fail:
|
||||
#endif
|
||||
ln->ln_hold = 0;
|
||||
}
|
||||
ln->ln_expire = time_second + nd6_gctimer;
|
||||
} else if (ln->ln_state == ND6_LLINFO_INCOMPLETE) {
|
||||
/* probe right away */
|
||||
ln->ln_expire = time_second;
|
||||
@ -1820,7 +1829,7 @@ nd6_output(ifp, origifp, m0, dst, rt0)
|
||||
/*
|
||||
* We skip link-layer address resolution and NUD
|
||||
* if the gateway is not a neighbor from ND point
|
||||
* of view, regardless the value of the value of
|
||||
* of view, regardless the value of the
|
||||
* nd_ifinfo.flags.
|
||||
* The second condition is a bit tricky: we skip
|
||||
* if the gateway is our own address, which is
|
||||
@ -1885,8 +1894,10 @@ nd6_output(ifp, origifp, m0, dst, rt0)
|
||||
|
||||
/* We don't have to do link-layer address resolution on a p2p link. */
|
||||
if ((ifp->if_flags & IFF_POINTOPOINT) != 0 &&
|
||||
ln->ln_state < ND6_LLINFO_REACHABLE)
|
||||
ln->ln_state < ND6_LLINFO_REACHABLE) {
|
||||
ln->ln_state = ND6_LLINFO_STALE;
|
||||
ln->ln_expire = time_second + nd6_gctimer;
|
||||
}
|
||||
|
||||
/*
|
||||
* The first time we send a packet to a neighbor whose entry is
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nd6.h,v 1.19 2001/02/23 06:41:50 itojun Exp $ */
|
||||
/* $NetBSD: nd6.h,v 1.20 2001/02/23 08:02:41 itojun Exp $ */
|
||||
/* $KAME: nd6.h,v 1.52 2001/02/19 04:40:37 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -240,6 +240,7 @@ extern int nd6_umaxtries;
|
||||
extern int nd6_mmaxtries;
|
||||
extern int nd6_useloopback;
|
||||
extern int nd6_maxnudhint;
|
||||
extern int nd6_gctimer;
|
||||
extern struct llinfo_nd6 llinfo_nd6;
|
||||
extern struct nd_ifinfo *nd_ifinfo;
|
||||
extern struct nd_drhead nd_defrouter;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: nd6_nbr.c,v 1.27 2001/02/11 07:00:03 itojun Exp $ */
|
||||
/* $KAME: nd6_nbr.c,v 1.57 2001/02/07 08:18:21 itojun Exp $ */
|
||||
/* $NetBSD: nd6_nbr.c,v 1.28 2001/02/23 08:02:42 itojun Exp $ */
|
||||
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -662,8 +662,10 @@ nd6_na_input(m, off, icmp6len)
|
||||
if (ln->ln_expire)
|
||||
ln->ln_expire = time.tv_sec +
|
||||
nd_ifinfo[rt->rt_ifp->if_index].reachable;
|
||||
} else
|
||||
} else {
|
||||
ln->ln_state = ND6_LLINFO_STALE;
|
||||
ln->ln_expire = time.tv_sec + nd6_gctimer;
|
||||
}
|
||||
ln->ln_router = is_router;
|
||||
} else {
|
||||
int llchange;
|
||||
@ -707,8 +709,10 @@ nd6_na_input(m, off, icmp6len)
|
||||
* If state is REACHABLE, make it STALE.
|
||||
* no other updates should be done.
|
||||
*/
|
||||
if (ln->ln_state == ND6_LLINFO_REACHABLE)
|
||||
if (ln->ln_state == ND6_LLINFO_REACHABLE) {
|
||||
ln->ln_state = ND6_LLINFO_STALE;
|
||||
ln->ln_expire = time.tv_sec + nd6_gctimer;
|
||||
}
|
||||
goto freeit;
|
||||
} else if (is_override /* (2a) */
|
||||
|| (!is_override && (lladdr && !llchange)) /* (2b) */
|
||||
@ -734,8 +738,10 @@ nd6_na_input(m, off, icmp6len)
|
||||
nd_ifinfo[ifp->if_index].reachable;
|
||||
}
|
||||
} else {
|
||||
if (lladdr && llchange)
|
||||
if (lladdr && llchange) {
|
||||
ln->ln_state = ND6_LLINFO_STALE;
|
||||
ln->ln_expire = time.tv_sec + nd6_gctimer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user