From: Tobias Waldekranz <tobias@waldekranz.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
davem@davemloft.net, kuba@kernel.org
Cc: andrew@lunn.ch, vivien.didelot@gmail.com, olteanv@gmail.com,
netdev@vger.kernel.org
Subject: Re: [RFC net] net: dsa: Centralize validation of VLAN configuration
Date: Tue, 09 Mar 2021 22:28:11 +0100 [thread overview]
Message-ID: <87h7lkow44.fsf@waldekranz.com> (raw)
In-Reply-To: <699042d3-e124-7584-6486-02a6fb45423e@gmail.com>
On Tue, Mar 09, 2021 at 12:40, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 3/9/21 10:42 AM, Tobias Waldekranz wrote:
>> There are three kinds of events that have an inpact on VLAN
>> configuration of DSA ports:
>>
>> - Adding of stacked VLANs
>> (ip link add dev swp0.1 link swp0 type vlan id 1)
>>
>> - Adding of bridged VLANs
>> (bridge vlan add dev swp0 vid 1)
>>
>> - Changes to a bridge's VLAN filtering setting
>> (ip link set dev br0 type bridge vlan_filtering 1)
>>
>> For all of these events, we want to ensure that some invariants are
>> upheld:
>>
>> - For hardware where VLAN filtering is a global setting, either all
>> bridges must use VLAN filtering, or no bridge can.
>
> I suppose that is true, given that a non-VLAN filtering bridge must not
> perform ingress VID checking, OK.
>
>>
>> - For all filtering bridges, no stacked VLAN on any port may be
>> configured on multiple ports.
>
> You need to qualify multiple ports a bit more here, are you saying
> multiple ports that are part of said bridge, or?
Yeah sorry, I can imagine that makes no sense whatsoever without the
context of the recent discussions. It is basically guarding against this
situation:
.100 br0 .100
\ / \ /
lan0 lan1
$ ip link add dev br0 type bridge vlan_filtering 1
$ ip link add dev lan0.100 link lan0 type vlan id 100
$ ip link add dev lan1.100 link lan1 type vlan id 100
$ ip link set dev lan0 master br0
$ ip link set dev lan1 master br0 # This should fail
>> - For all filtering bridges, no stacked VLAN may be configured in the
>> bridge.
>
> Being stacked in the bridge does not really compute for me, you mean, no
> VLAN upper must be configured on the bridge master device(s)? Why would
> that be a problem though?
Again sorry, I relize that this message needs a lot of work. It guards
against this scenario:
.100 br0
\ / \
lan0 lan1
$ ip link add dev br0 type bridge vlan_filtering 1
$ ip link add dev lan0.100 link lan0 type vlan id 100
$ ip link set dev lan0 master br0
$ ip link set dev lan1 master br0
$ bridge vlan add dev lan1 vid 100 # This should fail
>> Move the validation of these invariants to a central function, and use
>> it from all sites where these events are handled. This way, we ensure
>> that all invariants are always checked, avoiding certain configs being
>> allowed or disallowed depending on the order in which commands are
>> given.
>>
>> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
>> ---
>>
>> There is still testing left to do on this, but I wanted to send early
>> in order show what I meant by "generic" VLAN validation in this
>> discussion:
>>
>> https://lore.kernel.org/netdev/87mtvdp97q.fsf@waldekranz.com/
>>
>> This is basically an alternative implementation of 1/4 and 2/4 from
>> this series by Vladimir:
>>
>> https://lore.kernel.org/netdev/20210309021657.3639745-1-olteanv@gmail.com/
>
> I really have not been able to keep up with your discussion, and I am
> not sure if I will given how quickly you guys can spin patches (not a
> criticism, this is welcome).
Yeah I know, it has been a bit of a whirlwind.
Maybe I should just have posted this inline in the other thread, since
it was mostly to show Vladimir my idea, and it seemed easier to write it
in C than in English :)
next prev parent reply other threads:[~2021-03-09 21:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 18:42 [RFC net] net: dsa: Centralize validation of VLAN configuration Tobias Waldekranz
2021-03-09 20:40 ` Florian Fainelli
2021-03-09 21:28 ` Tobias Waldekranz [this message]
2021-03-09 22:01 ` Vladimir Oltean
2021-03-10 0:36 ` Andrew Lunn
2021-03-14 21:40 ` Tobias Waldekranz
2021-03-15 9:29 ` Vladimir Oltean
2021-03-10 0:30 ` Andrew Lunn
2021-03-10 0:51 ` Vladimir Oltean
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=87h7lkow44.fsf@waldekranz.com \
--to=tobias@waldekranz.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.