๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26879

Re: [PATCH] netfilter: flowtable: update skb csum after pppoe header push

#26879
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 10:42
98 lines
11587 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 1 ยท Medium: 0 ยท 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).

- [High] The fix does not deliver what its commit message promises.

--

netfilter: flowtable: update skb csum after pppoe header push

This patch adds a skb_postpush_rcsum() call to nf_flow_pppoe_push(). The
goal is for skb->csum on CHECKSUM_COMPLETE skbs to cover the newly pushed
8 byte PPPoE session header. It follows what the vlan push path already
does.

> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
> index 19cafae748abe..a0b541b811b40 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
> @@ -585,6 +585,8 @@ static int nf_flow_pppoe_push(struct sk_buff *skb, u16 id,
>  	ph->proto	= proto;
>  	skb->protocol	= htons(ETH_P_PPP_SES);
>  
> +	skb_postpush_rcsum(skb, skb->data, PPPOE_SES_HLEN);
> +

[Severity: High]
Does this actually leave skb->csum covering everything from skb->data
onwards by the time the skb reaches later consumers?

nf_flow_queue_xmit() calls nf_flow_encap_push() and then
__nf_flow_queue_xmit(). That pushes the Ethernet header right after the
PPPoE header, with no rcsum update:

net/netfilter/nf_flow_table_ip.c:__nf_flow_queue_xmit() {
    ...
	skb->dev = dev;
	dev_hard_header(skb, dev, ntohs(skb->protocol),
			xmit->dest, xmit->source, skb->len);
	dev_queue_xmit(skb);
}

eth_header() does a plain skb_push(skb, ETH_HLEN). After it runs,
skb->data points at the Ethernet header. skb->csum still covers only
PPPoE plus L3 onward. The checksum is still stale, just off by 14 bytes
instead of 22.

The consumers that keep CHECKSUM_COMPLETE across L2 expect skb->csum to
cover the MAC header. For example, with a veth egress device,
__dev_forward_skb2() in net/core/dev.c does:

	reason = eth_type_trans_careful(skb, dev);
	...
	skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);

This subtracts Ethernet bytes that were never added. The tc mirred
egress to ingress redirect in tcf_mirred_to_dev() does the same thing
with skb_pull_rcsum(skb_to_send, mac_len). Will these still compute a
wrong checksum after this patch?

There is also an earlier problem on IPv6 flows. nf_flow_offload_ipv6_forward()
changes L3 bytes without updating skb->csum:

	ip6h->hop_limit--;

So for IPv6, skb->csum is already stale before nf_flow_pppoe_push() runs,
and folding in the pushed header cannot make it correct again.

The core forwarding paths handle this by downgrading CHECKSUM_COMPLETE
with skb_forward_csum(). That is done in ip_forward(), in ip6_forward()
before the hop_limit decrement, and in the bridge forward path.
nf_flow_table_ip.c never calls skb_forward_csum() and never sets
ip_summed.

Flowtable hooks are only registered at NF_NETDEV_INGRESS, so
NIC-provided CHECKSUM_COMPLETE skbs from ordinary forwarded traffic reach
this path. nf_flow_vlan_push(), cited in the commit message as the
precedent, has the same limitation.

Would calling skb_forward_csum() in the flowtable forward paths, as the
core stack does, be a better fix? That would make the per-header rcsum
calls unnecessary. The other option is to also fold the L2 header pushed
by dev_hard_header() and every L3 change, such as the IPv6 hop_limit
decrement, into skb->csum.

