Skip to contentSkip to conversation

batctl: add switch for setting multicast_mld_rtr_only

PATCH New Linus Lüssing 1 participant 1 message Aug 31, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batctl: add switch for setting multicast_mld_rtr_only

This patch adds an option for the new multicast_mld_rtr_only setting in batman-adv.

---
 Makefile                 |  1 +
 README.rst               | 10 +++++
 batman_adv.h             |  9 +++++
 event.c                  |  4 ++
 man/batctl.8             | 18 +++++++++
 multicast_mld_rtr_only.c | 83 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 125 insertions(+)
 create mode 100644 multicast_mld_rtr_only.c
Makefile +1 -0
index c1212c444971..9e6f535c7816 100755
@@ -66,6 +66,7 @@ $(eval $(call add_command,mesh_json,y))
 $(eval $(call add_command,multicast_fanout,y))
 $(eval $(call add_command,multicast_forceflood,y))
 $(eval $(call add_command,multicast_mode,y))
+$(eval $(call add_command,multicast_mld_rtr_only,y))
 $(eval $(call add_command,neighbors,y))
 $(eval $(call add_command,neighbors_json,y))
 $(eval $(call add_command,network_coding,y))
README.rst +10 -0
index 3495fba02e0e..63b16b0f66af 100644
@@ -669,6 +669,16 @@ Usage::
   batctl multicast_forceflood|mff [0|1]
 
 
+batctl multicast_mld_rtr_only
+-----------------------------
+
+display or modify the multicast MLD router only setting
+
+Usage::
+
+  batctl multicast_mld_rtr_only|mro [0|1]
+
+
 batctl network_coding
 ---------------------
 
batman_adv.h +9 -0
index 35dc016c9bb4..11cd170036ff 100644
@@ -481,6 +481,15 @@ enum batadv_nl_attrs {
 	 */
 	BATADV_ATTR_MULTICAST_FANOUT,
 
+	/**
+	 * @BATADV_ATTR_MULTICAST_MLD_RTR_ONLY_ENABLED: defines how IGMP/MLD
+	 * reports are forwarded in the mesh. If set to non-zero then IGMP/MLD
+	 * reports are only forwarded to detected multicast routers. If set to
+	 * zero then they are flooded instead.
+	 * Warning: The former is experimental and potentially unsafe!
+	 */
+	BATADV_ATTR_MULTICAST_MLD_RTR_ONLY_ENABLED,
+
 	/* add attributes above here, update the policy in netlink.c */
 
 	/**
event.c +4 -0
index 274f99fcb65a..14700ea57ae0 100644
@@ -283,6 +283,10 @@ static void event_parse_set_mesh(struct nlattr **attrs)
 		printf("* multicast_forceflood %s\n",
 		       u8_to_boolstr(attrs[BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED]));
 
+	if (attrs[BATADV_ATTR_MULTICAST_MLD_RTR_ONLY_ENABLED])
+		printf("* multicast_forceflood %s\n",
+		       u8_to_boolstr(attrs[BATADV_ATTR_MULTICAST_MLD_RTR_ONLY_ENABLED]));
+
 	if (attrs[BATADV_ATTR_NETWORK_CODING_ENABLED])
 		printf("* network_coding %s\n",
 		       u8_to_boolstr(attrs[BATADV_ATTR_NETWORK_CODING_ENABLED]));
man/batctl.8 +18 -0
index b5be0b801708..9d830907ac7f 100644
@@ -341,6 +341,24 @@ disable multicast forceflood. This setting defines whether multicast optimizatio
 flooding of multicast packets. If set to non-zero then all nodes in the mesh are going to use classic flooding for any
 multicast packet with no optimizations.
 .TP
+[\fBmeshif\fP \fInetdev\fP] \fBmulticast_mld_rtr_only\fP|\fBmro\fP [\fI0\fP|\fI1\fP]
+If no parameter is given the current multicast MLD router only setting is displayed. Otherwise the parameter is used to
+set the IGMP/MLD report forwarding behaviour. If enabled then MLD reports are forwarded to detected multicast routers only.
+If disabled then they are flooded instead.
+
+.br
+.br
+Warning: Enabling this is experimental and potentially unsafe!
+
+.br
+.br
+If the IGMP/MLD querier is configured directly on the bridge on top of
+bat0. But there is no multicast router on or behind this node. Then this
+bridge will be unable to detect multicast listeners on/behind other
+nodes which have the MLD-RTR-ONLY setting enabled. (A workaround for this
+can then in turn be to set multicast_router=2 on the bat0 bridge port
+on the node with the IGMP/MLD querier.)
+.TP
 [\fBmeshif\fP \fInetdev\fP] \fBnetwork_coding\fP|\fBnc\fP [\fI0\fP|\fI1\fP]
 If no parameter is given the current network coding mode setting is displayed. Otherwise the parameter is used to enable or
 disable network coding.
multicast_mld_rtr_only.c new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
2.45.2