Skip to contentSkip to conversation

batctl: add switch for setting multicast_fanout

PATCH New Linus Lüssing 1 participant 1 message Feb 15, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 batctl: add switch for setting multicast_fanout

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

---
Changelog v2:

* fixed README.rst title
* disabled sysfs_name
* added BATADV_ATTR_MULTICAST_FANOUT to event monitor
* added BATADV_ATTR_MULTICAST_FANOUT to batadv_netlink_policy
* changed multicast_fanout order in Makefile

---
 Makefile           |   1 +
 README.rst         |  10 +++++
 batman_adv.h       |   7 ++++
 event.c            |   4 ++
 man/batctl.8       |   5 +++
 multicast_fanout.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 netlink.c          |   1 +
 7 files changed, 143 insertions(+)
 create mode 100644 multicast_fanout.c
Makefile +1 -0
index 4d8b709..7c0cbf1 100755
@@ -68,6 +68,7 @@ $(eval $(call add_command,isolation_mark,y))
 $(eval $(call add_command,log,y))
 $(eval $(call add_command,loglevel,y))
 $(eval $(call add_command,mcast_flags,y))
+$(eval $(call add_command,multicast_fanout,y))
 $(eval $(call add_command,multicast_mode,y))
 $(eval $(call add_command,nc_nodes,y))
 $(eval $(call add_command,neighbors,y))
README.rst +10 -0
index 4c0f544..19dcc02 100644
@@ -478,6 +478,16 @@ Usage::
   batctl multicast_mode|mm [0|1]
 
 
+batctl multicast_fanout
+=======================
+
+display or modify the multicast fanout setting
+
+Usage::
+
+  batctl multicast_fanout|mo [fanout]
+
+
 batctl mcast_flags
 ==================
 
batman_adv.h +7 -0
index 9b12d2a..2f956e6 100644
@@ -491,6 +491,13 @@ enum batadv_nl_attrs {
 	 */
 	BATADV_ATTR_THROUGHPUT_OVERRIDE,
 
+	/**
+	 * @BATADV_ATTR_MULTICAST_FANOUT: defines the maximum number of packet
+	 * copies that may be generated for a multicast-to-unicast conversion.
+	 * Once this limit is exceeded distribution will fall back to broadcast.
+	 */
+	BATADV_ATTR_MULTICAST_FANOUT,
+
 	/* add attributes above here, update the policy in netlink.c */
 
 	/**
event.c +4 -0
index 62ccf56..8fab5ae 100644
@@ -284,6 +284,10 @@ static void event_parse_set_mesh(struct nlattr **attrs)
 		printf("* log_level 0x%08x\n",
 		       nla_get_u32(attrs[BATADV_ATTR_LOG_LEVEL]));
 
+	if (attrs[BATADV_ATTR_MULTICAST_FANOUT])
+		printf("* multicast_fanout %u\n",
+		       nla_get_u32(attrs[BATADV_ATTR_MULTICAST_FANOUT]));
+
 	if (attrs[BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED])
 		printf("* multicast_forceflood %s\n",
 		       u8_to_boolstr(attrs[BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED]));
man/batctl.8 +5 -0
index ed8e71f..92c0e32 100644
@@ -105,6 +105,11 @@ disable network coding.
 If no parameter is given the current multicast mode setting is displayed. Otherwise the parameter is used to enable or
 disable multicast optimizations (i.e. disabling means always sending own multicast frames via classic flooding).
 .br
+.IP "\fBmulticast_fanout\fP|\fBmo\fP [\fBfanout\fP]"
+If no parameter is given the current multicast fanout setting is displayed. Otherwise the parameter is used to set
+the multicast fanout. The multicast fanout defines the maximum number of packet copies that may be generated for a
+multicast-to-unicast conversion. Once this limit is exceeded distribution will fall back to broadcast.
+.br
 .IP "\fBloglevel\fP|\fBll\fP [\fBlevel\fP[ \fBlevel\fP[ \fBlevel\fP]] \fB...\fP]"
 If no parameter is given the current log level settings are displayed otherwise the parameter(s) is/are used to set the log
 level. Level 'none' disables all verbose logging. Level 'batman' enables messages related to routing / flooding / broadcasting.
multicast_fanout.c new file +115 -0

115 lines not on this page · raw message

netlink.c +1 -0
index 5b9966c..49673a8 100644
@@ -123,6 +123,7 @@ struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = {
 	[BATADV_ATTR_HOP_PENALTY]		= { .type = NLA_U8 },
 	[BATADV_ATTR_LOG_LEVEL]			= { .type = NLA_U32 },
 	[BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED]	= { .type = NLA_U8 },
+	[BATADV_ATTR_MULTICAST_FANOUT]		= { .type = NLA_U32 },
 	[BATADV_ATTR_NETWORK_CODING_ENABLED]	= { .type = NLA_U8 },
 	[BATADV_ATTR_ORIG_INTERVAL]		= { .type = NLA_U32 },
 	[BATADV_ATTR_ELP_INTERVAL]		= { .type = NLA_U32 },
Signature · 1 line
2.11.0