From owner-freebsd-net@freebsd.org Thu Apr 2 12:23:26 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C9FB265873 for ; Thu, 2 Apr 2020 12:23:26 +0000 (UTC) (envelope-from fernando@gont.com.ar) Received: from fgont.go6lab.si (fgont.go6lab.si [91.239.96.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48tMfb0s93z4W0m for ; Thu, 2 Apr 2020 12:23:18 +0000 (UTC) (envelope-from fernando@gont.com.ar) Received: from [192.168.0.10] (unknown [181.45.84.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by fgont.go6lab.si (Postfix) with ESMTPSA id EDC0589385; Thu, 2 Apr 2020 14:23:07 +0200 (CEST) To: FreeBSD Net From: Fernando Gont Subject: [PATCH] React to small IPv6 PIO Valid Lifetimes Message-ID: Date: Thu, 2 Apr 2020 09:22:54 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 48tMfb0s93z4W0m X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of fernando@gont.com.ar designates 91.239.96.14 as permitted sender) smtp.mailfrom=fernando@gont.com.ar X-Spamd-Result: default: False [-5.78 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[gont.com.ar]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(-3.48)[ip: (-9.24), ipnet: 91.239.96.0/23(-4.62), asn: 198644(-3.58), country: SI(0.01)]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[14.96.239.91.list.dnswl.org : 127.0.10.0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:198644, ipnet:91.239.96.0/23, country:SI]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 12:23:26 -0000 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, <6_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