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 9D8E03ECBDB; Mon, 9 Mar 2026 18:46:04 +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=1773081966; cv=none; b=W4ePRf8Gce6wwjZwKdcv34bQJ3S2QDUC4HbsHP581axnAUQLsKXTIEtZJX8NNXFWr6dxLdYhG82EDJSXQzHNUD0Y6K4dkmRX9Lg1lPQQY3BJN2uL3wfWZu6Dvlafc7lW7UcT+K6scBPRBZuxl7YNAdastjgZiXc6rJKnMCyRZo4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773081966; c=relaxed/simple; bh=sxeQg8+NE/ufRdVb0861fCWmQjZNv0Qv342VnCJQQJs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pynDTPpwtnsFocja4EtIDsvuf7khkxnihVcRkRZodB4g9XsBM6HK+6EtlTgrM9oyawltmHAilxSBXlelwBRfOBCStMKPHKMFfq9A2ez3pNvz3llMX1pgjSf3YfR202XSsbE0zbZsFo/B/gKlRv+2h/2OfzIZUQhmD6b1qLeNCYU= 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=itHd3K9w; 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="itHd3K9w" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 34B2B206DF; Mon, 9 Mar 2026 19:46:03 +0100 (CET) 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 eGDm6kFc1NSn; Mon, 9 Mar 2026 19:46:02 +0100 (CET) Received: from EXCH-02.secunet.de (rl2.secunet.de [10.32.0.232]) (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 8F5D2206D2; Mon, 9 Mar 2026 19:46:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 8F5D2206D2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1773081962; bh=F0PvYQNl3yelCJNhQVUrT+aQKrKuOELezHyH5Uoo7AQ=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=itHd3K9wJ73Rn5BWi5i8JdnYFf1NBKCoDLWItb7LFVNfAP+6kyHvi2ti3+YhbUQmd twem1/NxDBqiQ95OijxBgGQQgGqpj+cBeRufa5Na40tnXAU9WgDj+ZLoFzWlfZ8Oop jMjty6gTu5sQ0Km1nXuYSshx4/DOw5KYthboZI6OCdo4dCutbjXacz55SCRmpCPKBP JkrwVf98qtwMGGV54qy5qdQfoRvkwDoSKcUxckQ+TzV2a0jFxXM1Rxi0u+WLXQ1ZDv 2NLvAWdgSUqWDKqRYLgtgcnMfaNu8cIlpgnJ3m9/GotUWq7uzyPf22ALIH5091N6Hw bJoA2drzOJeJQ== Received: from moon.secunet.de (172.18.149.1) by EXCH-02.secunet.de (10.32.0.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Mon, 9 Mar 2026 19:46:01 +0100 From: Antony Antony To: Antony Antony , Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , David Ahern , Masahide NAKAMURA , Paul Moore , Stephen Smalley , Ondrej Mosnacek , Jonathan Corbet , Shuah Khan CC: , , , , Chiachang Wang , Yan Yan , Subject: [PATCH ipsec-next v6 04/14] xfrm: fix NAT-related field inheritance in SA migration Date: Mon, 9 Mar 2026 19:45:51 +0100 Message-ID: X-Mailer: git-send-email 2.39.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.14.2 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-02.secunet.de (10.32.0.172) 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. Signed-off-by: Antony Antony --- v5->v6: added this patch --- 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 20ebd10dbee5cf0ee29c81c9cc3839fb031597c2..defa753b26ae09f4ed66b8e240e8081c28b16e63 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.47.3