Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Laveesh Bansal <laveeshb@laveeshbansal.com>
Cc: Florian Westphal <fw@strlen.de>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Ido Schimmel <idosch@nvidia.com>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	bridge@lists.linux.dev, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] netfilter: bridge: refragment packets with a vlan tag moved by the bridge
Date: Tue, 20 Oct 2026 10:23:20 +0200	[thread overview]
Message-ID: <atck-NoWvemxIsF6@chamomile> (raw)
In-Reply-To: <20261020005403.38212-1-laveeshb@laveeshbansal.com>

On Mon, Oct 19, 2026 at 05:54:03PM -0700, Laveesh Bansal wrote:
> With vlan_filtering enabled, br_allowed_ingress() moves the vlan tag back
> into the packet when its protocol differs from the bridge's vlan_protocol,
> an 802.1Q tag on an 802.1ad bridge for instance, and sets skb->protocol to
> the vlan ethertype. That happens after the NF_BR_PRE_ROUTING hooks.
> 
> Bridge conntrack has already defragmented the packet by then, based on the
> original protocol. In postrouting nf_ct_bridge_refrag() finds a vlan
> ethertype it cannot fragment, warns and drops the packet:
> 
>  WARNING: net/bridge/netfilter/nf_conntrack_bridge.c:361 at nf_ct_bridge_post
>  Call trace:
>   nf_ct_bridge_post
>   nf_hook_slow
>   br_forward_finish
>   __br_forward
>   deliver_clone
>   br_flood
>   br_handle_frame_finish
>   br_handle_frame
> 
> The warning is the smaller problem. Every fragmented IPv4 or IPv6 packet
> that crosses such a bridge is dropped while unfragmented traffic is fine,
> so it looks like an MTU issue. And anyone who can send fragments into a
> port of such a bridge can trigger the warning, which takes the machine
> down with panic_on_warn.
> 
> Look past the vlan tag in nf_ct_bridge_refrag(): remember it, pull it,
> fragment as before and push it back onto each fragment in
> nf_ct_bridge_frag_restore(), together with the outer protocol, so that
> br_dev_queue_push_xmit() sees the fragments like any other tagged frame.
> The protocol behind the tag comes from the packet, so check it against the
> header before fragmenting.
> 
> Removing the WARN_ON_ONCE() would only hide the problem, the packets would
> still be dropped. Not tracking these frames in nf_ct_bridge_pre() instead
> would change what is tracked today for unfragmented traffic, and would have
> to duplicate the decision that br_allowed_ingress() makes later.

Yes, but let's just fix this by turning this into a
DEBUG_NET_WARN_ON_ONCE(1) and let the packet be dropped.

Then, we can follow up to fill the gap for this feature in in nf-next.

  reply	other threads:[~2026-10-20  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  0:03 [PATCH 0/2] netfilter: bridge: refragment packets with a vlan tag moved by the bridge Laveesh Bansal
2026-10-20  0:54 ` [PATCH 1/2] " Laveesh Bansal
2026-10-20  8:23   ` Pablo Neira Ayuso [this message]
2026-10-20  0:56 ` [PATCH 2/2] selftests: netfilter: add bridge conntrack test for vlan protocol mismatch Laveesh Bansal

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=atck-NoWvemxIsF6@chamomile \
    --to=pablo@netfilter.org \
    --cc=bridge@lists.linux.dev \
    --cc=coreteam@netfilter.org \
    --cc=fw@strlen.de \
    --cc=idosch@nvidia.com \
    --cc=laveeshb@laveeshbansal.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.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