mbox series

[v2,iproute2,0/3] Multiple Spanning Tree (MST) Support

Message ID 20240624130035.3689606-1-tobias@waldekranz.com (mailing list archive)
Headers show
Series Multiple Spanning Tree (MST) Support | expand

Message

Tobias Waldekranz June 24, 2024, 1 p.m. UTC
This series adds support for:

- Enabling MST on a bridge:

      ip link set dev <BR> type bridge mst_enable 1

- (Re)associating VLANs with an MSTI:

      bridge vlan global set dev <BR> vid <X> msti <Y>

- Setting the port state in a given MSTI:

      bridge mst set dev <PORT> msti <Y> state <Z>

- Listing the current port MST states:

      bridge mst show

NOTE: Multiple spanning tree support was added to Linux a couple of
years ago[1], but the corresponding iproute2 patches were never
posted. Mea culpa. Yesterday this was brought to my attention[2],
which is why you are seeing them today.

[1]: https://lore.kernel.org/netdev/20220316150857.2442916-1-tobias@waldekranz.com/
[2]: https://lore.kernel.org/netdev/Zmsc54cVKF1wpzj7@Laptop-X1/

v1 -> v2:
- Require exact match for "mst_enabled" bridge option (Liu)

Tobias Waldekranz (3):
  ip: bridge: add support for mst_enabled
  bridge: vlan: Add support for setting a VLANs MSTI
  bridge: mst: Add get/set support for MST states

 bridge/Makefile       |   2 +-
 bridge/br_common.h    |   1 +
 bridge/bridge.c       |   3 +-
 bridge/mst.c          | 262 ++++++++++++++++++++++++++++++++++++++++++
 bridge/vlan.c         |  13 +++
 ip/iplink_bridge.c    |  19 +++
 man/man8/bridge.8     |  66 ++++++++++-
 man/man8/ip-link.8.in |  14 +++
 8 files changed, 377 insertions(+), 3 deletions(-)
 create mode 100644 bridge/mst.c

Comments

Nikolay Aleksandrov June 26, 2024, 6:11 a.m. UTC | #1
On 24/06/2024 16:00, Tobias Waldekranz wrote:
> This series adds support for:
> 
> - Enabling MST on a bridge:
> 
>       ip link set dev <BR> type bridge mst_enable 1
> 
> - (Re)associating VLANs with an MSTI:
> 
>       bridge vlan global set dev <BR> vid <X> msti <Y>
> 
> - Setting the port state in a given MSTI:
> 
>       bridge mst set dev <PORT> msti <Y> state <Z>
> 
> - Listing the current port MST states:
> 
>       bridge mst show
> 
> NOTE: Multiple spanning tree support was added to Linux a couple of
> years ago[1], but the corresponding iproute2 patches were never
> posted. Mea culpa. Yesterday this was brought to my attention[2],
> which is why you are seeing them today.
> 
> [1]: https://lore.kernel.org/netdev/20220316150857.2442916-1-tobias@waldekranz.com/
> [2]: https://lore.kernel.org/netdev/Zmsc54cVKF1wpzj7@Laptop-X1/
> 
> v1 -> v2:
> - Require exact match for "mst_enabled" bridge option (Liu)
> 
> Tobias Waldekranz (3):
>   ip: bridge: add support for mst_enabled
>   bridge: vlan: Add support for setting a VLANs MSTI
>   bridge: mst: Add get/set support for MST states
> 
>  bridge/Makefile       |   2 +-
>  bridge/br_common.h    |   1 +
>  bridge/bridge.c       |   3 +-
>  bridge/mst.c          | 262 ++++++++++++++++++++++++++++++++++++++++++
>  bridge/vlan.c         |  13 +++
>  ip/iplink_bridge.c    |  19 +++
>  man/man8/bridge.8     |  66 ++++++++++-
>  man/man8/ip-link.8.in |  14 +++
>  8 files changed, 377 insertions(+), 3 deletions(-)
>  create mode 100644 bridge/mst.c
> 

Thanks for posting these, I was also wondering what happened with iproute2 support.
I had to do quick hacks to test my recent mst fixes and I almost missed this set,
please CC bridge maintainers on such changes as well. 

Cheers,
 Nik
Tobias Waldekranz June 26, 2024, 6:33 a.m. UTC | #2
On ons, jun 26, 2024 at 09:11, Nikolay Aleksandrov <razor@blackwall.org> wrote:
> On 24/06/2024 16:00, Tobias Waldekranz wrote:
>> This series adds support for:
>> 
>> - Enabling MST on a bridge:
>> 
>>       ip link set dev <BR> type bridge mst_enable 1
>> 
>> - (Re)associating VLANs with an MSTI:
>> 
>>       bridge vlan global set dev <BR> vid <X> msti <Y>
>> 
>> - Setting the port state in a given MSTI:
>> 
>>       bridge mst set dev <PORT> msti <Y> state <Z>
>> 
>> - Listing the current port MST states:
>> 
>>       bridge mst show
>> 
>> NOTE: Multiple spanning tree support was added to Linux a couple of
>> years ago[1], but the corresponding iproute2 patches were never
>> posted. Mea culpa. Yesterday this was brought to my attention[2],
>> which is why you are seeing them today.
>> 
>> [1]: https://lore.kernel.org/netdev/20220316150857.2442916-1-tobias@waldekranz.com/
>> [2]: https://lore.kernel.org/netdev/Zmsc54cVKF1wpzj7@Laptop-X1/
>> 
>> v1 -> v2:
>> - Require exact match for "mst_enabled" bridge option (Liu)
>> 
>> Tobias Waldekranz (3):
>>   ip: bridge: add support for mst_enabled
>>   bridge: vlan: Add support for setting a VLANs MSTI
>>   bridge: mst: Add get/set support for MST states
>> 
>>  bridge/Makefile       |   2 +-
>>  bridge/br_common.h    |   1 +
>>  bridge/bridge.c       |   3 +-
>>  bridge/mst.c          | 262 ++++++++++++++++++++++++++++++++++++++++++
>>  bridge/vlan.c         |  13 +++
>>  ip/iplink_bridge.c    |  19 +++
>>  man/man8/bridge.8     |  66 ++++++++++-
>>  man/man8/ip-link.8.in |  14 +++
>>  8 files changed, 377 insertions(+), 3 deletions(-)
>>  create mode 100644 bridge/mst.c
>> 
>
> Thanks for posting these, I was also wondering what happened with iproute2 support.
> I had to do quick hacks to test my recent mst fixes and I almost missed this set,
> please CC bridge maintainers on such changes as well. 

