internally, nd6 llinfo keeps track of seconds, and the majority of
the callers work in seconds.
the exception is the nd_ifinfo retrans stuff which is msec, not
seconds.
i believe there is a bug fix in here too relating to the use of
nd_defrouter.expire handling in nd6_free. from what i can tell,
nd_defrouter.expire measures seconds, and is compared against
time_seconds. ticks and hz shouldnt be mixed into the comparisons
of it.
ok?
Index: nd6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.180
diff -u -p -r1.180 nd6.c
--- nd6.c 30 May 2016 23:37:37 -0000 1.180
+++ nd6.c 31 May 2016 01:48:39 -0000
@@ -304,18 +304,18 @@ skip1:
* ND6 timer routine to handle ND6 entries
*/
void
-nd6_llinfo_settimer(struct llinfo_nd6 *ln, long tick)
+nd6_llinfo_settimer(struct llinfo_nd6 *ln, int secs)
{
int s;
s = splsoftnet();
- if (tick < 0) {
+ if (secs < 0) {
ln->ln_expire = 0;
timeout_del(&ln->ln_timer_ch);
} else {
- ln->ln_expire = time_second + tick / hz;
- timeout_add(&ln->ln_timer_ch, tick);
+ ln->ln_expire = time_second + secs;
+ timeout_add_sec(&ln->ln_timer_ch, secs);
}
splx(s);
@@ -355,7 +355,7 @@ nd6_llinfo_timer(void *arg)
case ND6_LLINFO_INCOMPLETE:
if (ln->ln_asked < nd6_mmaxtries) {
ln->ln_asked++;
- nd6_llinfo_settimer(ln, (long)ndi->retrans * hz / 1000);
+ nd6_llinfo_settimer(ln, ndi->retrans / 1000);
nd6_ns_output(ifp, NULL, &dst->sin6_addr, ln, 0);
} else {
struct mbuf *m = ln->ln_hold;
@@ -385,7 +385,7 @@ nd6_llinfo_timer(void *arg)
case ND6_LLINFO_REACHABLE:
if (!ND6_LLINFO_PERMANENT(ln)) {
ln->ln_state = ND6_LLINFO_STALE;
- nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+ nd6_llinfo_settimer(ln, nd6_gctimer);
}
break;
@@ -403,18 +403,18 @@ nd6_llinfo_timer(void *arg)
/* We need NUD */
ln->ln_asked = 1;
ln->ln_state = ND6_LLINFO_PROBE;
- nd6_llinfo_settimer(ln, (long)ndi->retrans * hz / 1000);
+ nd6_llinfo_settimer(ln, ndi->retrans / 1000);
nd6_ns_output(ifp, &dst->sin6_addr,
&dst->sin6_addr, ln, 0);
} else {
ln->ln_state = ND6_LLINFO_STALE; /* XXX */
- nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+ nd6_llinfo_settimer(ln, nd6_gctimer);
}
break;
case ND6_LLINFO_PROBE:
if (ln->ln_asked < nd6_umaxtries) {
ln->ln_asked++;
- nd6_llinfo_settimer(ln, (long)ndi->retrans * hz / 1000);
+ nd6_llinfo_settimer(ln, ndi->retrans / 1000);
nd6_ns_output(ifp, &dst->sin6_addr,
&dst->sin6_addr, ln, 0);
} else {
@@ -751,11 +751,11 @@ nd6_free(struct rtentry *rt, int gc)
* XXX: the check for ln_state would be redundant,
* but we intentionally keep it just in case.
*/
- if (dr->expire > time_second * hz) {
+ if (dr->expire > time_second) {
nd6_llinfo_settimer(ln,
- dr->expire - time_second * hz);
+ dr->expire - time_second);
} else
- nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+ nd6_llinfo_settimer(ln, nd6_gctimer);
splx(s);
if_put(ifp);
return (TAILQ_NEXT(ln, ln_list));
@@ -860,7 +860,7 @@ nd6_nud_hint(struct rtentry *rt)
ln->ln_state = ND6_LLINFO_REACHABLE;
if (!ND6_LLINFO_PERMANENT(ln))
- nd6_llinfo_settimer(ln, (long)ND_IFINFO(ifp)->reachable * hz);
+ nd6_llinfo_settimer(ln, ND_IFINFO(ifp)->reachable);
out:
if_put(ifp);
}
@@ -1350,7 +1350,7 @@ fail:
* we must set the timer now, although it is actually
* meaningless.
*/
- nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+ nd6_llinfo_settimer(ln, nd6_gctimer);
if (ln->ln_hold) {
struct mbuf *n = ln->ln_hold;
@@ -1568,7 +1568,7 @@ nd6_output(struct ifnet *ifp, struct mbu
if (ln->ln_state == ND6_LLINFO_STALE) {
ln->ln_asked = 0;
ln->ln_state = ND6_LLINFO_DELAY;
- nd6_llinfo_settimer(ln, nd6_delay * hz);
+ nd6_llinfo_settimer(ln, nd6_delay);
}
/*
@@ -1594,8 +1594,7 @@ nd6_output(struct ifnet *ifp, struct mbu
*/
if (!ND6_LLINFO_PERMANENT(ln) && ln->ln_asked == 0) {
ln->ln_asked++;
- nd6_llinfo_settimer(ln,
- (long)ND_IFINFO(ifp)->retrans * hz / 1000);
+ nd6_llinfo_settimer(ln, ND_IFINFO(ifp)->retrans / 1000);
nd6_ns_output(ifp, NULL, &dst->sin6_addr, ln, 0);
}
if (created)
Index: nd6.h
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.h,v
retrieving revision 1.59
diff -u -p -r1.59 nd6.h
--- nd6.h 30 May 2016 23:37:37 -0000 1.59
+++ nd6.h 31 May 2016 01:48:39 -0000
@@ -260,7 +260,7 @@ struct nd_opt_hdr *nd6_option(union nd_o
int nd6_options(union nd_opts *);
struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *, u_int);
void nd6_setmtu(struct ifnet *);
-void nd6_llinfo_settimer(struct llinfo_nd6 *, long);
+void nd6_llinfo_settimer(struct llinfo_nd6 *, int);
void nd6_timer(void *);
void nd6_purge(struct ifnet *);
void nd6_nud_hint(struct rtentry *);
Index: nd6_nbr.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6_nbr.c,v
retrieving revision 1.102
diff -u -p -r1.102 nd6_nbr.c
--- nd6_nbr.c 29 Mar 2016 11:57:51 -0000 1.102
+++ nd6_nbr.c 31 May 2016 01:48:39 -0000
@@ -729,11 +729,11 @@ nd6_na_input(struct mbuf *m, int off, in
ln->ln_byhint = 0;
if (!ND6_LLINFO_PERMANENT(ln)) {
nd6_llinfo_settimer(ln,
- (long)ND_IFINFO(ifp)->reachable * hz);
+ ND_IFINFO(ifp)->reachable);
}
} else {
ln->ln_state = ND6_LLINFO_STALE;
- nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+ nd6_llinfo_settimer(ln, nd6_gctimer);
}
if ((ln->ln_router = is_router) != 0) {
/*
@@ -789,7 +789,7 @@ nd6_na_input(struct mbuf *m, int off, in
*/
if (ln->ln_state == ND6_LLINFO_REACHABLE) {
ln->ln_state = ND6_LLINFO_STALE;
- nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
+ nd6_llinfo_settimer(ln, nd6_gctimer);
}
goto freeit;
} else if (is_override /* (2a) */
@@ -820,13 +820,12 @@ nd6_na_input(struct mbuf *m, int off, in
ln->ln_byhint = 0;
if (!ND6_LLINFO_PERMANENT(ln)) {
nd6_llinfo_settimer(ln,
- (long)ND_IFINFO(ifp)->reachable *
hz);
+ ND_IFINFO(ifp)->reachable);
}
} else {
if (lladdr && llchange) {
ln->ln_state = ND6_LLINFO_STALE;
- nd6_llinfo_settimer(ln,
- (long)nd6_gctimer * hz);
+ nd6_llinfo_settimer(ln, nd6_gctimer);
}
}
}