🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9519

[PATCH 13/14] docs: xfrm: include mark in XFRM_MSG_MIGRATE_STATE EEXIST tuple

#9519
From: Steffen Klassert
Date: Mon, 02 Nov 2026 10:04
70 lines
12520 bytes
From: Antony Antony <antony.antony@secunet.com>

Document mark as part of the EEXIST tuple and update the SA lookup
description to match.

Fixes: c13c0cc6f52e ("xfrm: add documentation for XFRM_MSG_MIGRATE_STATE")
Signed-off-by: Antony Antony <antony.antony@secunet.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 .../networking/xfrm/xfrm_migrate_state.rst    | 25 +++++++++++++------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/Documentation/networking/xfrm/xfrm_migrate_state.rst b/Documentation/networking/xfrm/xfrm_migrate_state.rst
index 9d53cb22b007..ca2c9e5aaf33 100644
--- a/Documentation/networking/xfrm/xfrm_migrate_state.rst
+++ b/Documentation/networking/xfrm/xfrm_migrate_state.rst
@@ -27,15 +27,20 @@ SA Identification
 =================
 
 The struct is defined in ``include/uapi/linux/xfrm.h``. The SA is looked
-up using ``xfrm_state_lookup()`` with ``id.spi``,
-``id.daddr``, ``id.proto``, ``id.family``, and
-``old_mark.v & old_mark.m`` as the mark key::
+up using ``xfrm_state_lookup_exact()`` with ``id.spi``, ``id.daddr``,
+``id.proto``, ``id.family``, and an exact match against ``old_mark.v``
+and ``old_mark.m``. Unlike the data path, which uses a masked
+comparison, this requires the SA's mark and mask to equal ``old_mark``
+exactly, so a broad-mask SA is never matched when a more specific one
+was intended. If no such SA exists, ``-ESRCH`` is returned.
+
+The layout is::
 
     struct xfrm_user_migrate_state {
         struct xfrm_usersa_id  id;       /* spi, daddr, proto, family */
         xfrm_address_t         new_daddr;
         xfrm_address_t         new_saddr;
-        struct xfrm_mark       old_mark; /* SA lookup: key = v & m */
+        struct xfrm_mark       old_mark; /* SA lookup key (exact v/m match) */
         struct xfrm_selector   new_sel;  /* new selector (see Flags) */
         __u32                  new_reqid;
         __u32                  flags;    /* XFRM_MIGRATE_STATE_* */
@@ -72,8 +77,8 @@ inherits the value from the existing SA (omit-to-inherit).
      - Description
    * - ``XFRMA_MARK``
      - Mark on the migrated SA (``struct xfrm_mark``). Absent inherits
-       ``old_mark``. To use no mark on the new SA, send ``XFRMA_MARK``
-       with ``{0, 0}``.
+       the mark of the existing SA. To use no mark on the new SA, send
+       ``XFRMA_MARK`` with ``{0, 0}``.
    * - ``XFRMA_ENCAP``
      - UDP encapsulation template; only ``UDP_ENCAP_ESPINUDP`` is supported.
        Set ``encap_type=0`` to remove encap.
@@ -259,8 +264,12 @@ Attributes in the notification
 Error Handling
 ==============
 
-If the target SA tuple (new daddr, SPI, proto, new family) is already
-occupied, the operation returns ``-EEXIST`` before the migration begins.
+If the target SA tuple (new daddr, SPI, proto, new family, mark) is
+already occupied, the operation returns ``-EEXIST`` before the migration
+begins. "Occupied" includes wildcard shadowing: an existing SA with a
+broader mask (e.g. mark 0/0) claims every mark value, so it blocks
+migrating to any more specific mark at the same tuple, not just an
+exact mark/mask duplicate.
 The old SA remains intact and the operation is safe to retry after
 resolving the conflict.
 
-- 
2.53.0
Technical Details
Message-ID: <20261102100451.2505200-14-steffen.klassert@secunet.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354518-linux-kernel-netdev=dewy.ru
References: <20261102100451.2505200-1-steffen.klassert@secunet.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354518-linux-kernel-netdev=dewy.ru
From: steffen.klassert@secunet.com (Steffen Klassert)
Newsgroups: linux.kernel.netdev
Subject: [PATCH 13/14] docs: xfrm: include mark in XFRM_MSG_MIGRATE_STATE EEXIST tuple
Date: Mon, 2 Nov 2026 10:04:11 +0000
Organization: Usenet Network
Message-ID: <20261102100451.2505200-14-steffen.klassert@secunet.com>
References: <20261102100451.2505200-1-steffen.klassert@secunet.com>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2877815"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:glJ2ayhPujKoRLKGD/lsKYtjvyY= sha256:E54ceJ3cZzhPEhOF70jR79cg4/Yu/0a5IdmslbBHKMM=
	sha1:GTmzhPd6DqsmWR3PbyAQN1QVR/4= sha256:xIDgVNr2nKGaTecsXD2Uw09mdfw/Cmg7mFgNVg/yF5Q=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 97578112459; Mon,  2 Nov 2026 11:08:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=secunet.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id WchZV0Wj2ieE;
	Mon,  2 Nov 2026 11:07:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354518-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=secunet.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A789B11243B; Mon,  2 Nov 2026 11:07:50 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 2FCC82DCA3; Mon,  2 Nov 2026 08:05:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793606692;
	b=O4sNQZ5HVmTYylYLf/WTcXn5Pk7CwfQ5JsGT42Vbc4kftESBBOuunwzU8dLQ3F4+3IsD
	 7s5xYZ1ZWA2AzXKog7RNqUuXtgexfRJc+82/I7LumNnT0/nzRVUXN1nfE4NDni8V8y/cs
	 SDpFCw+m6/yM699OHYiL7Zj72PWzp4IBvVoMSXeZYzx9X0EkX06TIYEuJ/2KUpJ7T0W2m
	 I4T0bsq7IWhCDID1Px4m7pRff+uI6TIsxM9WAy/iN0T9UBMiC6Po/9FdtiS7h6lGVEg95
	 FUnj+oq1SIwD6Cmw7GcsNLErWHYvXrVcyA5KM0pB6LFHCE5bHxVeM53yzycb91oh0Ug==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793606692;
	h=X-Original-To:Received:DMARC-Filter:Received:X-Virus-Scanned:
	 Received:Received:DKIM-Filter:DKIM-Signature:Received:Received:From:
	 To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy;
	bh=Bhm5K5pgZZqGM+JSJ1uY6OfgTehxKhHFC60i5E2xYII=;
	b=wy8BBC6XhjLuxdoiFwiN0FploIc/XD3FSYAmbuWsdJJkFVeKp5mL46+SGeoYlIjEe89c
	 ttZnOY9gFPostBpOXQxitAz278H7GcE2FpD7bhp66paV/Wv4Rb4yLfYOYhiHwEc3xBw2e
	 E0vQODcRsoDzyNiL168OK0vsj49+o1qZq4EvHaOgX9IwEiYdSqkPqeKWtppqrI53hlz+A
	 Lk5H2T/qE/qlxyq54Tjv2c60eKOra1SJQOcxRaPGJUmLs1nM/ytVA6Kj071gMm/7JlJ8J
	 Q/4TQe1rO2a/UqM/5NS3miySMVq8fB2e1Rxbaa9dUyqbUWJqcXN6uE4KnRsxF0qsmyA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=gCtQtDBL;
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id D354A606A339;
	Mon,  2 Nov 2026 08:04:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=gCtQtDBL
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793606692;
	b=3cuCql03fAfwaKAx1MmA1bEoA3nokf5h4UsQ4vUdnciMiygY0f+wKsiChFd/XnXM7QnT
	 dniGlZpSpmFAEPQRaw9asRRwJp0X40u/QhFdzhJSmdGIjqvXuqSfQXnEObFYdLEL3s9nl
	 VPGlmZg3hbMqP5hLa5y+/JXw40ojXtutqtArjNEWAcTHbqm0v++/7J3fX9XCQdEJ3Wkoj
	 Wy3JziyXOPsVrzbtNoD1nGShb6riFyAPs/LnnjnTUylKzKHCuHDlNMT+tl5E1HKQfeO/q
	 n7VigVFyEbynoRdHy3B3Q22T+mAsbjEmE/paQ3toB1UyHhc3PVkhVKgsb2S/ggg7luA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793606692;
	h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter:
	 DKIM-Signature:Received:Received:From:To:CC:Subject:Date:Message-ID:
	 X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy;
	bh=Bhm5K5pgZZqGM+JSJ1uY6OfgTehxKhHFC60i5E2xYII=;
	b=qws+b1c0+1dLWHEtMdFSGfzF0LdVy6dE4UeMIeMuHZfwdE4ziVzHoiEmj6OZwJF+sKfd
	 UzBBuOC5p1kJfoLRDTlFlINgUHpdQNrmFA44DNtZ9oL69NdNAnNx5o7VwalcCrISLWoc1
	 h8h4OE84VE4ViUm/lgcsy1Tk7StbTmWONR2brcejDvZGnNe9ZM7TlzYpKapyUa4Ee/Qwy
	 I50eDK4WppwSBVV61atwyNMf+2HNvikJDJHoDhn0mKHfRIykJr9XvSSZpZMV1yNnZwobb
	 E6znnOePlqJgzq9qF4Qs/yj1tqpK94sauo3Vteatr2xI2znilM9Ce0L8jpyhpmvr7wA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.com;
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=gCtQtDBL;
	arc=none smtp.remote-ip=62.96.220.36
X-Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CDDE60A2611
	for <netdev@vger.kernel.org>; Mon,  2 Nov 2026 08:04:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3CDDE60A2611
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com
X-Received: from localhost (localhost [127.0.0.1])
	by mx1.secunet.com (Postfix) with ESMTP id 68AAA207BB;
	Mon,  2 Nov 2026 09:04:44 +0100 (CET)
X-Virus-Scanned: by secunet
X-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 rLl6jszmYsnY; Mon,  2 Nov 2026 09:04:43 +0100 (CET)
X-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 BA2B1207B0;
	Mon,  2 Nov 2026 09:04:43 +0100 (CET)
X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com BA2B1207B0
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com;
	s=202301; t=1793606683;
	bh=Bhm5K5pgZZqGM+JSJ1uY6OfgTehxKhHFC60i5E2xYII=;
	h=From:To:CC:Subject:Date:In-Reply-To:References:From;
	b=gCtQtDBL1Iyvx1gTPo/WDYYoIntuP079LxBFwJt+0TBNqiqvWt4f7fTKjEHcaLD2m
	 lM8TzI2cKoEaNZCxRBFT2pr1UmeIu117DptlZWSJVD3LpMvqgjXv4ivytBYhSBH7Yg
	 GWPoSuEK0mUIm9mUdkvI/U0LH/RmWQ43DG6JXbJtdUwU40UYmJ9fXJzy+oXkWVl45o
	 n33sqqg6XmJJFy52VbRfbNrT9L7YKE9buTYK/Trm9xAU4bcPY9Qx6FBetgFIhppIsI
	 gXOAf2FN9DfJpKyIvmq3eXIeLM0yZBaFmOfPLznK2nwiDrqxN+WbQO3rq4cK799c05
	 OryHkUj7U57RQ==
X-Received: from gauss4 (10.182.7.102) 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.49; Mon, 2 Nov
 2026 09:04:42 +0100
X-Received: (nullmailer pid 2505927 invoked by uid 1000);
	Mon, 02 Nov 2026 10:04:58 -0000
X-CC: Herbert Xu <herbert@gondor.apana.org.au>, Steffen Klassert
	<steffen.klassert@secunet.com>, <netdev@vger.kernel.org>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261102100451.2505200-1-steffen.klassert@secunet.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-ClientProxiedBy: EXCH-04.secunet.de (10.32.0.184) To EXCH-01.secunet.de
 (10.32.0.171)