From nobody Mon Apr 13 04:23:52 2026 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 B74692D7DDB; Sun, 12 Apr 2026 11:15:01 +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=1775992503; cv=none; b=p64DqCRgezXEeNwANuDJ/StU5vR5u2S7q5FNxDpRQgPiC99oH0aSIdqD4d98TOwhjFwQv8Zaubp2ldW1glhp7rTghqTS6MtkqiZH+egYKJ3DGp42M8bEyHZsFmOxLn8D5QkP29pKVVu5so92p8MKqB/nem+apqe5tajMxwlSn5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775992503; c=relaxed/simple; bh=MnUMFW3yB5md5HggxPzOjWXpUzTCNVW/fuYVKR5WfDw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hJQTwFEmWpalfKkh5HcsPBe4sL4eXBwo/C9W0kyY/vxqZDhqohDTH467l7Il10WMu+OZVeuu+h60ItUDye7zj6Os9N4sdx07pQ0S0B3yjKAEDb4HzvPzZz1XVyU8/F66ZMNZ2s7HnAMAIbHOza7oHn13CtrWKBcfW/o4yYCm5Co= 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=yV4abdau; 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="yV4abdau" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 631A520799; Sun, 12 Apr 2026 13:15:00 +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 3ZVjR0kdvRiM; Sun, 12 Apr 2026 13:14:59 +0200 (CEST) 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 BF2AE2076B; Sun, 12 Apr 2026 13:14:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com BF2AE2076B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1775992499; bh=snKdOjQS6j21vtxOxNOcIxRHL0pQr/pATSQ92wMXZjw=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=yV4abdaueU10CIBiZXnuqjJX1dBn0QED6y8H8ZiG6mMeoUhKdtw3D4tUQk5eBtoAc CXaCheSioR9BNKL3rJmpOkQJRMHnS7NTQq6G2FVW7wC0lcsOxLzTp+Aw34I/sWUjt6 Z2B8n4uUSX41NLopNgcYANTynoyF3amd92dzJRcUNWkuRlLc5HrZWI6C9tlKNFMsxV 41ApNP4At5XKZvTmL8skgZAAjp+8HV6LLlsosNtenwTwb71Lw7eQxjVHiDm9ohxvRL s2awTHtIOANq1pp3OyRutyuUbTP/sSB9sz6r3D4UWOme2injK/LZ7jFbvJV60vZRfz McCSiK1yY8AYg== 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; Sun, 12 Apr 2026 13:14:58 +0200 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 v7 04/14] xfrm: fix NAT-related field inheritance in SA migration Date: Sun, 12 Apr 2026 13:14:50 +0200 Message-ID: X-Mailer: git-send-email 2.39.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) 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 20ebd10dbee5..defa753b26ae 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 =3D kmemdup(encap, sizeof(*x->encap), GFP_KERNEL); if (!x->encap) goto error; + x->mapping_maxage =3D orig->mapping_maxage; + x->nat_keepalive_interval =3D orig->nat_keepalive_interval; } =20 if (orig->security) @@ -2046,7 +2048,6 @@ static struct xfrm_state *xfrm_state_clone_and_setup(= struct xfrm_state *orig, x->km.seq =3D orig->km.seq; x->replay =3D orig->replay; x->preplay =3D orig->preplay; - x->mapping_maxage =3D orig->mapping_maxage; x->lastused =3D orig->lastused; x->new_mapping =3D 0; x->new_mapping_sport =3D 0; --=20 2.47.3