diff mbox series

[iproute2-next,1/2] bridge: support for controlling mcast_router per port

Message ID 20220316090257.3531111-2-troglobit@gmail.com (mailing list archive)
State Accepted
Commit 9e82e828764aa1c0303697164883fc355e9310b8
Delegated to: David Ahern
Headers show
Series bridge: support for per-port mcast_router options | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Joachim Wiberg March 16, 2022, 9:02 a.m. UTC
The bridge vlan command supports setting mcast_router per-port and
per-vlan, what's however missing is the ability to set the per-port
mcast_router options, e.g. when VLAN filtering is disabled.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
 bridge/link.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/bridge/link.c b/bridge/link.c
index 80b01f56..3810fa04 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -156,6 +156,9 @@  static void print_protinfo(FILE *fp, struct rtattr *attr)
 		if (prtb[IFLA_BRPORT_BCAST_FLOOD])
 			print_on_off(PRINT_ANY, "bcast_flood", "bcast_flood %s ",
 				     rta_getattr_u8(prtb[IFLA_BRPORT_BCAST_FLOOD]));
+		if (prtb[IFLA_BRPORT_MULTICAST_ROUTER])
+			print_uint(PRINT_ANY, "mcast_router", "mcast_router %u ",
+				   rta_getattr_u8(prtb[IFLA_BRPORT_MULTICAST_ROUTER]));
 		if (prtb[IFLA_BRPORT_MCAST_TO_UCAST])
 			print_on_off(PRINT_ANY, "mcast_to_unicast", "mcast_to_unicast %s ",
 				     rta_getattr_u8(prtb[IFLA_BRPORT_MCAST_TO_UCAST]));
@@ -270,6 +273,7 @@  static void usage(void)
 		"                               [ learning {on | off} ]\n"
 		"                               [ learning_sync {on | off} ]\n"
 		"                               [ flood {on | off} ]\n"
+		"                               [ mcast_router MULTICAST_ROUTER ]\n"
 		"                               [ mcast_flood {on | off} ]\n"
 		"                               [ bcast_flood {on | off} ]\n"
 		"                               [ mcast_to_unicast {on | off} ]\n"
@@ -303,6 +307,7 @@  static int brlink_modify(int argc, char **argv)
 	__s8 learning_sync = -1;
 	__s8 flood = -1;
 	__s8 vlan_tunnel = -1;
+	__s8 mcast_router = -1;
 	__s8 mcast_flood = -1;
 	__s8 bcast_flood = -1;
 	__s8 mcast_to_unicast = -1;
@@ -359,6 +364,9 @@  static int brlink_modify(int argc, char **argv)
 			flood = parse_on_off("flood", *argv, &ret);
 			if (ret)
 				return ret;
+		} else if (strcmp(*argv, "mcast_router") == 0) {
+			NEXT_ARG();
+			mcast_router = atoi(*argv);
 		} else if (strcmp(*argv, "mcast_flood") == 0) {
 			NEXT_ARG();
 			mcast_flood = parse_on_off("mcast_flood", *argv, &ret);
@@ -473,6 +481,9 @@  static int brlink_modify(int argc, char **argv)
 		addattr8(&req.n, sizeof(req), IFLA_BRPORT_PROTECT, root_block);
 	if (flood >= 0)
 		addattr8(&req.n, sizeof(req), IFLA_BRPORT_UNICAST_FLOOD, flood);
+	if (mcast_router >= 0)
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_MULTICAST_ROUTER,
+			 mcast_router);
 	if (mcast_flood >= 0)
 		addattr8(&req.n, sizeof(req), IFLA_BRPORT_MCAST_FLOOD,
 			 mcast_flood);