Re: [PATCH net-next v5] ip6_gre: fix changelink conflict checks for L2 tunnels
From: Ido Schimmel
Date: Sun Nov 22 2026 - 10:13:01 EST
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@xxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>