🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20427

[PATCH net-next v5] ip6_gre: fix changelink conflict checks for L2 tunnels

#20427
From: Xia Yan
Date: Sun, 22 Nov 2026 13:42
69 lines
11297 bytes
ip6gre_changelink_common() calls ip6gre_tunnel_locate(), which only
looks for ARPHRD_IP6GRE devices. The same helper also handles ip6gretap
and ip6erspan devices.

An L2 tunnel can therefore change its parameters to match another L2
tunnel, and incoming packets can be delivered to the wrong interface.
An L3 tunnel with matching parameters can also make a valid L2 update
fail with EEXIST.

Use ip6gre_tunnel_find() with dev->type, as the newlink paths do. This
also matches the device-type check in IPv4 ip_tunnel_changelink().

Found while comparing the duplicate checks in newlink and changelink.
Reproduced under UML using existing netlink interfaces, without kernel
instrumentation or fault injection. With an IPv6 underlay named under
already configured:

  ip link add tap1 type ip6gretap local fd26:106::1 \
      remote fd26:106::2 key 100 dev under
  ip link add tap2 type ip6gretap local fd26:106::1 \
      remote fd26:106::2 key 200 dev under
  ip link set tap1 up
  ip link set tap2 up
  ip link set tap2 type ip6gretap key 100

Before the fix, the last command succeeds and received frames move from
tap1 to tap2. After the fix, it fails with EEXIST and tap2 is unchanged.

Tested on net-next under UML with W=1 builds before and after the change.
Standalone tests covered duplicate and valid updates for ip6gretap and
ip6erspan, including receive-interface and payload checks, plus an L3 GRE
control. Kernel selftests were not run.

Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
---

