Re: [PATCH iproute2-next] iplink: bridge: add stp_mode support

Stephen Hemminger <[email protected]> Mon, 18 May 2026 15:10:50 -0700
Newsgroups dev.linux.lists.bridge,org.kernel.vger.netdev
Message-ID <[email protected]>
On Mon, 18 May 2026 09:36:47 -0700
Andy Roulin <[email protected]> wrote:

> +		} 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);

Not your fault but yet another case where matches() was bad idea
because if you pass "stp" it matches only stp_state.

Really should fix all of iproute2 to use a table approach and
not allow conflicting matches, but that is a lot of work,
and will break peoples scripts.