Sorry about that, I'll make sure to remember it in the future.

Thanks for reviewing!
Hangbin Liu June 26, 2024, 6:47 a.m. UTC | #3
On Mon, Jun 24, 2024 at 03:00:32PM +0200, Tobias Waldekranz wrote:
> This series adds support for:
> 
> - Enabling MST on a bridge:
> 
>       ip link set dev <BR> type bridge mst_enable 1
> 
> - (Re)associating VLANs with an MSTI:
> 
>       bridge vlan global set dev <BR> vid <X> msti <Y>
> 
> - Setting the port state in a given MSTI:
> 
>       bridge mst set dev <PORT> msti <Y> state <Z>
> 
> - Listing the current port MST states:
> 
>       bridge mst show

Tested-by: Hangbin Liu <liuhangbin@gmail.com>

With following steps:
+ /home/iproute2/ip/ip link add br0 type bridge
+ /home/iproute2/ip/ip link set br0 type bridge mst_enabled 1
+ /home/iproute2/ip/ip link add type veth
+ /home/iproute2/ip/ip link set veth0 master br0
+ /home/iproute2/bridge/bridge vlan add dev br0 vid 1-3 self
+ /home/iproute2/bridge/bridge vlan global set dev br0 vid 2 msti 3
+ /home/iproute2/bridge/bridge vlan add dev veth0 vid 1-3
+ /home/iproute2/bridge/bridge mst set dev veth0 msti 3 state 1
+ /home/iproute2/bridge/bridge mst show
port              msti
veth0             0
                    state disabled
                  3
                    state listening


There is one issue I got (should be kernel issue):

+ /home/iproute2/ip/ip link set br0 type bridge mst_enabled 0
Error: MST mode can't be changed while VLANs exist.

  If I want disable mst, I got failed as there is VLAN info, which is expected

+ /home/iproute2/ip/ip link set veth0 nomaster
+ /home/iproute2/ip/ip link set veth0 master br0
+ /home/iproute2/ip/ip link set br0 type bridge mst_enabled 0
Error: MST mode can't be changed while VLANs exist.

  But I got failed again after remove and re-add veth0, is this expected?
  I thought the VLAN info should be cleared after removing.

+ /home/iproute2/ip/ip link set veth0 nomaster
+ /home/iproute2/ip/ip link set br0 type bridge mst_enabled 0

  It works after I remove veth0.
Nikolay Aleksandrov June 26, 2024, 6:50 a.m. UTC | #4
On 26/06/2024 09:47, Hangbin Liu wrote:
> On Mon, Jun 24, 2024 at 03:00:32PM +0200, Tobias Waldekranz wrote:
>> This series adds support for:
>>
>> - Enabling MST on a bridge:
>>
>>       ip link set dev <BR> type bridge mst_enable 1
>>
>> - (Re)associating VLANs with an MSTI:
>>
>>       bridge vlan global set dev <BR> vid <X> msti <Y>
>>
>> - Setting the port state in a given MSTI:
>>
>>       bridge mst set dev <PORT> msti <Y> state <Z>
>>
>> - Listing the current port MST states:
>>
>>       bridge mst show
> 
> Tested-by: Hangbin Liu <liuhangbin@gmail.com>
> 
> With following steps:
> + /home/iproute2/ip/ip link add br0 type bridge
> + /home/iproute2/ip/ip link set br0 type bridge mst_enabled 1
> + /home/iproute2/ip/ip link add type veth
> + /home/iproute2/ip/ip link set veth0 master br0
> + /home/iproute2/bridge/bridge vlan add dev br0 vid 1-3 self
> + /home/iproute2/bridge/bridge vlan global set dev br0 vid 2 msti 3
> + /home/iproute2/bridge/bridge vlan add dev veth0 vid 1-3
> + /home/iproute2/bridge/bridge mst set dev veth0 msti 3 state 1
> + /home/iproute2/bridge/bridge mst show
> port              msti
> veth0             0
>                     state disabled
>                   3
>                     state listening
> 
> 
> There is one issue I got (should be kernel issue):
> 
> + /home/iproute2/ip/ip link set br0 type bridge mst_enabled 0
> Error: MST mode can't be changed while VLANs exist.
> 
>   If I want disable mst, I got failed as there is VLAN info, which is expected
> 
> + /home/iproute2/ip/ip link set veth0 nomaster
> + /home/iproute2/ip/ip link set veth0 master br0
> + /home/iproute2/ip/ip link set br0 type bridge mst_enabled 0
> Error: MST mode can't be changed while VLANs exist.
> 
>   But I got failed again after remove and re-add veth0, is this expected?
>   I thought the VLAN info should be cleared after removing.
> 

Probably default vlan 1 got added to the port when it was enslaved.

> + /home/iproute2/ip/ip link set veth0 nomaster
> + /home/iproute2/ip/ip link set br0 type bridge mst_enabled 0
> 
>   It works after I remove veth0.
>