Re: [PATCH net-next v4] ip6_gre: fix changelink conflict checks for L2 tunnels
From: Ido Schimmel
Date: Sun Nov 22 2026 - 07:36:16 EST
On Tue, Nov 17, 2026 at 06:16:09PM +0800, Xia Yan wrote:
> ip6gre_changelink_common() calls ip6gre_tunnel_locate(), which only looks
> for ARPHRD_IP6GRE devices. This lets an ip6gretap or ip6erspan update
> create a duplicate L2 tunnel, or rejects a valid update because an
> unrelated L3 tunnel has the requested parameters. A duplicate can receive
> traffic intended for the original tunnel.
>
> When the addresses, input key or link change, check for a conflict using
> dev->type, including updates to metadata devices.
>
> A metadata device can be created with the same receive parameters as an
> existing ordinary device. Allow updates that leave those parameters
> unchanged, and keep the hash entry in place. Otherwise a TTL update can
> either fail because another entry matches first, or move the updated
> device to the head and change which device receives packets. Do this for
> both GRE and ERSPAN changelink.
>
> Check conflicts and unregistering before applying encapsulation
> parameters. Leave the shared find helper, newlink, legacy ioctls and
> receive lookup unchanged.
>
> Found during code review of the newlink and changelink duplicate checks.
> Reproduced under UML with an IPv6 underlay named under:
>
> 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. With the fix, it fails with EEXIST and tap2 is unchanged.
> Custom UML tests covered conflicting and valid updates, metadata
> overlaps, and receive interfaces for GRE, GRE TAP and ERSPAN. TTL,
> fwmark and output-key updates kept the same receive interface. Kernel
> selftests were not run.
>
> Signed-off-by: Xia Yan <yanxia@xxxxxxxxxxxxxxxxxxxx>
> ---
>
> Notes (ip6gre-v4-mail):
> Changes in v4:
> - Check changed receive parameters for metadata devices too.
> - Skip the duplicate lookup when receive parameters are unchanged.
> - Keep unchanged receive parameters in place in the hash table for both
> GRE and ERSPAN, so an update does not change receive priority.
> - Rebase onto current net-next; keep the shared find helper unchanged.
>
> v3: https://lore.kernel.org/netdev/179455350258.84965.17518172977020586093.ip6gre-v3@xxxxxxxxxxxxxxxxxxxx/
> Review: https://lore.kernel.org/netdev/179489968486.3136.18372818760197436344@xxxxxxxxxx/
>
> Tested on net-next 6ff4c5942a301675eb12e5b49d53a81e604624a1 with
> W=1 UML builds. The main checks passed 194/194 assertions; eight
> additional cases passed 92/92. Packet checks verified the receive
> interface and payload before and after updates.
>
> net/ipv6/ip6_gre.c | 64 +++++++++++++++++++++++++++++-----------------
> 1 file changed, 40 insertions(+), 24 deletions(-)
No.
The patch is trying to "fix" an extremely uninteresting "problem" that
was most likely flagged by LLM. No report from a single user in over 14
years. I was OK with v1 because it made IPv6 consistent with IPv4 and
was small:
1 file changed, 1 insertion(+), 1 deletion(-)
Then, it grew and grew for the sole reason of pleasing some LLM that
flagged even less interesting "problems" that IPv4 already "suffers"
from.
Two options:
1. Go back to v1.
2. Don't apply anything.