From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCC763E1D0F for ; Fri, 12 Jun 2026 07:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781250503; cv=none; b=kPTIX9St8unXnigsbEACDI31PffHFdGbfLDbqbDqQQ84Hb61z6U80KO4gIzsncMpSKZKnmbLaXHhxrYzAs/ftNx/745EVEdLbFo7sIFoAMvTG8OzbG7u32woXMIfyS4xxbRzuSH2mTz8JsvBLHnDHxmA+qyncL9i12O1Nwvquqg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781250503; c=relaxed/simple; bh=7H9TCAXky61qmVxr0Ppi2KDSiia/G4Pan38e/nhqEFs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a+MPwTYSQRapBINwEfX3/09TUK2wyMJOrDIqIgDGBWTfMjQJp/2Wkttm5oeKNeL7lVxD1NCxngq7yJY9TYLfk3ab2PjyEz+Nvd+ZT7aD6twDflOJTLkAc6KbcO1zYhTGrPqQcbRjGr3YvsKRyF8pqN6ajyg6INcp2wvjg6+JiSw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=AousxnfB; arc=none smtp.client-ip=62.96.220.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="AousxnfB" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id A4196206E9; Fri, 12 Jun 2026 09:48:20 +0200 (CEST) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YTXENHbz-PUM; Fri, 12 Jun 2026 09:48:20 +0200 (CEST) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 138B3206D2; Fri, 12 Jun 2026 09:48:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 138B3206D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1781250500; bh=DBGrtCjZQz9ywDccDSil1OaIaCDFvCZd/Z9qoLYP6xA=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=AousxnfBre1dF34EFNC6k+W/rJxzyCakkyrfEQN+kTiKKYOe7VnNlDnFdUTNi6kcr MPXcQ2Cr4P7n/khil7ShB5Lk9/AJ8V8MM+3wDjmehLkZM6mA24g4goApMCXCZ7vk2T bFYCeuMSIW6V5cSl0KWyesVW36LL352MsH64P4wNxy17qiKmyLVhH6SfZ575yBMDFN GujNrfw334ks6mJ4ei9a4hb7rj6JhI+ulSZV1CYo3fTuFzA4MTH+l/V5TK9p5MZyLp a+OccuzamMjsmtqYmqUUu1TKLj/wq3iGDzcl6ZHq7LgT1NUvkXmFtQ5DpJg4GBHdtq fA1O4oPwgXG9Q== Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Fri, 12 Jun 2026 09:48:19 +0200 Received: (nullmailer pid 1768281 invoked by uid 1000); Fri, 12 Jun 2026 07:47:57 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 06/18] xfrm: fix NAT-related field inheritance in SA migration Date: Fri, 12 Jun 2026 09:46:22 +0200 Message-ID: <20260612074725.1760473-7-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260612074725.1760473-1-steffen.klassert@secunet.com> References: <20260612074725.1760473-1-steffen.klassert@secunet.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-04.secunet.de (10.32.0.184) To EXCH-01.secunet.de (10.32.0.171) From: Antony Antony During SA migration via xfrm_state_clone_and_setup(), nat_keepalive_interval was silently dropped and never copied to the new SA. mapping_maxage was unconditionally copied even when migrating to a non-encapsulated SA. Both fields are only meaningful when UDP encapsulation (NAT-T) is in use. Move mapping_maxage and add nat_keepalive_interval inside the existing if (encap) block, so both are inherited when migrating with encapsulation and correctly absent when migrating without it. Fixes: f531d13bdfe3 ("xfrm: support sending NAT keepalives in ESP in UDP states") Reviewed-by: Sabrina Dubroca Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert --- net/xfrm/xfrm_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 933541bc9093..b9de931d84c1 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -2012,6 +2012,8 @@ static struct xfrm_state *xfrm_state_clone_and_setup(struct xfrm_state *orig, x->encap = kmemdup(encap, sizeof(*x->encap), GFP_KERNEL); if (!x->encap) goto error; + x->mapping_maxage = orig->mapping_maxage; + x->nat_keepalive_interval = orig->nat_keepalive_interval; } if (orig->security) @@ -2046,7 +2048,6 @@ static struct xfrm_state *xfrm_state_clone_and_setup(struct xfrm_state *orig, x->km.seq = orig->km.seq; x->replay = orig->replay; x->preplay = orig->preplay; - x->mapping_maxage = orig->mapping_maxage; x->lastused = orig->lastused; x->new_mapping = 0; x->new_mapping_sport = 0; -- 2.43.0