Re: [PATCH iproute2-next v2] iplink: bridge: add stp_mode support
Nikolay Aleksandrov <[email protected]> Wed, 3 Jun 2026 20:41:06 +0300
| Newsgroups | dev.linux.lists.bridge,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
On 03/06/2026 20:33, Andy Roulin wrote: > Add support for the IFLA_BR_STP_MODE bridge attribute that allows > userspace to explicitly select the STP mode: > > - auto (0): default, try /sbin/bridge-stp helper in init_net > - user (1): directly enable userspace STP without the helper, > works in any network namespace > - kernel (2): directly enable kernel STP without the helper > > A shared file-scope stp_modes[] table indexed by BR_STP_MODE_* drives > both directions: parsing uses parse_one_of(), printing goes through a > stp_mode_to_str() helper that returns "(unknown)" for modes not yet > known to iproute2, keeping the JSON type of stp_mode consistently a > string. > > Example usage: > ip link set br0 type bridge stp_mode user > ip link set br0 type bridge stp_state 1 > > Link: https://lore.kernel.org/netdev/[email protected]/ > Assisted-by: Claude:claude-opus-4-7 > Reviewed-by: Ido Schimmel <[email protected]> > Signed-off-by: Andy Roulin <[email protected]> > --- > > Notes: > v2: > * Use a single file-scope stp_modes[] table indexed by > BR_STP_MODE_* for both parse and show, instead of an ad-hoc > strcmp ladder in parse and a separate local table in show > (David Ahern). > * Switch parsing to the shared parse_one_of() helper. Drop the > fallback that accepted numeric values on the parse side. > * Print path always returns a string: keep the JSON type of > stp_mode stable and fall back to "(unknown)" for unrecognized > values via a stp_mode_to_str() helper matching the style of > validate_to_str() in ip/ipmacsec.c (Ido Schimmel). > > v1: https://lore.kernel.org/netdev/[email protected]/ > > ip/iplink_bridge.c | 33 +++++++++++++++++++++++++++++++++ > man/man8/ip-link.8.in | 32 ++++++++++++++++++++++++++++++++ > 2 files changed, 65 insertions(+) > Reviewed-by: Nikolay Aleksandrov <[email protected]>