Ethernet Bridge development
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Nikolay Aleksandrov <razor@blackwall.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	bridge@lists.linux.dev
Subject: Re: [PATCH net 1/2] net: bridge: vlan: fix vlan range dumps starting with pvid
Date: Wed, 22 Jul 2026 19:51:53 +0300	[thread overview]
Message-ID: <20260722165153.GA3080508@shredder> (raw)
In-Reply-To: <20260721140922.682265-2-razor@blackwall.org>

On Tue, Jul 21, 2026 at 05:09:21PM +0300, Nikolay Aleksandrov wrote:
> There is a bug in all range dumps that rely on br_vlan_can_enter_range()
> when the PVID is a range starting VLAN, all following VLANs that match
> its flags can enter the range, but when the range is filled in only the
> PVID VLAN is dumped and the rest of the range is discarded because
> br_vlan_fill_vids() checks for the PVID flag. Since the PVID VLAN can
> be only one, we need to break ranges around it, the best way to do that
> consistently for all is to alter br_vlan_can_enter_range() to take into
> account the PVID and return false to break the range when it's matched.
> 
> Before the fix:
> $ ip l add br0 type bridge vlan_filtering 1
> $ ip l add dumdum type dummy
> $ ip l set dumdum master br0
> $ ip l set br0 up
> $ ip l set dumdum up
> $ bridge vlan add dev dumdum vid 1 pvid untagged master
> $ bridge vlan add dev dumdum vid 2 untagged master
> $ bridge vlan show dev dumdum # use legacy dump to show all vlans
> port              vlan-id
> dumdum            1 PVID Egress Untagged
>                   2 Egress Untagged
> 
> $ bridge -d vlan show dev dumdum # use the new dump (RTM_GETVLAN)
> port              vlan-id
> dumdum            1 PVID Egress Untagged
>                     state forwarding mcast_router 1
> 
> VLAN 2 is missing, and if there are more matching VLANs afterwards
> they'd be missing too.
> 
> After the fix:
> [ same setup steps ]
> $ bridge vlan show dev dumdum
> port              vlan-id
> dumdum            1 PVID Egress Untagged
>                   2 Egress Untagged
> $ bridge -d vlan show dev dumdum # use the new dump (RTM_GETVLAN)
> port              vlan-id
> dumdum            1 PVID Egress Untagged
>                     state forwarding mcast_router 1
>                   2 Egress Untagged
>                     state forwarding mcast_router 1
> 
> Fixes: 0ab558795184 ("net: bridge: vlan: add rtm range support")
> Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

  reply	other threads:[~2026-07-22 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 14:09 [PATCH net 0/2] net: bridge: fix vlan range dumps starting with a PVID Nikolay Aleksandrov
2026-07-21 14:09 ` [PATCH net 1/2] net: bridge: vlan: fix vlan range dumps starting with pvid Nikolay Aleksandrov
2026-07-22 16:51   ` Ido Schimmel [this message]
2026-07-21 14:09 ` [PATCH net 2/2] selftests: net: bridge: test ranges with PVID VLAN Nikolay Aleksandrov
2026-07-22 16:52   ` Ido Schimmel
2026-07-22 18:10 ` [PATCH net 0/2] net: bridge: fix vlan range dumps starting with a PVID patchwork-bot+netdevbpf

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=20260722165153.GA3080508@shredder \
    --to=idosch@nvidia.com \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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