Article View: linux.kernel.netdev
Article #15081Re: [PATCH net-next 1/2] netfilter: nft_fwd_netdev: drop the stale dst when steering to a device
From: Jamal Hadi Salim
Date: Thu, 12 Nov 2026 10:49
Date: Thu, 12 Nov 2026 10:49
86 lines
15157 bytes
15157 bytes
On Wed, Nov 11, 2026 at 4:33 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> On Wed, Nov 11, 2026 at 09:16:37AM -0500, Jamal Hadi Salim wrote:
> > This is a followup of the review of the teql arp-queue fix as reported
> > by Sashiko.
> >
> > The issue: the neighbour variant of fwd rewrites skb->dev to the
> > configured output device and calls neigh_xmit(), but leaves the skb's
> > dst untouched. If that device's neighbour for the configured nexthop is
> > incomplete, the packet is parked on the neighbour's arp_queue while the
> > stale dst still describes the device the packet was routed through.
> > Draining the queue re-looks the neighbour up from that dst, so the frame
> > is built with the routed device's link-layer header and then transmitted
> > on the configured device. The packet leaves with another device's
> > addresses.
> >
> > The Fix: drop the dst before the device switch. Both lookup inputs the
> > neighbour transmission needs, the device and the nexthop, are supplied
> > by the rule, so the route dst is never consulted. Without it the queue
> > drain keeps the parking neighbour and the frame carries the configured
> > device's addresses.
> >
> > Conditions to recreate the bug: two network namespaces, A (10.10.0.1/24)
> > and B (10.1.0.1/24) in one, their veth peers in the other with only A's
> > peer addressed (10.10.0.2/24) so B's nexthop cannot be resolved by ARP.
> > Resolve A's neighbour for 10.10.0.2 as permanent, then load this ruleset
> > on A:
> >
> > table netdev t {
> > chain c {
> > type filter hook egress device va priority 0
> > policy accept
> > fwd ip to 10.1.0.2 device vb
> > }
> > }
> >
> > Send one packet to 10.10.0.2. It is parked on B's incomplete neighbour
> > for 10.1.0.2; once that neighbour becomes valid the frame leaves B
> > carrying A's source address and A's neighbour as the destination.
> >
> > Reported-by: Sashiko (nipa) <sashiko-bot@kernel.org>
> > Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-6HS9.v3.r0.20261103062649-2@mojatatu.com
> > Link: https://lore.kernel.org/netdev/QDISC-6HS9.v3.r0.20261103062649-2@mojatatu.com/
> > Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> > Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> > ---
> > net/netfilter/nft_fwd_netdev.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c
> > index a48c2f765bba..ad4d61d64cdd 100644
> > --- a/net/netfilter/nft_fwd_netdev.c
> > +++ b/net/netfilter/nft_fwd_netdev.c
> > @@ -175,6 +175,7 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
> > }
> > }
> >
>
> Does this need a check for skb_dst_valid()? I think it is valid to
> attach a template dst here for tunneling?
>
You are correct (I think you mean skb_valid_dst()). Same guard needed
with the second (ebpf) patch.
pw-bot: cr
cheers,
jamal
> > + skb_dst_drop(skb);
> > skb->dev = dev;
> > skb_clear_tstamp(skb);
> >
> > --
> > 2.43.0
> >
Technical Details
Message-ID:
<CAM0EoMm3hK1P_-gTz9R3oo528t_rqfX4BWfJN9odCdm27iTtww@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361735-linux-kernel-netdev=dewy.ruReferences:
<CORE-9NOG.v1.r0.20261111073528@mojatatu.com> <CORE-9NOG.v1.r0.20261111073528-1@mojatatu.com> <avTfQjFQYR2NNdRg@chamomile>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361735-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/2] netfilter: nft_fwd_netdev: drop the stale
dst when steering to a device
Date: Thu, 12 Nov 2026 05:49:26 -0500
Organization: Usenet Network
Message-ID: <CAM0EoMm3hK1P_-gTz9R3oo528t_rqfX4BWfJN9odCdm27iTtww@mail.gmail.com>
References: <CORE-9NOG.v1.r0.20261111073528@mojatatu.com> <CORE-9NOG.v1.r0.20261111073528-1@mojatatu.com>
<avTfQjFQYR2NNdRg@chamomile>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="1069056"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:JwyVYm/GdPxi4Zt0SJ5IjMlBQkE= sha256:ao7VJdqSEoPa91nfS3Cipome24NQb01m0tirT/f7yck=
sha1:/1sQKb5cFeG8hwRPv4IwsmzgZyI= sha256:XnBtJ+Mucxr4j4NS0G2oOidIGmoXub9BA6PsR6VUnxw=
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 EDF1B1141DE; Thu, 12 Nov 2026 14:05:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, 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 (1024-bit key)
header.d=mojatatu.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 EXDxJwUKGBZj;
Thu, 12 Nov 2026 14:05:00 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-361735-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 70FB61141A1; Thu, 12 Nov 2026 14:04:52 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 3D78D1E119F; Thu, 12 Nov 2026 10:49:43 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794480580;
b=oYQhY9vRjhJiW++8UdWqr62kubchfcw2ol/DmJS78MHHZ+nADgxF0tISwXBigV8xgRIb
NqxdpL8B5fj4zz6jTcRw1bS5fedT6kGVWOGXgesLk8j3J9vLJ600KpMrqpN1JmDDPcIq1
HEXs2ZWqd5TDnE0Ew/55SLZi1khRTmbftGs/fna8T6S/LAJnrrXdX2WDPgf9Wdohl2GHB
4UIwvOnPqaBlPBoI//8u7s9QiS9igY7cLgNnnMJ7eofoIXJeMyGS5OSqGb0x/e4q6AIzF
ylMgDYhHCDXXPLH9aotSaMUGZj29wyuHCmGF/+wKjsy8WoIBLIQhMPQcX8hZs3135Yg==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794480580;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=FEtDWOCZqPhjvsvxprvXZxQh6BiXZmmXMKDopOlOztk=;
b=hkuw10NIwzLYfAm6TWzIMFc33C7RU2uUw6PYRSYtnyNgvjFPotxyXYWHwC/uLvCTroxO
+qm5qAagGyXo81/d8ciodGeALPdXuixsn6R6dQgonS7gpmgXnF9qMT9uKd+VJ2e7Vq5cd
PDB3mKu5q4gLijLzvKV9efUwMEZk3vM10ulw9OtK7qS78QOs4GBFb1dVFJxRMkMbzdL7f
hRCmfb+FIO11aoLCFoKyq66CjDl+4WM/rYv8TIC0kEQ1EA1iXXxn5a0YSpwOvs0sPofnR
HhqbV8RZUIquzKoSHsSEv9P6H/b8A1l0HEr6GeAzyOql4rVSG8CR9LvLJnpbz/4rBLg==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org;
dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=Tqj5nvAp;
dmarc=none header.from=mojatatu.com;
spf=none smtp.mailfrom=mojatatu.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 59AE9606A333;
Thu, 12 Nov 2026 10:49:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=Tqj5nvAp
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.210.170
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794480579;
b=0KvwtHJvItvabubCBfZeOK9aRvZ6HEAf5xDLb42aFdBYp9h+0bxLrzOvL2egOLIsB2dV
myF5k+M0J145KhTj0JO/2mNt5u+1XeHnBYuqS6zGABaGrLzuwsJoju+VPjhU68AfDfuLc
IOTupIjXyHEO/Jh+rnEdpTo2ekr2QqG+e9zajIsJxpsnTpmiOhm3+S0hVfk3TTNDFae7J
6bLk9yfV8ECZrDpmK8n3muwmJUcqt0ylkK83/87PNxWFr0jyqjEAX39QWGcGkB8JZqnK5
EYHml0ss+5Zyp6O5pO/BXw7EvBYube/iVE6qJx4aAnipWF/lStbPs7yjVTTFVS3ppBQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794480579;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:MIME-Version:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=FEtDWOCZqPhjvsvxprvXZxQh6BiXZmmXMKDopOlOztk=;
b=hEM/QVNCVBZZtSP18G7H8BQFSrBxEdzYffUuiRln/Q5XBi0zqt4MVJywkfeY4z7KfESM
D4DguVqoT9tbhtcz0CpqFEB+a8uIIJx9ieqbY1u6U3DFRbu7q/77lU0T/Qqw79O66mdzT
yIxrh8pwkL6xrDwYB+XH4rJR6qU8pbIs2LAhSnVSRfy6LXH44J3h6mYC59tBS+qhelqlV
O2+cvqgievxaLKLAhu9V7ZhU9mFUQT1xmUNvi0hjfqWje/XOxCK2FHOeT/YJa6R5GyIpo
bVGX4nqED6LV1MPNgil+//JjFDMIAEf1hdpfz0jdYbrt5TcJIbjFkksjxy57IjrhbvQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dmarc=none header.from=mojatatu.com;
spf=none smtp.mailfrom=mojatatu.com;
dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=Tqj5nvAp;
arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.210.170
X-Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170])
(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 123D4606A323
for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 10:49:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 123D4606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=mojatatu.com
X-Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-8b32bc605d9so1830666b3a.2
for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 02:49:38 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1794480578; cv=none;
d=google.com; s=arc-20260327;
b=g63seoPunjWYfRuYCE+KFYxe9E7HU6AoS4K9B74pjetZ5QO0F1OpdqUdEdPfye3xUn
pVInjV9mAiAaPqd/68rOYRNkwlEqPOMIpaAHIWBw5UZ8ODA/KtcEJl0BJbbil0TAqJxS
klGSz4wVTYIMaEuFhorQi6qPJKXwwnP5xJlXVse8UQjtei5uvUXSyH6etydbDjjGJj3f
4c8aM57q7ntxfMwA3gbP6C7ebBgxE2wA5Qmy59Y5jsOg0Pif/qCoJtLyMesyKOocLyGw
U86uyM5qScYocarTdCbTe5LuFYra4xiG+jOzhE0cQQOKuAjzeZzhcAtKA75pB7h7jIZI
zMBg==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:dkim-signature;
bh=FEtDWOCZqPhjvsvxprvXZxQh6BiXZmmXMKDopOlOztk=;
fh=iGykyabEy1dGb0yUcsMNklzt+4seZ3AundnDkmRvUu0=;
b=QRuv1l9wcJFKXSY/EiNEqHYA7fRKlNkPTseU1rqZdrABdHTiR95bqdYAqmJyq0FliS
Z0qyZYylTx0Ym+s7S3ViieOI4zjmOWX3i7j736duqWg2QlIz1R7OQrVjGK8fPhFy32yN
E+WDHD+h3hk1/bxgTsZqXg36AyVeZdeY27zyYgdQVqi0YTKqSNFmrGkCk+VgNcVtrDXW
VgEVwWREd4m6yda8ynEHWQoqwxSeV7KC/CN8OjKdthY0RxH1RRjUDLSgUeXgdorPQWMs
yQplUUOjjqrF5A1PKquYYd33gAouuWn5yVKQ4P2JnW53NLu8Bg0zMz5hoOxBlhBMrwuj
TmPw==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=mojatatu.com; s=google; t=1794480578; x=1795085378; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=FEtDWOCZqPhjvsvxprvXZxQh6BiXZmmXMKDopOlOztk=;
b=Tqj5nvApRnLaXKJqnt1MtDcVgtOxG9b6FS3RhbrQh5OZklRpQEZx6UBwMAO9PmjJvf
ArxcVMnUGE12W/1CQHNBzLA8ggTDyzZy+qk6SjvayMiejqah/j/hEhrJJDpdh8BtWUGI
J9kO4ui3tsJ78QlVZXP12CxS4RXKWeUwe8wh8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794480578; x=1795085378;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=FEtDWOCZqPhjvsvxprvXZxQh6BiXZmmXMKDopOlOztk=;
b=mKd4WiDB45NVF+E5IKYAZnmASOCklUKjQRCZiv87SazgXaqdKUE8PK1J/sMsy/SxpP
k6/1w2a/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800 (PST)
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
X-In-Reply-To: <avTfQjFQYR2NNdRg@chamomile>
X-Gm-Features: AclHuK9omPXMn0HkBh9zI32g8JDs_xDABa01ADFsm-x2ufsLQpfFXolnA1YvCdk
X-Cc: netdev@vger.kernel.org, Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
"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>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
Victor Nogueira <victor@mojatatu.com>, Jiri Pirko <jiri@resnulli.us>, sashiko-bot@kernel.org