Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Apr 2020 09:22:54 -0300
From:      Fernando Gont <fernando@gont.com.ar>
To:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   [PATCH] React to small IPv6 PIO Valid Lifetimes
Message-ID:  <d285173a-75c4-821e-c8e8-f6b1944fcff9@gont.com.ar>

next in thread | raw e-mail | index | archive | help
Folks,

This patch makes FreeBSD react to small PIO lifetimes. This is to 
improve the reaction of SLAAC to renumbering events, as described in: 
https://tools.ietf.org/html/draft-gont-6man-slaac-renum-05#section-4.2

The problem statement is here: 
https://tools.ietf.org/html/draft-ietf-v6ops-slaac-renum-01

P.S.: The patch is also available here: 
https://www.gont.com.ar/code/fgont-patch-freebsd-small-vltimes.txt

---- cut here ----
diff --git sys/netinet6/nd6_rtr.c sys/netinet6/nd6_rtr.c
index 2df7cca5b4b..d678a53233e 100644
--- sys/netinet6/nd6_rtr.c
+++ sys/netinet6/nd6_rtr.c
@@ -1586,7 +1586,6 @@ prelist_update(struct nd_prefixctl *new, struct 
nd_defrouter *dr,
  	 */
  	CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
  		struct in6_ifaddr *ifa6;
-		u_int32_t remaininglifetime;

  		if (ifa->ifa_addr->sa_family != AF_INET6)
  			continue;
@@ -1621,48 +1620,15 @@ prelist_update(struct nd_prefixctl *new, struct 
nd_defrouter *dr,
  		/*
  		 * An already autoconfigured address matched.  Now that we
  		 * are sure there is at least one matched address, we can
-		 * proceed to 5.5.3. (e): update the lifetimes according to the
-		 * "two hours" rule and the privacy extension.
-		 * We apply some clarifications in rfc2462bis:
-		 * - use remaininglifetime instead of storedlifetime as a
-		 *   variable name
-		 * - remove the dead code in the "two-hour" rule
+		 * proceed to the lifetimes.
+		 *
+		 * Note: We deviate from item "e)" (pp. 19-20) from
+		 * Section 5.5.3 of RFC4862 to improve the reaction of SLAAC
+		 * to renumbering events. See draft-gont-6man-slaac-renum.
  		 */
-#define TWOHOUR		(120*60)
-		lt6_tmp = ifa6->ia6_lifetime;
-
-		if (lt6_tmp.ia6t_vltime == ND6_INFINITE_LIFETIME)
-			remaininglifetime = ND6_INFINITE_LIFETIME;
-		else if (time_uptime - ifa6->ia6_updatetime >
-			 lt6_tmp.ia6t_vltime) {
-			/*
-			 * The case of "invalid" address.  We should usually
-			 * not see this case.
-			 */
-			remaininglifetime = 0;
-		} else
-			remaininglifetime = lt6_tmp.ia6t_vltime -
-			    (time_uptime - ifa6->ia6_updatetime);
-
-		/* when not updating, keep the current stored lifetime. */
-		lt6_tmp.ia6t_vltime = remaininglifetime;
-
-		if (TWOHOUR < new->ndpr_vltime ||
-		    remaininglifetime < new->ndpr_vltime) {
-			lt6_tmp.ia6t_vltime = new->ndpr_vltime;
-		} else if (remaininglifetime <= TWOHOUR) {
-			if (auth) {
-				lt6_tmp.ia6t_vltime = new->ndpr_vltime;
-			}
-		} else {
-			/*
-			 * new->ndpr_vltime <= TWOHOUR &&
-			 * TWOHOUR < remaininglifetime
-			 */
-			lt6_tmp.ia6t_vltime = TWOHOUR;
-		}

-		/* The 2 hour rule is not imposed for preferred lifetime. */
+		lt6_tmp = ifa6->ia6_lifetime;
+		lt6_tmp.ia6t_vltime = new->ndpr_vltime;
  		lt6_tmp.ia6t_pltime = new->ndpr_pltime;

  		in6_init_address_ltimes(pr, &lt6_tmp);
---- cut here ----

Thanks!

Cheers,
-- 
Fernando Gont
e-mail: fernando@gont.com.ar || fgont@si6networks.com
PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d285173a-75c4-821e-c8e8-f6b1944fcff9>