Notes (ip6gre-v5-mail):
    Changes in v5:
    - Return to the minimal one-line v1 change, as requested by Ido Schimmel.
    - Rebase onto current net-next.
    
    v4: https://lore.kernel.org/netdev/179491056935.741041.1816208847037703396.ip6gre-v4@cmss.chinamobile.com/
    Review: https://lore.kernel.org/netdev/20261122123555.GA2812544@shredder/
    
    Current UML build and runtime baseline: eb6d6c80d35449c27471b1874f13066c09a8964d.
    The v1 x86_64 W=1 allmodconfig- and allyesconfig-derived full builds used
    net 7076f684d513. Those full builds were not repeated for this rebase.

 net/ipv6/ip6_gre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 26c0e1c4de18f8b44ceb05d01673aaadfbcbd5ef..9f1e58f9326afd27d097431ffe62efb0aaaaf58a 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -2064,7 +2064,7 @@ ip6gre_changelink_common(struct net_device *dev, struct nlattr *tb[],
 
 	ip6gre_netlink_parms(data, p_p);
 
-	t = ip6gre_tunnel_locate(net, p_p, 0);
+	t = ip6gre_tunnel_find(net, p_p, dev->type);
 
 	if (t) {
 		if (t->dev != dev)

base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d
-- 
2.43.0
Technical Details
Message-ID: <179535496489.1244648.10031965997557933761.ip6gre-v5@cmss.chinamobile.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368696-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368696-linux-kernel-netdev=dewy.ru
From: yanxia@cmss.chinamobile.com (Xia Yan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v5] ip6_gre: fix changelink conflict checks for L2 tunnels
Date: Sun, 22 Nov 2026 21:42:44 +0800
Organization: Usenet Network
Message-ID: <179535496489.1244648.10031965997557933761.ip6gre-v5@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3644899"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:5byM1YRpknHWrVMypTfnv0buPfw= sha256:oldEIL9eakxKS/rxb862P0DcN6qaaw/954RGpExggv8=
	sha1:s3HQ7by+Dw/ocUSWDIh0Zpv5Bds= sha256:L6xGvQoxkO3Th2Jr0CvYzwz5xyg5VOApYZh0aMs6bsc=
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 7AC82125D6E; Sun, 22 Nov 2026 16:44:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.75
X-Spam-Status: No, score=-2.75 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key)
	reason="fail (body has been altered)" header.d=cmss.chinamobile.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 1_r0IgECho7v;
	Sun, 22 Nov 2026 16:44:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-368696-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cmss.chinamobile.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 10394125D78; Sun, 22 Nov 2026 16:43:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 2DF6126B03; Sun, 22 Nov 2026 13:43:51 +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=1795355030;
	b=qD3E4Or999yW9Mjb19rFp6rE31ndkZjHtMFEcAi6wwHiThWfY38BRIheeZwd2Cz22trn
	 QFDx353HjH6RW8M862mSPdlP7HX7JfqcGPOHdYZBw2n/qR1RxSZ7snyWsPOOFAjZRGa3i
	 5srUQbcbTBbHOKD10HBrALopK9ibvpGnE1a29ZwgvipSheuIXAhda0m9iVIt4li1kJDKt
	 4n2iTzd0GlA4dghgWWaY8TiqPuxkMO6K3OzVu9UMeL5et0eOTD9ie+k0Naqz6A2P4ItPd
	 wBP03yvQoEpqvw3sPMlhlLsv6Smce+2wxB5kn/1vb+HQt/340/FdCPNY7BRqsKb9xNw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795355030;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:X-RM-TagInfo:
	 X-RM-SPAM-FLAG:Received:X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:
	 Received:X-RM-TRANSID:From:To:Cc:Subject:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding:Date:
	 Message-ID;
	bh=YzFMYrIE2jIubdYzcRDkTvT/AcT2d82nJZex8ivmvyY=;
	b=n2jWgVgxI7aHULwF3YTHfrWvCFVAZUnQOg1flVFQ0cWcxfz6xQsRYZt1JL7RIoU/NSBO
	 pr7NAHH3pVuUWskeAYNLZ5Ci3MpWlkaqIsc3dyZooOkQqC+jDFcBIlGPJMuph2DYaR7zP
	 IaO5GXnT9qnsPBUJTydYW9iyIJfITt7dAHEWyHwdF4JpagQ++Yv3J4DlkNsvHN518wUsa
	 XWs+896g8TEJCKm8HCNjxqbCgsIU895B28iToZ+K/VFjlK8v5o4NAORyenXWRhc82jtEo
	 AJL64v2n9q7lOEiN5M4fbmzuz5nYE7ykH5nZd9SYDISRQe+fdvs6NH83clYZ5jv/Upw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=ge3dGHYI;
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.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 6029F606A334;
	Sun, 22 Nov 2026 13:43:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=ge3dGHYI
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.151
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795355024;
	b=yeMisynEol9MakHxAWL+hOwNZ+akl0rtKAXkykqG2omVfmsN8IjJI1YW3s+CpqGMCfey
	 jsATBYDpW+ejrLEjJrKXaoi58s1pv0xHZPrSh1RMdAeyoQGRoUaNEy/G2TUx47Gju64Av
	 Fm/ejObZx6VyVZMW0dDRSMdZnOqBQwYw405hf2IRWr/t0nQtHekqLJH7puXYnAr1q1RWv
	 PSm3ADQMH85gXmrwIspiHZ0+t44ZVIi7PvWP4Z/trDN0EJzjRn5L/IorttV7WbbsNme9E
	 PGoW8gtUQZ31IyVyifWKhf5IO1+XTaWYlGWn2ezwe3+Y5bw3zoam8kiSczM+K9r+Omw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795355024;
	h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:
	 X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From:
	 To:Cc:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:
	 Date:Message-ID;
	bh=YzFMYrIE2jIubdYzcRDkTvT/AcT2d82nJZex8ivmvyY=;
	b=UK+i8dvZvLSosAZEPRt9Ekis4uHWnVtaG1AAt2bfYG8hp8GumjpEr+DQmas9LnVG/HHf
	 Z6jG0MsxVJbP6XrYxfWFeILquGbe4glOQBEPPgYiWEMxS4Oj6pCVXQ80r7JWJH1paaN9S
	 GGUG/8xH/eDb0EdbdMtTFZZcEc3J29UvQE/D7J5lEM5+Ge1fcbOnNZtYba2Atcw6b5dNW
	 P9f0uRmVbhyIQgGj018wmwa/YhJS4boynP5M8JARsjrLBjeED8vkyVOPLQTeGRCZEmyjZ
	 PCAwerP45gKeTC8m/rssda1XEP+LuGrnFrTj9PNQi8dwnAZDW1lMF+z2QcghV6G6Idw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.com;
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=ge3dGHYI;
	arc=none smtp.remote-ip=111.22.67.151
X-Received: from cmccmta8.chinamobile.com (cmccmta8.chinamobile.com [111.22.67.151])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A0DEA606A320;
	Sun, 22 Nov 2026 13:43:41 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A0DEA606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=cmss.chinamobile.com; s=default; l=0;
	h=from:subject:message-id:to:cc:mime-version;
	bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
	b=ge3dGHYIL7GODUvLT9luAKJ587yLQdeya4u3ZB1/G/iwmb7fI2iMyqe2OP0kjOgtIeNU5fVB1HtwW
	 J+muNX5Hf9fPYtl0VTtObva+uE96ZPO7DxAi6I/ow3D8/fEKV3M/rISL8cG2HGOx6tZoZh+XWknNae
	 gOVfIl74mx0zTcaY=
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from spf.mail.chinamobile.com (unknown[10.188.0.87])
	by rmmx-syy-dmz-app06-12006 (RichMail) with SMTP id 2ee66b02f183258-00647;
	Sun, 22 Nov 2026 21:43:31 +0800 (CST)
X-RM-TRANSID: 2ee66b02f183258-00647
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from [198.18.0.139] (unknown[112.23.105.246])
	by rmsmtp-syy-appsvr09-12009 (RichMail) with SMTP id 2ee96b02f182818-70171;
	Sun, 22 Nov 2026 21:43:31 +0800 (CST)
X-RM-TRANSID: 2ee96b02f182818-70171
X-Cc: dsahern@kernel.org,
    idosch@nvidia.com,
    davem@davemloft.net,
    edumazet@kernel.org,
    kuba@kernel.org,
    pabeni@redhat.com,
    horms@kernel.org,
    linux-kernel@vger.kernel.org,
    kuniyu@google.com,
    xeb@mail.ru,
    yana06070@163.com,
    netdev-bot+sashiko@kernel.org
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