Article View: linux.kernel.netdev
Article #17621Re: [PATCH net-next v4 4/4] bpf: drop the stale dst when redirecting to an explicit nexthop
From: "Alexei Starovoitov"
Date: Tue, 17 Nov 2026 04:50
Date: Tue, 17 Nov 2026 04:50
51 lines
13791 bytes
13791 bytes
On Mon, Nov 16, 2026 at 02:06 PM Jamal Hadi Salim <jhs@mojatatu.com> wrote:
> encap ip/ip6 or encap xfrm template the tunnel template lives in
> dst->lwtstate that wont work (packet reaches the tunnel or xfrm
> device with no encapsulation).
ok. agree.
> For that reason we cant drop 3 and 4. I see the change in 2/4 (I see
> 1/4 not changing either) . The change is not that small because it
> will have to touch multiple core files (although just small mechanical
> surgeries). Summary it will still be 4 patches..
can we keep the route and fix neigh_update_process_arp_queue() instead ?
The bug is its lookup via dst. Only teql needs that lookup, I think.
A is the device of the route, B is the target of the redirect:
skb is queued by skb->dev neigh->dev lookup via dst gives
---------------------- -------- ---------- --------------------
ip_finish_output2() A A the same neigh
bpf_redirect_neigh(nh) B B neigh on A, the bug
nft fwd B B neigh on A, the bug
__teql_resolve() master slave neigh on master
The diff skips the lookup when skb->dev is neigh->dev.
lwtstate, NBMA tunnels, realm and ICMP errors work as today.
The fast path doesn't change. No need for patches 2, 3 and 4.
and 1/4 is not a prerequisite.
Your teql 3/3 queues the skb with skb->dev == slave. With this diff
the neigh of the slave adds the header and sends the skb.
thoughts?
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index d6e9c7c..04758ca 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1331,9 +1331,11 @@ static void neigh_update_process_arp_queue(struct neighbour *neigh)
* the packet in the output path. So what we need to do
* here is re-lookup the top-level neigh in the path so
* we can reinject the packet there.
+ * When skb->dev is neigh->dev 'neigh' is the top-level one.
+ * dst can be a route via another device after a redirect.
*/
n2 = NULL;
- if (dst &&
+ if (dst && skb->dev != neigh->dev &&
READ_ONCE(dst->obsolete) != DST_OBSOLETE_DEAD) {
n2 = dst_neigh_lookup_skb(dst, skb);
if (n2)
Technical Details
Message-ID:
<DMX7RM93TMGR.AXFN4YJ55REF@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364945-linux-kernel-netdev=dewy.ruReferences:
<CORE-9NOG.v4.r0.20261116135311@mojatatu.com> <CORE-9NOG.v4.r0.20261116135311-4@mojatatu.com> <DMWXH28YQDYH.1SI4Y5WQ7EPSR@gmail.com> <CAM0EoMk10vCoAKZq0P=8A_jed=Z3SudLEUV8uvXO5F=ewNjnGQ@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364945-linux-kernel-netdev=dewy.ru
From: alexei.starovoitov@gmail.com ("Alexei Starovoitov")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 4/4] bpf: drop the stale dst when
redirecting to an explicit nexthop
Date: Tue, 17 Nov 2026 04:50:26 +0000
Organization: Usenet Network
Message-ID: <DMX7RM93TMGR.AXFN4YJ55REF@gmail.com>
References: <CORE-9NOG.v4.r0.20261116135311@mojatatu.com> <CORE-9NOG.v4.r0.20261116135311-4@mojatatu.com> <DMWXH28YQDYH.1SI4Y5WQ7EPSR@gmail.com> <CAM0EoMk10vCoAKZq0P=8A_jed=Z3SudLEUV8uvXO5F=ewNjnGQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2242160"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gDN/gtI8yrlkx1tfW5dapQncums= sha256:X8VbINejRmKk0CtRZBM9byrbcDHSeqvaUN4G78lPnio=
sha1:XufWFkQ3rf+3tSA9EY+gZYMwef8= sha256:wUJMbwFp1YOBEizkr82Vq0LnxSCygvsQLyjrCayC3PQ=
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 10384114E46; Tue, 17 Nov 2026 07:50:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
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]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.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 JTsIjhECfcMn;
Tue, 17 Nov 2026 07:50:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-364945-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id C0144114977; Tue, 17 Nov 2026 07:50:37 +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 67DCA27327; Tue, 17 Nov 2026 04:50:32 +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=1794891029;
b=3BXfwDR7DSlhMgVMlCuR4/2vdr6JhhsGLl+mdrhqHa1hOWstrK6o/kCrZAHIJz1/a4xP
oiwz5kKPFzqe5YicJdhQOxi26S7Q3f1mTZw69JrmD/Iw93WmBkQ4En9diiqPD4W1bV6uj
aVKrTNyncI62b4kHnsz+g6huKVPjizAvdnLtU2JpDaixPoQAtUvExIjTjhI9SyKQHx2mz
pfD9GMIi+97EwVZj7Ja/bDHyiXUq0ReATpxGGYhBO0Slj/I8xS9g/RnOprTGi1OTA5suN
myI8LuNEwEo+mM53a70KnTAPFD6wx8Brr3b2NHzdBs5gXji4H+Mh/5P22QsybsETjag==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794891029;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:Content-Type:Date:Message-Id:Cc:Subject:From:To:In-Reply-To:
References:Content-Transfer-Encoding:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
MIME-Version;
bh=ZoSyoZQWdNOdSM4bWqLW3oD6P4gXP5jD57AsOWSPPmo=;
b=Wza9I2OE4iCPSn7/BNfwDmO2KXL9NM+tv4bqXOjP6kE50YgjJKKFaVJdWFiE7fkCsG0S
aqq6zlgqLY79C/JQWqxPxxFpkSWdyLpz7JT9FRSn1RM47u7LnZ/q9Q6PnSHJNvljXs9vn
8+yW8UTSarmFUBtfI7D8qehlW1ihEljGn7lNj2Nw2x+SZI1rv6YWt1VdgPEODtwZJJsKh
+x7YbOwbn/XzDffL4uLmyil243csOev1j+9G1t3HvBS19AZrghx6zG7xn6bpEE3CrT5zx
WtSLnYDtWlI4NCCZaW9n6tC5SOQYjhClC4uh2xlAqbCQswf9zW0oTUlIOawO8FV6tPg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ODDQP9xp;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.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 8C1D2606A32F;
Tue, 17 Nov 2026 04:50:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ODDQP9xp
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.51
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794891028;
b=CE5K2f3bbzzXajxFtAnEjlQjaU1KhCMGRo0WnF1/btz+ruO3kV32B76AVAnL0BLtbNTQ
OoaagJYEDi1xhfE4O6sypgGw7H3riYzWSUuJ14hjFMlPupaH1aB8S3HEikG8pXD01cf0w
L+5Tz4HuammqpJM9eSXLcrlChQdNcUPKdGsVVYA5yxF16ZX0FTe0QahLm/4l0QCyapaIV
sBVQYdZiBjZVDpYgPm9vjCzqZpOBCCCkeLBvvLs7pX5LbAGkMJ+3/9pTvYnXzGVSsJcXN
T4OYIgpZRR96JMeFUojxprHL3n36pVHQTqUiz3zv3ORmQmaqoUSbovmTI3MqzjhQyEw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794891028;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Content-Type:Date:
Message-Id:Cc:Subject:From:To:In-Reply-To:References:
Content-Transfer-Encoding:MIME-Version;
bh=ZoSyoZQWdNOdSM4bWqLW3oD6P4gXP5jD57AsOWSPPmo=;
b=hJVvnxEVQi1a2bK49nawN0EfoNwhjcjgtSnLtWoZW0kqEahAFsq/00VnHX2bXu3sIgEJ
uihtG1lcZmCmSU/KuGBDVsDu9JXcNj7o6h40pILQsSTsbXF1YFshzm1dvpdfrtAekXTeI
LrYRMViH6kdpI6uX4ZonoYlIHezTPx+6eHQIb55N3ul+mQf9jx9bITQLOcKGCMc9Z84iR
vGHyabrYFToxK4rGi4gzPndf6hk1aIKRuMhHbq755m7QtKVeUiQJYgxGfbjaC9blsS4E/
OdCIKIpAORzMBX0g1Z2ktu3PIbV2BjGwlYtlqsQZw4CXWd3uZLvw72MZb82enj7ibQg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ODDQP9xp;
arc=none smtp.remote-ip=209.85.216.51
X-Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63E93606A31C
for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 04:50:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 63E93606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-3b37951a397so2048816a91.0
for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 20:50:28 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794891028; x=1795495828; darn=vger.kernel.org;
h=mime-version:content-transfer-encoding:references:in-reply-to:to
:from:subject:cc:message-id:date:content-type:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=ZoSyoZQWdNOdSM4bWqLW3oD6P4gXP5jD57AsOWSPPmo=;
b=ODDQP9xpHuX6IZYldwN6KvAGbIS9mPgl3WX6YAeCyoE3ZeQcGPQyt64N2Pmc8cwLo5
E0op/gga7XkwAcjSIi+3vJwN7vdMehi7MK6h1iAScMqecB5wOKNGl1BvAJqC+vpTghha
4dQFttp/BxsItcM6yNk2DpeYDSbi/SDs6BeN0tegwQMad6V3WoR8ObWC94A724hVVvg3
Vfb6az6HPk/XuWTHCq/unhAG9Gl/GQmvCcfsXwIX351USAaZelmsvYsLKt/N6UKN/upo
Z+hSdp2CmySe01kbVMunGu29LVsKuI92P5bO8/dx3MAV8Gy8uC4pu8hVyXitQcDo/+oJ
2BkA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794891028; x=1795495828;
h=mime-version:content-transfer-encoding:references:in-reply-to:to
:from:subject:cc:message-id:date:content-type:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=ZoSyoZQWdNOdSM4bWqLW3oD6P4gXP5jD57AsOWSPPmo=;
b=XjYnvVWJQ5GYphyr3AgnAnRfUYvuoSTyjBhkSHvjA8VDCpC26TOUostv0J3nERJPu+
FU79B5bY47bdrh2s90OaKL9ph0T9HmoQvW/YAdM3jY5gy+T9hhfYYVOj1oPyDZcypkZs
VfzeAAv32hFo7KbGg/aocbbKRS+rw2efR7jXRexynoN19Pzit9yNnSRGOgFO8GUHqKLE
pmtWrg/LESNxjRBA+vQnAmlBsdf/xLaf6srcdNw6VnmxmiCo4Jdt7ZPYLJdLLnExqSOS
JmE5UbE+dObGw/S0lYO7VLjcbrw59vO9IIceNkDcvz52IEfi8yMyLBqnK9vD82PKukQe
0blQ==
X-Gm-Message-State: APuU4Z8hruON7VRAFKDPVMF9IluEWeI2DtKZKQnCTlkTpI1l7g59KgL+
jx1Sv7CnY9e762sUPU51QffNY3OLArEXIUd6z8QmBeb2lCbQ14e53WuK
X-Gm-Gg: AZFdTZc10gtA9KWGNaCQUsxPFhCpKPMJw/vzrJG6m3Ip2fUAY1w9rtGLSDGBBJzPAXq
jjQ/JznzGwIQ7lfdbjiY4YbOnLqkDKBYhdwjxH+RJsTYyDl+9VzXYm+J6CI/ELEtVZqNmuMEjru
DR+pJzH1ZexD00abGjq8WUBgB+8ngZFgs8juOZTfZKBa5Ye3s3F/Op5Zb7RLNye2crj7PKy/Pov
u+q0RlWC4kXycU+diDsH3ae0UN/dJP0le00Y+Pyg90/0pMdm07EORRz+FzvD97n2u7fwwumfxBT
lWQJZTlA3SohzJX0nlz8QgiVDm3/4gBB041jFhr9ok+qgbBs1iBkJ3OH2oJ3vglrObLZuhLKkk7
4N/AUa1pjRCgcrrPA27EhJC/r/LBjdhc5h+uZCDGJF0EDhFgDx5wtjqTjzCfT7FC9WVef9RSLr3
6X208BB5F4ACkdvVKZ0hMaLu/unv2rUvEvagM+9jgXqhgImMMhcLDvp3O/5toBTepjI3bpZzbBg
9gVmnZASPdvVWVVCRgY5OMoi/w/05tUT5V6Har4S3JMmcSEzQk36us3LC+8LAGSPAa3JOLKDOBT
V+edk2Nu+ItqDvqKOlIuWEywVUOJd4rRP3GsFU5tBqnnNGoCBJLN13VbklTzY/Fbzen62LBU4be
OdZoth4vCZ1yMmNxCBPGN7Hrn5VP8/MqDxrc=
X-Received: by 2002:a17:90a:e187:b0:3ac:9c37:9426 with SMTP id 98e67ed59e1d1-3b1b0ba53d2mr13944527a91.31.1794891027347;
Mon, 16 Nov 2026 20:50:27 -0800 (PST)
X-Received: from localhost ([153.61.198.246])
by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b3abd06666sm1989515a91.5.2026.11.16.20.50.26
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Mon, 16 Nov 2026 20:50:26 -0800 (PST)
X-Cc: <netdev@vger.kernel.org>, "Daniel Borkmann" <daniel@iogearbox.net>,
"John Fastabend" <john.fastabend@gmail.com>, "Stanislav Fomichev"
<sdf@fomichev.me>, "Martin KaFai Lau" <martin.lau@linux.dev>, "Andrii
Nakryiko" <andrii@kernel.org>, "Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>, "Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>, "Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>, "Ihor Solodrai"
<ihor.solodrai@linux.dev>, "David S. Miller" <davem@davemloft.net>, "Eric
Dumazet" <edumazet@kernel.org>, "Jakub Kicinski" <kuba@kernel.org>, "Paolo
Abeni" <pabeni@redhat.com>, "Simon Horman" <horms@kernel.org>,
<bpf@vger.kernel.org>, "Jiri Pirko" <jiri@resnulli.us>, "Victor Nogueira"
<victor@mojatatu.com>, "Sashiko" <sashiko-bot@kernel.org>
X-In-Reply-To: <CAM0EoMk10vCoAKZq0P=8A_jed=Z3SudLEUV8uvXO5F=ewNjnGQ@mail.gmail.com>
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