Skip to contentSkip to conversation

batctl: Add noflood_mark command

PATCH New Linus Lüssing 1 participant 1 message May 7, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 batctl: Add noflood_mark command

Adds support for the new 'noflood_mark' setting in batman-adv.

---
Changelog v3:
* changed command from a noflood tri-state option to a value/mask one similar to the isolation mark
* noflood.c -> noflood_mark.c

Changelog v2:
* added noflood.c

---
 Makefile       |   1 +
 README.rst     |  15 ++++++
 batman_adv.h   |  12 +++++
 man/batctl.8   |  23 ++++++++
 noflood_mark.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 192 insertions(+)
 create mode 100644 noflood_mark.c
Makefile +1 -0
index b7bd545..18f874c 100755
@@ -60,6 +60,7 @@ $(eval $(call add_command,multicast_mode,y))
 $(eval $(call add_command,nc_nodes,y))
 $(eval $(call add_command,neighbors,y))
 $(eval $(call add_command,network_coding,y))
+$(eval $(call add_command,noflood_mark,y))
 $(eval $(call add_command,orig_interval,y))
 $(eval $(call add_command,originators,y))
 $(eval $(call add_command,ping,y))
README.rst +15 -0
index bc54412..c025c30 100644
@@ -549,6 +549,21 @@ Usage::
 * Example 4: ``batctl mark 0x0f``
 
 
+batctl noflood_mark
+=======================
+
+display or modify noflood_mark setting
+
+Usage::
+
+  batctl noflood_mark|nf $value[/0x$mask]
+
+* Example 1: ``batctl nf 0x00000001/0xffffffff``
+* Example 2: ``batctl nf 0x00040000/0xffff0000``
+* Example 3: ``batctl nf 16``
+* Example 4: ``batctl nf 0x0f``
+
+
 batctl translocal
 =================
 
batman_adv.h +12 -0
index 67f4636..6fabb7a 100644
@@ -480,6 +480,18 @@ enum batadv_nl_attrs {
 	 */
 	BATADV_ATTR_MULTICAST_FANOUT,
 
+	/**
+	 * @BATADV_ATTR_NOFLOOD_MARK: the noflood mark which allows to tag
+	 *  frames which should never be broadcast flooded through the mesh.
+	 */
+	BATADV_ATTR_NOFLOOD_MARK,
+
+	/**
+	 * @BATADV_ATTR_NOFLOOD_MASK: the noflood (bit)mask which allows to tag
+	 *  frames which should never be broadcast flooded through the mesh.
+	 */
+	BATADV_ATTR_NOFLOOD_MASK,
+
 	/* add attributes above here, update the policy in netlink.c */
 
 	/**
man/batctl.8 +23 -0
index 0b43031..4173137 100644
@@ -116,6 +116,29 @@ If no parameter is given the current multicast fanout setting is displayed. Othe
 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 "\fBnoflood_mark\fP|\fBnf\fP"
+If no parameter is given the current noflood mark value is displayed.
+Otherwise the parameter is used to set or unset the noflood mark. The
+noflood mark allows to prevent broadcast flooding of a frame which
+was previously tagged via netfilter for instance. batman-adv will
+then only forward a frame into the mesh if destined to a limited
+number of destination nodes and drop the frame otherwise.
+.br
+The input is supposed to be of the form $value/$mask, where $value can be any
+32bit long integer (expressed in decimal or hex base) and $mask is a generic
+bitmask (expressed in hex base) that selects the bits to take into consideration
+from $value. It is also possible to enter the input using only $value and in
+this case the full bitmask is used by default.
+
+.br
+.br
+Example 1: 0x00000001/0xffffffff
+.br
+Example 2: 0x00040000/0xffff0000
+.br
+Example 3: 16 or 0x0F
+.br
+.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.
noflood_mark.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.20.1