Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp864314pxb; Tue, 1 Feb 2022 12:02:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTviY3BqS3OHPZ4Nu8+xnsvEzqQavUMJ7Z6s0N+8HiBgY5Xa1O6A5qRHsRhLe/NnlRbB6k X-Received: by 2002:a17:907:7f91:: with SMTP id qk17mr15433420ejc.29.1643745734185; Tue, 01 Feb 2022 12:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745734; cv=none; d=google.com; s=arc-20160816; b=TnfP8lDYeGVI6JJGQPBkkLFG7E7zhXVl6JhGYiXvn+aUoKAW7INqvgRRQjSFUbWCAL ruv499AG+x2U536dSzGtGQlD0alKHhBYCfRSPBlnBP0eJqVYpkpdxBst7hq7sNyC9379 3D6K51M6xcckZuxFmFSZqIOIdmF4gaRzW9wI1wO4XKYcaH1ZZ8uvUePbXa6kh4TG/URU YLtySE0rEXQLGrZr2Bzy8BV7lcWK2wj4xf8FalxlSSazhkRDpcjpBJl6Tz3K3rdHRMOH bpqHVPJU+5W9UFmY4a58FeLd7YqLpSNfXLs13E6plosq0SA0CJeWeA0mnwdVrG5Clcb3 TE4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zw5LUgRUDvAxbjL8ZABoR8mepBLExDEZCI5OZ+ZUeCI=; b=p4IchBItjdm79TTzwZ7h3jUS/aPhXoEbsyowLOFZT+1giBXoyLGIF8cwfvSwdBy5Px H1LshVHvqatgoHRjR0KJ9+Rk57rQHfC/o5eH3vvlQBfvPBw+Lil4EeYdTX6txou8VGYS WYkwXR6P5KFRGAYsqsr8kmmWK2PwhYCJhbPCwQWwXVPnUSV/jVHEcvn1+hVZiUeTBM+g 6aily2hx+WKN+epHTzhTftRSDU+9fglAve5SWXr1H6qo3kkUXg3m3k4JTBiB32YsT4VZ K6lEeiYVX/EHBhCgEssHKEWTL0ZkJN5hDQHu0NcoW09COQ92U0YJPMmbrV3NHDk9N+YS 9EWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pyLQsk79; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si12647628edu.367.2022.02.01.12.01.48; Tue, 01 Feb 2022 12:02:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pyLQsk79; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359108AbiAaLOi (ORCPT + 99 others); Mon, 31 Jan 2022 06:14:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:40292 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359543AbiAaLFz (ORCPT ); Mon, 31 Jan 2022 06:05:55 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F3A160ECF; Mon, 31 Jan 2022 11:05:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58129C340E8; Mon, 31 Jan 2022 11:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627154; bh=qlYEMax3/uk+lIMXDR6HWYREniDkhu3SiEJfvPNDbaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pyLQsk79Z5vtfWl8PP7CbSgvphyHHcUTr4QxMJB3HsY0yk6rSHaLS5tQ7tdAtYoy5 xB7LqDqwkL989CYRflcUSv4okxxI9X6N1WaDe1Mr4ICgR+3XMIHqG+jdj2/OIWjIPH WaCm7oDTWUtn3Txsd3lpieF/5dd2W7SV5sJz6jX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 091/100] Revert "ipv6: Honor all IPv6 PIO Valid Lifetime values" Date: Mon, 31 Jan 2022 11:56:52 +0100 Message-Id: <20220131105223.513846641@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guillaume Nault [ Upstream commit 36268983e90316b37000a005642af42234dabb36 ] This reverts commit b75326c201242de9495ff98e5d5cff41d7fc0d9d. This commit breaks Linux compatibility with USGv6 tests. The RFC this commit was based on is actually an expired draft: no published RFC currently allows the new behaviour it introduced. Without full IETF endorsement, the flash renumbering scenario this patch was supposed to enable is never going to work, as other IPv6 equipements on the same LAN will keep the 2 hours limit. Fixes: b75326c20124 ("ipv6: Honor all IPv6 PIO Valid Lifetime values") Signed-off-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/addrconf.h | 2 ++ net/ipv6/addrconf.c | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 78ea3e332688f..e7ce719838b5e 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -6,6 +6,8 @@ #define RTR_SOLICITATION_INTERVAL (4*HZ) #define RTR_SOLICITATION_MAX_INTERVAL (3600*HZ) /* 1 hour */ +#define MIN_VALID_LIFETIME (2*3600) /* 2 hours */ + #define TEMP_VALID_LIFETIME (7*86400) #define TEMP_PREFERRED_LIFETIME (86400) #define REGEN_MAX_RETRY (3) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 29526937077b3..4dde49e628fab 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2577,7 +2577,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev, __u32 valid_lft, u32 prefered_lft) { struct inet6_ifaddr *ifp = ipv6_get_ifaddr(net, addr, dev, 1); - int create = 0; + int create = 0, update_lft = 0; if (!ifp && valid_lft) { int max_addresses = in6_dev->cnf.max_addresses; @@ -2621,19 +2621,32 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev, unsigned long now; u32 stored_lft; - /* Update lifetime (RFC4862 5.5.3 e) - * We deviate from RFC4862 by honoring all Valid Lifetimes to - * improve the reaction of SLAAC to renumbering events - * (draft-gont-6man-slaac-renum-06, Section 4.2) - */ + /* update lifetime (RFC2462 5.5.3 e) */ spin_lock_bh(&ifp->lock); now = jiffies; if (ifp->valid_lft > (now - ifp->tstamp) / HZ) stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; else stored_lft = 0; - if (!create && stored_lft) { + const u32 minimum_lft = min_t(u32, + stored_lft, MIN_VALID_LIFETIME); + valid_lft = max(valid_lft, minimum_lft); + + /* RFC4862 Section 5.5.3e: + * "Note that the preferred lifetime of the + * corresponding address is always reset to + * the Preferred Lifetime in the received + * Prefix Information option, regardless of + * whether the valid lifetime is also reset or + * ignored." + * + * So we should always update prefered_lft here. + */ + update_lft = 1; + } + + if (update_lft) { ifp->valid_lft = valid_lft; ifp->prefered_lft = prefered_lft; ifp->tstamp = now; -- 2.34.1