diff mbox series

[v2,iproute2,2/3] bridge: vlan: Add support for setting a VLANs MSTI

Message ID 20240624130035.3689606-3-tobias@waldekranz.com (mailing list archive)
State Superseded
Delegated to: Stephen Hemminger
Headers show
Series Multiple Spanning Tree (MST) Support | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Tobias Waldekranz June 24, 2024, 1 p.m. UTC
Allow the user to associate one or more VLANs with a multiple spanning
tree instance (MSTI), when MST is enabled on the bridge.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 bridge/vlan.c     | 13 +++++++++++++
 man/man8/bridge.8 |  9 ++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

Comments

Hangbin Liu June 26, 2024, 2:08 a.m. UTC | #1
On Mon, Jun 24, 2024 at 03:00:34PM +0200, Tobias Waldekranz wrote:
> Allow the user to associate one or more VLANs with a multiple spanning
> tree instance (MSTI), when MST is enabled on the bridge.
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---
>  bridge/vlan.c     | 13 +++++++++++++
>  man/man8/bridge.8 |  9 ++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/bridge/vlan.c b/bridge/vlan.c
> index 0a7e6c45..34d7f767 100644
> --- a/bridge/vlan.c
> +++ b/bridge/vlan.c
> @@ -56,6 +56,7 @@ static void usage(void)
>  		"                      [ mcast_querier_interval QUERIER_INTERVAL ]\n"
>  		"                      [ mcast_query_interval QUERY_INTERVAL ]\n"
>  		"                      [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n"
> +		"                      [ msti MSTI ]\n"
>  		"       bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n");
>  	exit(-1);
>  }
> @@ -406,6 +407,7 @@ static int vlan_global_option_set(int argc, char **argv)
>  	short vid = -1;
>  	__u64 val64;
>  	__u32 val32;
> +	__u16 val16;
>  	__u8 val8;
>  
>  	afspec = addattr_nest(&req.n, sizeof(req),
> @@ -536,6 +538,12 @@ static int vlan_global_option_set(int argc, char **argv)
>  			addattr64(&req.n, 1024,
>  				  BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL,
>  				  val64);
> +		} else if (strcmp(*argv, "msti") == 0) {
> +			NEXT_ARG();
> +			if (get_u16(&val16, *argv, 0))
> +				invarg("invalid msti", *argv);
> +			addattr16(&req.n, 1024,
> +				 BRIDGE_VLANDB_GOPTS_MSTI, val16);
>  		} else {
>  			if (strcmp(*argv, "help") == 0)
>  				NEXT_ARG();
> @@ -945,6 +953,11 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex)
>  			     "mcast_query_response_interval %llu ",
>  			     rta_getattr_u64(vattr));
>  	}
> +	if (vtb[BRIDGE_VLANDB_GOPTS_MSTI]) {
> +		vattr = vtb[BRIDGE_VLANDB_GOPTS_MSTI];
> +		print_uint(PRINT_ANY, "msti", "msti %u ",
> +			   rta_getattr_u16(vattr));
> +	}
>  	print_nl();
>  	if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS]) {
>  		vattr = RTA_DATA(vtb[BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS]);
> diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
> index bb02bd27..b4699801 100644
> --- a/man/man8/bridge.8
> +++ b/man/man8/bridge.8
> @@ -266,7 +266,9 @@ bridge \- show / manipulate bridge addresses and devices
>  .B mcast_query_interval
>  .IR QUERY_INTERVAL " ] [ "
>  .B mcast_query_response_interval
> -.IR QUERY_RESPONSE_INTERVAL " ]"
> +.IR QUERY_RESPONSE_INTERVAL " ] [ "
> +.B msti
> +.IR MSTI " ]"
>  
>  .ti -8
>  .BR "bridge vlan global" " [ " show " ] [ "
> @@ -1493,6 +1495,11 @@ startup phase.
>  set the Max Response Time/Maximum Response Delay for IGMP/MLD
>  queries sent by the bridge.
>  
> +.TP
> +.BI msti " MSTI "
> +associate the VLAN with the specified multiple spanning tree instance
> +(MSTI).
> +
>  .SS bridge vlan global show - list global vlan options.
>  
>  This command displays the global VLAN options for each VLAN entry.
> -- 
> 2.34.1
> 

Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Nikolay Aleksandrov June 26, 2024, 6:12 a.m. UTC | #2
On 24/06/2024 16:00, Tobias Waldekranz wrote:
> Allow the user to associate one or more VLANs with a multiple spanning
> tree instance (MSTI), when MST is enabled on the bridge.
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---
>  bridge/vlan.c     | 13 +++++++++++++
>  man/man8/bridge.8 |  9 ++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 

Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
diff mbox series

Patch

diff --git a/bridge/vlan.c b/bridge/vlan.c
index 0a7e6c45..34d7f767 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -56,6 +56,7 @@  static void usage(void)
 		"                      [ mcast_querier_interval QUERIER_INTERVAL ]\n"
 		"                      [ mcast_query_interval QUERY_INTERVAL ]\n"
 		"                      [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n"
+		"                      [ msti MSTI ]\n"
 		"       bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n");
 	exit(-1);
 }
@@ -406,6 +407,7 @@  static int vlan_global_option_set(int argc, char **argv)
 	short vid = -1;
 	__u64 val64;
 	__u32 val32;
+	__u16 val16;
 	__u8 val8;
 
 	afspec = addattr_nest(&req.n, sizeof(req),
@@ -536,6 +538,12 @@  static int vlan_global_option_set(int argc, char **argv)
 			addattr64(&req.n, 1024,
 				  BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL,
 				  val64);
+		} else if (strcmp(*argv, "msti") == 0) {
+			NEXT_ARG();
+			if (get_u16(&val16, *argv, 0))
+				invarg("invalid msti", *argv);
+			addattr16(&req.n, 1024,
+				 BRIDGE_VLANDB_GOPTS_MSTI, val16);
 		} else {
 			if (strcmp(*argv, "help") == 0)
 				NEXT_ARG();
@@ -945,6 +953,11 @@  static void print_vlan_global_opts(struct rtattr *a, int ifindex)
 			     "mcast_query_response_interval %llu ",
 			     rta_getattr_u64(vattr));
 	}
+	if (vtb[BRIDGE_VLANDB_GOPTS_MSTI]) {
+		vattr = vtb[BRIDGE_VLANDB_GOPTS_MSTI];
+		print_uint(PRINT_ANY, "msti", "msti %u ",
+			   rta_getattr_u16(vattr));
+	}
 	print_nl();
 	if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS]) {
 		vattr = RTA_DATA(vtb[BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS]);
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index bb02bd27..b4699801 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -266,7 +266,9 @@  bridge \- show / manipulate bridge addresses and devices
 .B mcast_query_interval
 .IR QUERY_INTERVAL " ] [ "
 .B mcast_query_response_interval
-.IR QUERY_RESPONSE_INTERVAL " ]"
+.IR QUERY_RESPONSE_INTERVAL " ] [ "
+.B msti
+.IR MSTI " ]"
 
 .ti -8
 .BR "bridge vlan global" " [ " show " ] [ "
@@ -1493,6 +1495,11 @@  startup phase.
 set the Max Response Time/Maximum Response Delay for IGMP/MLD
 queries sent by the bridge.
 
+.TP
+.BI msti " MSTI "
+associate the VLAN with the specified multiple spanning tree instance
+(MSTI).
+
 .SS bridge vlan global show - list global vlan options.
 
 This command displays the global VLAN options for each VLAN entry.