Skip to contentSkip to conversation

bridge: support for per-port mcast_router options

PATCH Applied Joachim Wiberg 2 participants 4 messages Mar 16, 2022 – Mar 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover bridge: support for per-port mcast_router options

Hi,

this patch set adds per bridge port mcast_router option. I.e., the ability to control how IGMP/MLD snooping learns of external routers where both known and unknown multicast should be flooded. Similar functionality per-port and per-vlan setting already exist.

Best regards
/Joachim

Joachim Wiberg (2):
bridge: support for controlling mcast_router per port
man: bridge: document per-port mcast_router settings

 bridge/link.c     | 15 +++++++++++++++
 man/man8/bridge.8 | 15 +++++++++++++++
 2 files changed, 30 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 bridge: support for controlling mcast_router per port

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.

---
 bridge/link.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
bridge/link.c +11 -0
index 80b01f56..3810fa04 100644
@@ -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);
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 man: bridge: document per-port mcast_router settings

In reply to Joachim Wiberg
---
 man/man8/bridge.8 | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
man/man8/bridge.8 +15 -0
index 93852ed8..2fa4f3d6 100644
@@ -47,6 +47,8 @@ bridge \- show / manipulate bridge addresses and devices
 .BR hwmode " { " vepa " | " veb " } ] [ "
 .BR bcast_flood " { " on " | " off " } ] [ "
 .BR mcast_flood " { " on " | " off " } ] [ "
+.BR mcast_router
+.IR MULTICAST_ROUTER " ] ["
 .BR mcast_to_unicast " { " on " | " off " } ] [ "
 .BR neigh_suppress " { " on " | " off " } ] [ "
 .BR vlan_tunnel " { " on " | " off " } ] [ "
@@ -473,6 +475,19 @@ By default this flag is on.
 Controls whether multicast traffic for which there is no MDB entry will be
 flooded towards this given port. By default this flag is on.
 
+.TP
+.BI mcast_router " MULTICAST_ROUTER "
+This flag is almost the same as the per-VLAN flag, see below, except its
+value can only be set in the range 0-2.  The default is
+.B 1
+where the bridge figures out automatically where an IGMP/MLD querier,
+MRDISC capable device, or PIM router, is located.  Setting this flag to
+.B 2
+is useful in cases where the multicast router does not indicate its
+presence in any meaningful way (e.g. older versions of SMCRoute, or
+mrouted), or when there is a need for forwarding both known and unknown
+IP multicast to a secondary/backup router.
+
 .TP
 .BR "mcast_to_unicast on " or " mcast_to_unicast off "
 Controls whether a given port will replicate packets using unicast
Signature · 1 line
2.25.1
#3 lore raw
In reply to Joachim Wiberg
This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 8 lines · On Wed, 16 Mar 2022 10:02:55 +0100 you wrote:

Hi,

this patch set adds per bridge port mcast_router option. I.e., the ability to control how IGMP/MLD snooping learns of external routers where both known and unknown multicast should be flooded. Similar functionality per-port and per-vlan setting already exist.

[...]

Here is the summary with links:
- [iproute2-next,1/2] bridge: support for controlling mcast_router per port

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=9e82e828764a
  - [iproute2-next,2/2] man: bridge: document per-port mcast_router settings
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=e48808692b6d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html