Both are initalised with compile-time constants and never written to.
They are part of the Neighbour Discovery machinery and only surface
through the single-user SIOCGIFINFO_IN6:
$ ndp -i lo0
basereachable=30s0ms, reachable=39s, retrans=1s0ms
These values are read-only since 2017
sys/netinet6/nd6.c r1.217
usr.sbin/ndp/ndp.c r1.85
Remove knob and always do neighbor unreachable detection
Inline the macros (to keep meaningful names), shrink the per-interface
allocated struct nd_ifinfo to what is actually needed and inline
nd6_dad_starttimer()'s constant `msec' argument.
Nothing else in base, incl. regress, uses SIOCGIFINFO_IN6 or `ndp -i'.
OK bluhm
-/* $OpenBSD: nd6.c,v 1.256 2022/11/28 19:13:36 kn Exp $ */
+/* $OpenBSD: nd6.c,v 1.257 2022/12/02 15:35:35 kn Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
nd = malloc(sizeof(*nd), M_IP6NDP, M_WAITOK | M_ZERO);
- nd->basereachable = REACHABLE_TIME;
- nd->reachable = ND_COMPUTE_RTIME(nd->basereachable);
- nd->retrans = RETRANS_TIMER;
+ nd->reachable = ND_COMPUTE_RTIME(REACHABLE_TIME);
ifp->if_nd = nd;
}
case ND6_LLINFO_INCOMPLETE:
if (ln->ln_asked < nd6_mmaxtries) {
ln->ln_asked++;
- nd6_llinfo_settimer(ln, ifp->if_nd->retrans / 1000);
+ nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
nd6_ns_output(ifp, NULL, &dst->sin6_addr, ln, 0);
} else {
struct mbuf *m = ln->ln_hold;
/* We need NUD */
ln->ln_asked = 1;
ln->ln_state = ND6_LLINFO_PROBE;
- nd6_llinfo_settimer(ln, ifp->if_nd->retrans / 1000);
+ nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
nd6_ns_output(ifp, &dst->sin6_addr, &dst->sin6_addr, ln, 0);
break;
case ND6_LLINFO_PROBE:
if (ln->ln_asked < nd6_umaxtries) {
ln->ln_asked++;
- nd6_llinfo_settimer(ln, ifp->if_nd->retrans / 1000);
+ nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
nd6_ns_output(ifp, &dst->sin6_addr,
&dst->sin6_addr, ln, 0);
} else {
TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
nd6if = ifp->if_nd;
- if (nd6if->basereachable && /* already initialized */
- (nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) {
+ if ((nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) {
/*
* Since reachable time rarely changes by router
* advertisements, we SHOULD insure that a new random
* (RFC 2461, 6.3.4)
*/
nd6if->recalctm = ND6_RECALC_REACHTM_INTERVAL;
- nd6if->reachable = ND_COMPUTE_RTIME(nd6if->basereachable);
+ nd6if->reachable = ND_COMPUTE_RTIME(REACHABLE_TIME);
}
}
NET_UNLOCK();
*/
if (!ND6_LLINFO_PERMANENT(ln) && ln->ln_asked == 0) {
ln->ln_asked++;
- nd6_llinfo_settimer(ln, ifp->if_nd->retrans / 1000);
+ nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
nd6_ns_output(ifp, NULL, &satosin6(dst)->sin6_addr, ln, 0);
}
return (EAGAIN);
-/* $OpenBSD: nd6.h,v 1.90 2022/11/28 19:13:36 kn Exp $ */
+/* $OpenBSD: nd6.h,v 1.91 2022/12/02 15:35:35 kn Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
/*
* Locks used to protect struct members in this file:
- * I immutable after creation
* N net lock
*/
struct nd_ifinfo {
- u_int32_t basereachable; /* [I] BaseReachableTime */
u_int32_t reachable; /* [N] Reachable Time */
- u_int32_t retrans; /* [I] Retrans Timer */
int recalctm; /* [N] BaseReachable recalc timer */
};
-/* $OpenBSD: nd6_nbr.c,v 1.137 2022/12/02 12:58:37 kn Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.138 2022/12/02 15:35:35 kn Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
};
struct dadq *nd6_dad_find(struct ifaddr *);
-void nd6_dad_starttimer(struct dadq *, int);
+void nd6_dad_starttimer(struct dadq *);
void nd6_dad_stoptimer(struct dadq *);
void nd6_dad_timer(void *);
void nd6_dad_ns_output(struct dadq *, struct ifaddr *);
}
void
-nd6_dad_starttimer(struct dadq *dp, int msec)
+nd6_dad_starttimer(struct dadq *dp)
{
-
timeout_set_proc(&dp->dad_timer_ch, nd6_dad_timer, dp->dad_ifa);
- timeout_add_msec(&dp->dad_timer_ch, msec);
+ timeout_add_msec(&dp->dad_timer_ch, RETRANS_TIMER);
}
void
nd6_dad_stoptimer(struct dadq *dp)
{
-
timeout_del(&dp->dad_timer_ch);
}
dp->dad_ns_icount = dp->dad_na_icount = 0;
dp->dad_ns_ocount = dp->dad_ns_tcount = 0;
nd6_dad_ns_output(dp, ifa);
- nd6_dad_starttimer(dp, ifa->ifa_ifp->if_nd->retrans);
+ nd6_dad_starttimer(dp);
}
/*
* We have more NS to go. Send NS packet for DAD.
*/
nd6_dad_ns_output(dp, ifa);
- nd6_dad_starttimer(dp, ifa->ifa_ifp->if_nd->retrans);
+ nd6_dad_starttimer(dp);
} else {
/*
* We have transmitted sufficient number of DAD packets.
-/* $OpenBSD: ndp.c,v 1.105 2022/11/28 19:13:36 kn Exp $ */
+/* $OpenBSD: ndp.c,v 1.106 2022/12/02 15:35:35 kn Exp $ */
/* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */
/*
if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) == -1)
err(1, "ioctl(SIOCGIFINFO_IN6)");
- printf("basereachable=%ds%dms",
- nd.ndi.basereachable / 1000, nd.ndi.basereachable % 1000);
- printf(", reachable=%ds", nd.ndi.reachable);
- printf(", retrans=%ds%dms\n", nd.ndi.retrans / 1000,
- nd.ndi.retrans % 1000);
+ printf("reachable=%ds\n", nd.ndi.reachable);
close(s);
}