From: Eric Woudstra <ericwouds@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>,
Roopa Prabhu <roopa@nvidia.com>,
Nikolay Aleksandrov <razor@blackwall.org>,
"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>, Shuah Khan <shuah@kernel.org>,
netfilter-devel@vger.kernel.org, bridge@lists.linux.dev,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v10 nf-next 2/3] netfilter: nft_chain_filter: Add bridge double vlan and pppoe
Date: Wed, 19 Mar 2025 20:18:36 +0100 [thread overview]
Message-ID: <8a30aec8-fcc0-4d5f-b4e8-4cb60fe36725@gmail.com> (raw)
In-Reply-To: <Z9n8GHYfuhTFZB3p@calendula>
On 3/19/25 12:04 AM, Pablo Neira Ayuso wrote:
> Hi,
>
> On Sat, Mar 15, 2025 at 09:00:32PM +0100, Eric Woudstra wrote:
>> This adds the capability to evaluate 802.1ad, QinQ, PPPoE and PPPoE-in-Q
>> packets in the bridge filter chain.
>>
>> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
>> Signed-off-by: Eric Woudstra <ericwouds@gmail.com>
>> ---
>> net/netfilter/nft_chain_filter.c | 20 +++++++++++++++++++-
>> 1 file changed, 19 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/netfilter/nft_chain_filter.c b/net/netfilter/nft_chain_filter.c
>> index 19a553550c76..7c7080c1a67d 100644
>> --- a/net/netfilter/nft_chain_filter.c
>> +++ b/net/netfilter/nft_chain_filter.c
>> @@ -232,11 +232,27 @@ nft_do_chain_bridge(void *priv,
>> struct sk_buff *skb,
>> const struct nf_hook_state *state)
>> {
>> + struct ethhdr *ethh = eth_hdr(skb);
>> struct nft_pktinfo pkt;
>> + int thoff;
>>
>> nft_set_pktinfo(&pkt, skb, state);
>>
>> - switch (eth_hdr(skb)->h_proto) {
>> + switch (ethh->h_proto) {
>> + case htons(ETH_P_PPP_SES):
>> + thoff = PPPOE_SES_HLEN;
>> + ethh += thoff;
>
> This pointer arithmetics does not look correct, ethh is struct ethhdr,
> neither void nor char.
>
>> + break;
>> + case htons(ETH_P_8021Q):
>> + thoff = VLAN_HLEN;
>> + ethh += thoff;
>
> Same here.
>
>> + break;
>> + default:
>> + thoff = 0;
>> + break;
>> + }
>> +
>> + switch (ethh->h_proto) {
>
> This switch will match on the wrong offset.
>
>> case htons(ETH_P_IP):
>> nft_set_pktinfo_ipv4_validate(&pkt);
>> break;
>> @@ -248,6 +264,8 @@ nft_do_chain_bridge(void *priv,
>> break;
>> }
>>
>> + pkt.thoff += thoff;
>
> And only transport offset is adjusted here.
>
>> return nft_do_chain(&pkt, priv);
>> }
>>
>> --
>> 2.47.1
>>
I will sort this out and send a new version after the merge window.
next prev parent reply other threads:[~2025-03-19 19:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-15 20:00 [PATCH v10 nf-next 0/3] conntrack: bridge: add double vlan, pppoe and pppoe-in-q Eric Woudstra
2025-03-15 20:00 ` [PATCH v10 nf-next 1/3] netfilter: bridge: Add conntrack double vlan and pppoe Eric Woudstra
2025-03-15 20:00 ` [PATCH v10 nf-next 2/3] netfilter: nft_chain_filter: Add bridge " Eric Woudstra
2025-03-18 23:04 ` Pablo Neira Ayuso
2025-03-19 19:18 ` Eric Woudstra [this message]
2025-03-15 20:00 ` [PATCH v10 nf-next 3/3] selftests: netfilter: Add conntrack_bridge.sh Eric Woudstra
2025-03-18 23:07 ` Pablo Neira Ayuso
2025-03-19 19:30 ` 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=8a30aec8-fcc0-4d5f-b4e8-4cb60fe36725@gmail.com \
--to=ericwouds@gmail.com \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.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 \
--cc=roopa@nvidia.com \
--cc=shuah@kernel.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).