Netdev List
 help / color / mirror / Atom feed
From: lvjunyu <lvjunyu@cmss.chinamobile.com>
To: pablo@netfilter.org
Cc: fw@strlen.de, phil@nwl.cc, netfilter-devel@vger.kernel.org,
	netdev@vger.kernel.org, coreteam@netfilter.org,
	lvjunyu <lvjunyu@cmss.chinamobile.com>
Subject: [PATCH] netfilter: flowtable: update skb csum after pppoe header push
Date: Thu,  3 Dec 2026 17:49:01 +0800	[thread overview]
Message-ID: <20261203094901.164422-1-lvjunyu@cmss.chinamobile.com> (raw)

nf_flow_pppoe_push() pushes a new PPPoE session header in front of
the packet data but does not fold it into skb->csum.

For CHECKSUM_COMPLETE skbs the checksum covers everything from
skb->data onwards, so after __skb_push(PPPOE_SES_HLEN) the 8 bytes
of the new header are not accounted for in skb->csum.  Any later
consumer doing incremental checksum updates on top of skb->csum
then starts from a stale initial value and can drop valid packets.

This is inconsistent with the sibling paths, which all keep the
checksum in sync: the vlan push path uses skb_postpush_rcsum() and
the vlan/pppoe pop paths use skb_pull_rcsum().

Mirror the vlan push path and use skb_postpush_rcsum() so the
pushed header is accounted for in CHECKSUM_COMPLETE skbs.  Call it
after the header fields are written, since it folds in the bytes
as they are at call time.

Fixes: 18d27bed0880 ("netfilter: flowtable: inline pppoe encapsulation in xmit path")
Signed-off-by: lvjunyu <lvjunyu@cmss.chinamobile.com>
---
 net/netfilter/nf_flow_table_ip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index 19cafae748ab..a0b541b811b4 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);
+
 	return 0;
 }
 
-- 
2.43.0




             reply	other threads:[~2026-12-03  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:49 lvjunyu [this message]
2026-12-03  9:59 ` [PATCH] netfilter: flowtable: update skb csum after pppoe header push netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203094901.164422-1-lvjunyu@cmss.chinamobile.com \
    --to=lvjunyu@cmss.chinamobile.com \
    --cc=coreteam@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox