On 5/18/26 10:36 AM, Andy Roulin wrote:
> diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
> index df3264c3..d15221b2 100644
> --- a/ip/iplink_bridge.c
> +++ b/ip/iplink_bridge.c
> @@ -120,6 +122,20 @@ static int bridge_parse_opt(struct link_util *lu, int
> argc, char **argv,
> invarg("invalid stp_state", *argv);
>
> addattr32(n, 1024, IFLA_BR_STP_STATE, val);
> + } else if (strcmp(*argv, "stp_mode") == 0) {
> + __u32 stp_mode;
> +
> + NEXT_ARG();
> + if (strcmp(*argv, "auto") == 0)
> + stp_mode = BR_STP_MODE_AUTO;
> + else if (strcmp(*argv, "user") == 0)
> + stp_mode = BR_STP_MODE_USER;
> + else if (strcmp(*argv, "kernel") == 0)
> + stp_mode = BR_STP_MODE_KERNEL;
> + else if (get_u32(&stp_mode, *argv, 0))
> + invarg("invalid stp_mode", *argv);
> +
> + addattr32(n, 1024, IFLA_BR_STP_MODE, stp_mode);
> } else if (matches(*argv, "priority") == 0) {
> __u16 prio;
>
> @@ -512,6 +528,20 @@ static void bridge_print_opt(struct link_util *lu, FILE
> *f, struct rtattr *tb[])
> "stp_state %u ",
> rta_getattr_u32(tb[IFLA_BR_STP_STATE]));
>
> + if (tb[IFLA_BR_STP_MODE]) {
> + static const char *stp_modes[] = {
> + "auto", "user", "kernel"
> + };
Make this a single table used for both set and show.
> + __u32 mode = rta_getattr_u32(tb[IFLA_BR_STP_MODE]);
> +
> + if (mode < ARRAY_SIZE(stp_modes))
> + print_string(PRINT_ANY, "stp_mode",
> + "stp_mode %s ", stp_modes[mode]);
> + else
> + print_uint(PRINT_ANY, "stp_mode",
> + "stp_mode %u ", mode);
> + }
> +
> if (tb[IFLA_BR_PRIORITY])
> print_uint(PRINT_ANY,
> "priority",