From 0e97fbedd36ed92c353845c92a08db78ef4b1d1f Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Fri, 30 Sep 2016 06:27:22 +0000 Subject: Revert sending router solicitations when a prefix expires and go back to previous behaviour of starting quick, exponentially backing off and settling on every 60 seconds. sthen@ noticed that this broke the backing off when we don't receive an advertisment and so we would hammer the network every second which is particularly bad on wifi networks. OK sthen@ --- sys/netinet6/nd6_rtr.c | 51 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 43 deletions(-) (limited to 'sys') diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 93e2f4caee0..e9695f601a1 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.146 2016/09/26 19:39:24 sthen Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.147 2016/09/30 06:27:21 florian Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -75,7 +75,6 @@ int rt6_deleteroute(struct rtentry *, void *, unsigned int); void nd6_addr_add(void *); void nd6_rs_output_timo(void *); -u_int32_t nd6_rs_next_pltime_timo(struct ifnet *); void nd6_rs_output_set_timo(int); void nd6_rs_output(struct ifnet *, struct in6_ifaddr *); void nd6_rs_dev_state(void *); @@ -284,64 +283,30 @@ nd6_rs_output_set_timo(int timeout) timeout_add_sec(&nd6_rs_output_timer, nd6_rs_output_timeout); } -u_int32_t -nd6_rs_next_pltime_timo(struct ifnet *ifp) -{ - struct ifaddr *ifa; - struct in6_ifaddr *ia6; - u_int32_t pltime_expires = ND6_INFINITE_LIFETIME; - - TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - if (ifa->ifa_addr->sa_family != AF_INET6) - continue; - - ia6 = ifatoia6(ifa); - if (ia6->ia6_lifetime.ia6t_pltime == ND6_INFINITE_LIFETIME || - IFA6_IS_DEPRECATED(ia6) || IFA6_IS_INVALID(ia6)) - continue; - - pltime_expires = MIN(pltime_expires, - ia6->ia6_lifetime.ia6t_pltime); - } - - return pltime_expires; -} - void nd6_rs_output_timo(void *ignored_arg) { struct ifnet *ifp; struct in6_ifaddr *ia6; - u_int32_t pltime_expire = ND6_INFINITE_LIFETIME, t; - int timeout = ND6_RS_OUTPUT_INTERVAL; if (nd6_rs_timeout_count == 0) return; if (nd6_rs_output_timeout < ND6_RS_OUTPUT_INTERVAL) /* exponential backoff if running quick timeouts */ - timeout = nd6_rs_output_timeout * 2; + nd6_rs_output_timeout *= 2; + if (nd6_rs_output_timeout > ND6_RS_OUTPUT_INTERVAL) + nd6_rs_output_timeout = ND6_RS_OUTPUT_INTERVAL; TAILQ_FOREACH(ifp, &ifnet, if_list) { if (ISSET(ifp->if_flags, IFF_RUNNING) && ISSET(ifp->if_xflags, IFXF_AUTOCONF6)) { - t = nd6_rs_next_pltime_timo(ifp); - if (t == ND6_INFINITE_LIFETIME || t < - ND6_RS_OUTPUT_INTERVAL) { - timeout = ND6_RS_OUTPUT_QUICK_INTERVAL; - ia6 = in6ifa_ifpforlinklocal(ifp, - IN6_IFF_TENTATIVE); - if (ia6 != NULL) - nd6_rs_output(ifp, ia6); - } - - pltime_expire = MIN(pltime_expire, t); + ia6 = in6ifa_ifpforlinklocal(ifp, IN6_IFF_TENTATIVE); + if (ia6 != NULL) + nd6_rs_output(ifp, ia6); } } - if (pltime_expire != ND6_INFINITE_LIFETIME) - timeout = MAX(timeout, pltime_expire / 2); - - nd6_rs_output_set_timo(timeout); + nd6_rs_output_set_timo(nd6_rs_output_timeout); } void -- cgit v1.2.3