From: Florian Westphal <fw@strlen.de>
To: Eric Woudstra <ericwouds@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Nikolay Aleksandrov <razor@blackwall.org>,
Ido Schimmel <idosch@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netfilter-devel@vger.kernel.org, bridge@lists.linux.dev,
netdev@vger.kernel.org
Subject: Re: [PATCH v12 nf-next 1/2] netfilter: bridge: Add conntrack double vlan and pppoe
Date: Tue, 1 Jul 2025 13:36:47 +0200 [thread overview]
Message-ID: <aGPIT00m9THn8ABO@strlen.de> (raw)
In-Reply-To: <753902f3-4b11-44f7-9478-02459365a8ef@gmail.com>
Eric Woudstra <ericwouds@gmail.com> wrote:
> > Adding offset to skb->network_header during the call to
> > nf_conntrack_in() does not work, but, as you mentioned, adding the
> > offset through the nf_conntrack_inner() function, that does work. Except
> > for 1 piece of code, I found so far:
>
> A small correction, Adding offset to skb->network_header during to call
> to nf_conntrack_in() also works. Then skb->network_header can be
> restored after this call and nf_conntrack_inner() is not needed.
Good, thats even better.
> > nf_checksum() reports an error when it is called from
> > nf_conntrack_tcp_packet(). It also uses ip_hdr(skb) and ipv6_hdr(skb).
> > Strangely, It only gives the error when dealing with a pppoe packet or
> > pppoe-in-q packet. There is no error when q-in-q (double q) or 802.1ad
> > are involved.
> >
> > Do you have any suggestion how you want to handle this failure in
> > nf_checksum()?
I suspect nf_checksum() assumes skb->data points to network header.
Several places in netfilter assume this, which is the reason for all the
skb pull/push kludges in br_netfilter_hooks.c :-/
git grep -- 'skb->data' net/netfilter net/*/netfilter | wc -l
66
(not all of those are going to be an issue, such as ipvs).
Some callers do this:
if (nf_ip_checksum(skb, hooknum, hdrlen, IPPROTO_ICMP))
where hdrlen is the size of the ipv4 header.
That won't do the right thing when skb->data isn't identical to the
start of the ipv4 header.
Others do this:
if (nf_ip_checksum(skb, nft_hook(pkt), thoff, IPPROTO_TCP)) {
... where thoff is set via nft_set_pktinfo_ipv4(), so it *might*
be correct if nft_do_chain_bridge() is updated to follow l2 encap
trail (switch nft_do_chain_bridge() to use the flow dissector?).
but in some places thoff comes from this:
thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
... which should have the right offset regardless of skb->data is.
So AFAICS the initial step has to be to go through conntrack (and all
conntrack helpers) and get rid of all 'skb->data is l3 header' assumptions.
Then repeat for nat engine, then for nf_tables, then for helpers such as
the nf checksum functions.
IPVS, ipset and xtables can be left as-is AFAICS as they will only see
packets coming from ip stack.
next prev parent reply other threads:[~2025-07-01 11:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 6:58 [PATCH v12 nf-next 0/2] conntrack: bridge: add double vlan, pppoe and pppoe-in-q Eric Woudstra
2025-06-17 6:58 ` [PATCH v12 nf-next 1/2] netfilter: bridge: Add conntrack double vlan and pppoe Eric Woudstra
2025-06-22 20:16 ` Florian Westphal
2025-06-28 13:27 ` Eric Woudstra
2025-06-28 14:21 ` Eric Woudstra
2025-07-01 11:36 ` Florian Westphal [this message]
2025-06-17 6:58 ` [PATCH v12 nf-next 2/2] netfilter: nft_chain_filter: Add bridge " Eric Woudstra
2025-06-22 20:40 ` Florian Westphal
2025-06-24 10:09 ` Eric Woudstra
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=aGPIT00m9THn8ABO@strlen.de \
--to=fw@strlen.de \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ericwouds@gmail.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=razor@blackwall.org \
/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;
as well as URLs for NNTP newsgroup(s).