From: Ido Schimmel <idosch@nvidia.com>
To: netdev-bot+sashiko@kernel.org
Cc: yanxia@cmss.chinamobile.com, netdev@vger.kernel.org,
dsahern@kernel.org, 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
Subject: Re: [PATCH net-next v5] ip6_gre: fix changelink conflict checks for L2 tunnels
Date: Mon, 23 Nov 2026 20:26:38 +0200 [thread overview]
Message-ID: <20261123182638.GA3579507@shredder> (raw)
In-Reply-To: <179544145061.3135.15862505318599577492@kernel.org>
On Mon, Nov 23, 2026 at 01:44:10PM +0000, netdev-bot+sashiko@kernel.org wrote:
> [Severity: Medium]
> The commit message says this matches the newlink paths. However, the
> newlink paths skip ip6gre_tunnel_find() for collect_md tunnels:
>
> net/ipv6/ip6_gre.c:ip6gre_newlink() {
> ...
> if (nt->parms.collect_md) {
> if (rtnl_dereference(ign->collect_md_tun))
> err = -EEXIST;
> } else {
> if (ip6gre_tunnel_find(net, &nt->parms, dev->type))
> err = -EEXIST;
> }
> ...
> }
>
> ip6erspan_newlink() does the same, using ign->collect_md_tun_erspan.
>
> ip6gre_tunnel_link() still puts collect_md tunnels in the normal hash
> buckets. So two ARPHRD_ETHER devices with the same wildcard parameters
> (laddr = raddr = ::, i_key = 0, link = 0) can land in one bucket. Two
> examples are an ip6gretap external device next to an ip6erspan external
> device, or a plain wildcard ip6gretap created before an ip6gretap
> external.
>
> Can this lookup now return the other device and reject a valid update
> with -EEXIST? For example:
>
> ip link add gt type ip6gretap external
> ip link add es type ip6erspan external
> ip link set gt type ip6gretap external ttl 64
>
> hlist_add_head_rcu() puts es at the head of the bucket, so
> ip6gre_tunnel_find(net, p_p, ARPHRD_ETHER) returns es. Because
> es->dev != gt, ip6gre_changelink_common() returns -EEXIST.
>
> Before this patch the lookup used ARPHRD_IP6GRE. It matched neither
> device, so the update succeeded.
No:
# uname -a
Linux virtme-ng 7.4.0-rc3-virtme-g57f165ff2f30 #103 SMP PREEMPT_DYNAMIC 0 x86_64 GNU/Linux
# ip link add gt type ip6gretap external
# ip link add es type ip6erspan external
# ip link set gt type ip6gretap external ttl 64
RTNETLINK answers: File exists
It failed even before the patch since the lookup resolved the fallback
tunnel (ip6gre0).
Regardless, unclear what's the use case for configuring two such
external devices in a single netns. By the amount of reviews that these
drivers are getting (unless the patch is simple of course), I guess
nobody has such a setup.
prev parent reply other threads:[~2026-11-23 18:26 UTC|newest]
Thread overview: 5+ 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
2026-11-23 13:44 ` netdev-bot+sashiko
2026-11-23 18:26 ` Ido Schimmel [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=20261123182638.GA3579507@shredder \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--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®