🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16689

Re: [PATCH net v4 2/3] net: neighbour: reinject a parked skb through a headerless output device

#16689
From: netdev-bot+sashiko
Date: Sun, 15 Nov 2026 15:47
147 lines
12899 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The new check in neigh_update_process_arp_queue()
  (net/core/neighbour.c) is `if (!n1->dev->header_ops) skb->dev =…

--

net: neighbour: reinject a parked skb through a headerless output device

When n1->dev has no header_ops, this patch makes
neigh_update_process_arp_queue() set skb->dev to n1->dev before it calls
n1->output. Here n1 is the top-level neighbour looked up again from the
skb's dst. The patch is aimed at sch_teql, which parks skbs on the slave's
neighbour with skb->dev set to the slave.

Link: https://lore.kernel.org/netdev/20261110101908.2e64e8e9@kernel.org/

> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index d6e9c7c59a892..1b556fa17c57c 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -1339,6 +1339,9 @@ static void neigh_update_process_arp_queue(struct neighbour *neigh)
>  			if (n2)
>  				n1 = n2;
>  		}
> +		/* headerless output transmits on skb->dev, not n1->dev */
> +		if (!n1->dev->header_ops)
> +			skb->dev = n1->dev;
>  		READ_ONCE(n1->output)(n1, skb);

[Severity: Medium]
Can this gate send a redirected skb back through the egress hooks of the
original device?

The check has no way to tell sch_teql apart from forwards that move the
skb to another device but keep the original route's dst attached. Two
forwards do this: nft fwd ... neigh, and bpf_redirect_neigh() called with
explicit nexthop parameters.

Here is the sequence:

1. One of these forwards runs at the egress hook of a device X that has no
header_ops (for example wireguard, ipip or sit). nft_fwd_validate() allows
NF_NETDEV_EGRESS. The egress hooks run before the dst is dropped, so
dst->dev is still X:

net/core/dev.c:__dev_queue_xmit() {
    ...
	skb = nf_hook_egress(skb, &rc, dev);
    ...
	skb = sch_handle_egress(skb, &rc, dev);
    ...
	if (dev->priv_flags & IFF_XMIT_DST_RELEASE)
		skb_dst_drop(skb);
    ...
}

2. The forward sets skb->dev to an ARP-capable device Y and transmits
without dropping the dst:

net/netfilter/nft_fwd_netdev.c:nft_fwd_neigh_eval() {
    ...
	skb->dev = dev;
	skb_clear_tstamp(skb);

	nf_dev_xmit_recursion_inc();
	neigh_xmit(neigh_table, dev, addr, skb);
    ...
}

On the BPF side, __bpf_redirect_neigh_v4() replaces the dst only when
nh is NULL:

	if (!nh) {
		...
		skb_dst_drop(skb);
		skb_dst_set(skb, &rt->dst);
	}

	err = bpf_out_neigh_v4(net, skb, dev, nh);

The IPv6 path through bpf_out_neigh_v6() follows the same pattern.

3. If Y's neighbour is INCOMPLETE, the skb is parked on Y's arp_queue
with the stale dst still attached.

4. When Y's neighbour resolves, the drain loop sets n1 from
dst_neigh_lookup_skb(dst, skb). That gives X's neighbour, and because X
has no header_ops, arp_constructor() set it up with neigh_direct_output:

net/ipv4/arp.c:arp_constructor() {
    ...
	if (!dev->header_ops) {
		neigh->nud_state = NUD_NOARP;
		neigh->ops = &arp_direct_ops;
		neigh->output = neigh_direct_output;
    ...
}

5. The new gate changes skb->dev from Y back to X, and
neigh_direct_output() then calls dev_queue_xmit() on X.

As a result, X's nft netdev egress chain and its tc egress BPF program
run a second time on a packet they have already handled.

nft_fwd_neigh_eval() calls ip_decrease_ttl() (or decrements hop_limit)
again, so TTL drops by 2. A packet that arrives with TTL 2 is then
dropped.

Counters, quotas and limits count the packet twice, and BPF mangling or
encapsulation is applied twice. If the second pass makes a different
decision, the packet leaves on X instead of the forward target.

Before this patch the same parked skb was also mishandled: it left Y
through neigh_direct_output with no link header. So the patch changes how
this case fails, but running the hooks a second time is new.

The commit message describes this side effect:

  Those forwards supply their own device and nexthop and do not consult
  the retained dst, so dropping it at those two sites is where that is
  fixed; that is a separate change to the producers.

That producer change does not appear in the series. The later commit
"net/sched: sch_teql: keep skb->dev consistent on the arp-queue path"
only touches sch_teql.c, so the double traversal is still there at the
end of the series.

Could skb_dst_drop() be added to nft_fwd_neigh_eval() and to the nh != NULL
paths of __bpf_redirect_neigh_v4() and __bpf_redirect_neigh_v6() as part of
this series, ordered before this patch?

>  		if (n2)
>  			neigh_release(n2);

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-6HS9.v4.r0.20261111094338%40mojatatu.com
Technical Details
Message-ID: <179475765178.2199510.12946653524000550678@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363747-linux-kernel-netdev=dewy.ru
References: <QDISC-6HS9.v4.r0.20261111094338-2@mojatatu.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363747-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v4 2/3] net: neighbour: reinject a parked skb through
 a headerless output device
Date: Sun, 15 Nov 2026 15:47:31 +0000
Organization: Usenet Network
Message-ID: <179475765178.2199510.12946653524000550678@kernel.org>
References: <QDISC-6HS9.v4.r0.20261111094338-2@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1841385"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:RBpz6QaGi2/cw/0C/UBsuuq8riI= sha256:LFxwlJMK2CzlGJmhXnRyaQcoGJte2uASv9UQzkn/Rbk=
	sha1:/IcwOuM9hqw778jSEksMnLbX59Y= sha256:iMFfsm8PFZxX4AaLhJrW39AnPWAfRodlbPIbL3kfXXc=
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 05CB21149FC; Sun, 15 Nov 2026 18:48:10 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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=kernel.org
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 1tNQXFKvDUsh;
	Sun, 15 Nov 2026 18:48:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-363747-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id C92A41149F9; Sun, 15 Nov 2026 18:47:55 +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 36700282D9; Sun, 15 Nov 2026 15:47:35 +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=1794757653;
	b=udLtg+xCYfmnRe9vBAs03IwLns4IXNjTbdndUHfdogrenWERpN/PeaDiDcsAGGz6+gcp
	 zk9DYpfv2yCE+PT0AKI7UYSfE7nVbir5uls/uLrfqUepfuRSdrd0GBB2Um0FdpvZUVwbM
	 ShDrHTUn7XcDdixa9AFRQgla4OaxIcsEq1c8s3f7F3/pYu5aoNpuOlWTIxCumF2P1Ks+N
	 FyQqlAPvpxHW87t+rESnHZywW70h/IhGQTtRwzYlMExCmQdula1IuPDoRLLme6yr1cKWP
	 KUPQVpGRfKFFRK5saY6r/9w3DNdVyCGZRb59gqXALMjqd1dXxNDJCvyT6tqSHOLk5JA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794757653;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=drYBVwb1O7PjkEdSxQ7VDO99vSxLe3uiv56MMlcoFsE=;
	b=LxTrZc2Rq0glmXb7Df8XRb704RinBUq4raukuUe2qg+gSh81CffgIj75oQhwf7MmPFql
	 mWCj0LJfHJmo0TE1fJId+Aoo4wBG+GaUBOkruO0L9G4vglEre4xl2f/NwMiCQ/2JNe0AX
	 rn5dTmGyJWbKJoWQMuS3VDVghwlnGdYqPKecxP46JfjsjZWLk3chZXE6fS71lZW6Cbubz
	 uUn1dBEn1243rj2qYT9AoSXlMdxZnZprpVouG3KIqpq/EBEnkJpoWQ1lTo1mrce8WYMfx
	 B/Wi/l0qNgRkuNzHSi4LuepDeWCMjNIm21TLaF5A0/VgiJrBxhi3Rl9j0eW1K3FQebQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RQAlcJg2;
	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 C8BD6606A31A;
	Sun, 15 Nov 2026 15:47:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RQAlcJg2
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794757653;
	b=YT29GG5jm6x1/nOHZ95uALwCfeOiOwvj+3/UzPGsWcSFcgL4iFkI7yZuGnu1YIg/w+fK
	 ITfBCbLjdUa4BPigZn92AqS+BxgWa1+LgGS/NjW99ev0AsTvWKwX47BO56ojYm0OCL2y+
	 vu1hTaAHoEZqwZ7SRVIvqjhuatkj3gX/PJJ5FBqnEt6/I5jfUAVjhbuCHYUW2w4JHDxbd
	 eiPuccE0vCHDKD0dzg/UCEFi/gyum070CxOMtZbMouxjFKKRKQfRTTNS3C6fmBG8ox90w
	 ws/8JkbXbkbDYn4JUd0BQpeW0dTvakn9QZb6aDoM3w2BoE8B7J97YUQNS9jt7qffY8Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794757653;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=drYBVwb1O7PjkEdSxQ7VDO99vSxLe3uiv56MMlcoFsE=;
	b=DT9RycZ9wF1qaGv4HZh5cpb0m74gEf2pZ/jZ9mh2kxP7V+j0l6U/KWnoLqKl0DMyZ1PE
	 Ydpvtite/hlml5sdS7AP7ThxJCzajESBr1gfK60ZGAnc7zlnPSRUrX9SNqruXUd5aAiGZ
	 dvA0zW+chri5AoXc0J+cGRhbzFjw0qhhQNdYxjardOdiPLO1Y6slzkjfWzBype++2S17e
	 nDqrbKeoonGsdLXgORYjBNe88SSi5liyndu1dj2TvR5S6t85shGhqVMtDtelI0ioFKJks
	 w5dwr5gbTtEO0c3PxYvKwqqVJ626wNdvX29RN370a1Zg4r2D0YFdq2dI3DcFqhen7ug==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RQAlcJg2;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9FCE606A331;
	Sun, 15 Nov 2026 15:47:32 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37FC41F000C4;
	Sun, 15 Nov 2026 15:47:32 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794757652;
	bh=drYBVwb1O7PjkEdSxQ7VDO99vSxLe3uiv56MMlcoFsE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=RQAlcJg29DmqUdLbKFjewSYH8Bx1N1dyCCQKB6kkpM1roEmi9ZjwFyHtMbL/XaHVS
	 AodsczZ/o3+0gX9gSa+e/GPK3nz0K19AcNWE1rtBphDF73JDnauvQaOzoobOvQl6/a
	 nAWpt1VAgtyRqlr9865VAJ+9TbH/U6cIsFlXVlZnY2EvlYVzA9cimKnYeNobA1cqY+
	 qbeO2Z5Fef6uhh9YuPYLFWf9ypCD195Y/nt3f51YMU5Lj7TMeHA6GNiK8juX9Rf5tF
	 2su61lp3l7cRG2TcbJdXjNryLVpXCidLKMVxSlVQsvl35tqyB0OVez9fHSeQNdUhZ/
	 42czDxesZ8jqQ==
X-Cc: netdev@vger.kernel.org, victor@mojatatu.com, jiri@resnulli.us,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 horms@kernel.org, stable@vger.kernel.org, sashiko-bot@kernel.org
X-In-Reply-To: <QDISC-6HS9.v4.r0.20261111094338-2@mojatatu.com>
X-sashiko-severity: Medium
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