From: Hangbin Liu <hangbin.liu@linux.dev>
To: Xia Yan <yanxia@cmss.chinamobile.com>
Cc: netdev@vger.kernel.org, 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
Subject: Re: [PATCH net-next v5] ip6_gre: fix changelink conflict checks for L2 tunnels
Date: Mon, 23 Nov 2026 13:07:25 +0800 [thread overview]
Message-ID: <20261123050725.GF10218@Liu-laptop> (raw)
In-Reply-To: <179535496489.1244648.10031965997557933761.ip6gre-v5@cmss.chinamobile.com>
On Sun, Nov 22, 2026 at 09:42:44PM +0800, Xia Yan wrote:
> 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
>
>
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
prev parent reply other threads:[~2026-11-23 5:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 13:42 Xia Yan
2026-11-22 15:12 ` Ido Schimmel
2026-11-23 5:07 ` Hangbin Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123050725.GF10218@Liu-laptop \
--to=hangbin.liu@linux.dev \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xeb@mail.ru \
--cc=yana06070@163.com \
--cc=yanxia@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®