>  	return 0;
>  }

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203094901.164422-1-lvjunyu%40cmss.chinamobile.com
Technical Details
Message-ID: <179638096829.3146.10679863756672292574@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.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-377259-linux-kernel-netdev=dewy.ru
References: <20261203094901.164422-1-lvjunyu@cmss.chinamobile.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.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-377259-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] netfilter: flowtable: update skb csum after pppoe header push
Date: Fri, 04 Dec 2026 10:42:48 +0000
Organization: Usenet Network
Message-ID: <179638096829.3146.10679863756672292574@kernel.org>
References: <20261203094901.164422-1-lvjunyu@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2743267"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DRDlsy34k8HdS+JZSzHiVYVO5T8= sha256:pahM9jfEqT7FPR957/oUnTwrFWspQX+s1zGzogADVi8=
	sha1:s6k0l9d+82zT/SkGR3Ogk4Z+adc= sha256:P1mwai0p2HC7SjnFVAqVvbzc7aaEU8U4Ot/qX1RO4FU=
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 6DA74117BA9; Fri,  4 Dec 2026 13:43:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.541
X-Spam-Status: No, score=-3.541 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, 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, URIBL_BLOCKED=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 ujrmc7pRhptU;
	Fri,  4 Dec 2026 13:43:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377259-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 1DC14117AFF; Fri,  4 Dec 2026 13:42:54 +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 7588B347B9; Fri,  4 Dec 2026 10:42:50 +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=1796380970;
	b=XSZK/oYw+eWe4KWSalAQw/Sszty0W0+robP0sK8VAtfqojt2oAUp74iQgQseyvicY3z5
	 RGe5yOpKqTqlQo1KZiLjG3Sh9VrPvw+aNwFd3XNwMbigfrz/a132/FaqAra6KMAkMjUWD
	 CoSQdwyQeVNkZw7Ezx/3KRLgpPWd44V78rC3tGJOyi4zqaQHLs0XpGDY5Zh132FYzM1cR
	 9OV5gqIHa9E7TpEnaD78q7McwzpIDeKNqW16p3m6zTs3P3pyrI3ud1hHD5meLC9Wiryat
	 2a5EltWQ1i2zaNrqZiexKwpVT06IfqrtkvTM1NqcSLBhbh0jzP2my/IrgkQugVfIgQA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796380970;
	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=FzUpg2FpsMzB5YoE3IerFlLh0tePF5JW9pKaijWG3AI=;
	b=FY1uu1XMD6W7NuxSWiEFiiOIcFavgL+NW1GNLqxZBhl9g58b8YSWJ4vZ6PPG5jmqKzY5
	 qdDfYAQnqbDfuo5aR01Z7Q6tYMuICZtPe7GuXgGry+No/Pn+weCKQrhKls7eJc8bOGg2z
	 jJmlJ+QdsjRuekjG12+OcgNmIY/moW7LYWqUrDbNQC158ZRarLQckbpZEhvxWBexzvpkL
	 VmWVaq6PgSdYxutmWTbhDHoNntKAxQ7F5tfGDDa9cPcIeravhnJ6lacXaB/iiafUli43j
	 MkJZYEEPuvTLAe4ZWtlmiOHSQJ0wzCZLNVQ1qQGv8EslkOG3ahfiWwIeA4tCVb2zWtw==
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=jrYbSxCl;
	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 411E5606A32F;
	Fri,  4 Dec 2026 10:42:50 +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=jrYbSxCl
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=1796380969;
	b=rnKctj6ZfvFjHmfEe49rxzZG/Wm9e5eoxh4NjH6idJ5n4ji27C9HRpaEbuR2scAJdEpI
	 S3lvpFTlRzjLliful519BTPNZjR9oF3qPPeWy9KNMyaOtHif/rgJe5eCk84h1cAwOZCaW
	 Pcprvp1Umxs7StSg7GdioFXb4ozWFk2TFqJAHMWHNYkbS1DY7IlQhplHXY1cKj7vIhakk
	 afpPyHzEeW1MyC6hTdrKPlS6cj953VQNg8cu0A6uEPbdKKpW6DiG79ICduK0O2qqkrBYi
	 lShkIJ1jYW7shdtNPZlGGKo6LJFFhBeuqm+iVNMrzWo0kRawqyLNRAvLNQ3azz+FaiQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796380969;
	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=FzUpg2FpsMzB5YoE3IerFlLh0tePF5JW9pKaijWG3AI=;
	b=oWN4aTnnYa2WwpBzN2L0nmJODcb+8ZWHc3jgQov65zptS95PM7Qdb+4Ep70rwmGfs169
	 mOYUGwtlYm4OW29sszMlW14fbbVLh9D1AeCArQvPVjkk1l4NC5MLVtw6Pza9lnyZc5Il6
	 cyFXZCWzP+wxnb3TcCWH0iwsuAnCDYT9NI5uKOdZ4fqSmMkjgZaNXB/NqGQyVTR1I313M
	 TazuRPeAPjEUg4vpCZkTrWE/PldNblBpCC0Sin5dNh5njVgVjtmos04Lh8MpU0v8Wo41y
	 20UP/IR/NkRet8+f1eXvqdO6qdgXRVKMZimTG4gMIl2L6CfiFiNASJ6a253a9goCztg==
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=jrYbSxCl;
	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 62474606A32D;
	Fri,  4 Dec 2026 10:42:49 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B76BA1F000C2;
	Fri,  4 Dec 2026 10:42:48 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796380969;
	bh=FzUpg2FpsMzB5YoE3IerFlLh0tePF5JW9pKaijWG3AI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=jrYbSxClD3Pwn+1F3dMZ0/vrcIR/wMK88QPoYccTNa8uEySZmcTR0TMsbfmVgLgxF
	 XMLJySfUd+Uv+ohSer3NT85cNavpPCtSVT6FZ33yE3fVmaDZo1Ee11+ir6uK6T2DCH
	 xnvQpHWxXAnxwnUQjW0gZFFtmXXAL3qA+deevwefkGAhqSafziaME8iHSJ0gm1LBty
	 UIrFqXNLHo7kVJypYyiZJuM+zEsfxO2EORTYEzlt00l4Kio/o/1hjpiQNIRqR8Jgnk
	 HvK8sW/Ce2tCdRV5GM+EJpjJGK4465+lI9LUu8j2bkORnp8pLGJsMwLkDP/91XwMDt
	 m+l4DY8GdFZAw==
X-Cc: pablo@netfilter.org, fw@strlen.de, phil@nwl.cc,
 netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
 coreteam@netfilter.org, kuba@kernel.org
X-In-Reply-To: <20261203094901.164422-1-lvjunyu@cmss.chinamobile.com>
X-sashiko-severity: High
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