b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode
@ 2014-03-11 20:04 Linus Lüssing
  2014-03-11 20:04 ` [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output Linus Lüssing
  2014-03-12  4:16 ` [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode Marek Lindner
  0 siblings, 2 replies; 8+ messages in thread
From: Linus Lüssing @ 2014-03-11 20:04 UTC (permalink / raw)
  To: b.a.t.m.a.n

This patch adds a switch for the new multicast_mode setting in
batman-adv.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
v3: fix merge conflict
    (ordex was quicker with his isolation mark support patch :P)

 README       |    7 +++++++
 man/batctl.8 |    4 ++++
 sys.c        |    6 ++++++
 sys.h        |    1 +
 4 files changed, 18 insertions(+)

diff --git a/README b/README
index a4507b7..fe8eed9 100644
--- a/README
+++ b/README
@@ -392,6 +392,13 @@ Usage: batctl network_coding|nc [0|1]
 
 Note that network coding requires a working promiscuous mode on all interfaces.
 
+batctl multicast_mode
+=====================
+
+display or modify the multicast mode setting
+
+Usage: batctl multicast_mode|mm [0|1]
+
 batctl aggregation
 ==================
 
diff --git a/man/batctl.8 b/man/batctl.8
index b808293..f92bf3a 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -88,6 +88,10 @@ disable fragmentation.
 If no parameter is given the current network coding mode setting is displayed. Otherwise the parameter is used to enable or
 disable network coding.
 .br
+.IP "\fBmulticast_mode\fP|\fBmm\fP [\fB0\fP|\fB1\fP]"
+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 "\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.
diff --git a/sys.c b/sys.c
index fd6e107..d20696b 100644
--- a/sys.c
+++ b/sys.c
@@ -103,6 +103,12 @@ const struct settings_data batctl_settings[BATCTL_SETTINGS_NUM] = {
 		.sysfs_name = "isolation_mark",
 		.params = NULL,
 	},
+	{
+		.opt_long = "multicast_mode",
+		.opt_short = "mm",
+		.sysfs_name = "multicast_mode",
+		.params = sysfs_param_enable,
+	},
 };
 
 static void interface_usage(void)
diff --git a/sys.h b/sys.h
index 5633822..dd0bee5 100644
--- a/sys.h
+++ b/sys.h
@@ -47,6 +47,7 @@ enum batctl_settings_list {
 	BATCTL_SETTINGS_FRAGMENTATION,
 	BATCTL_SETTINGS_NETWORK_CODING,
 	BATCTL_SETTINGS_ISOLATION_MARK,
+	BATCTL_SETTINGS_MULTICAST_MODE,
 	BATCTL_SETTINGS_NUM,
 };
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output
  2014-03-11 20:04 [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode Linus Lüssing
@ 2014-03-11 20:04 ` Linus Lüssing
  2014-03-12  7:32   ` Marek Lindner
  2014-03-12  4:16 ` [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode Marek Lindner
  1 sibling, 1 reply; 8+ messages in thread
From: Linus Lüssing @ 2014-03-11 20:04 UTC (permalink / raw)
  To: b.a.t.m.a.n

This patch adds the new "-u" and "-m" options for the local and global
translation table output to only display announced unicast or multicast
mac addresses to enhance readability.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
v3: unchanged

 debug.c      |   32 +++++++++++++++++++++++++++++++-
 functions.c  |   22 ++++++++++++++++++++++
 functions.h  |    2 ++
 man/batctl.8 |    2 ++
 4 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/debug.c b/debug.c
index 6836857..acf452b 100644
--- a/debug.c
+++ b/debug.c
@@ -91,6 +91,10 @@ static void debug_table_usage(int debug_table)
 
 	if (debug_table == BATCTL_TABLE_ORIGINATORS)
 		fprintf(stderr, " \t -t timeout interval - don't print originators not seen for x.y seconds \n");
+	if (debug_table == BATCTL_TABLE_TRANSLOCAL ||
+	    debug_table == BATCTL_TABLE_TRANSGLOBAL) {
+		fprintf(stderr, " \t -u|-m print unicast or multicast mac addresses only\n");
+	}
 }
 
 int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
@@ -102,7 +106,7 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
 	float watch_interval = 1;
 	opterr = 0;
 
-	while ((optchar = getopt(argc, argv, "hnw:t:H")) != -1) {
+	while ((optchar = getopt(argc, argv, "hnw:t:Hum")) != -1) {
 		switch (optchar) {
 		case 'h':
 			debug_table_usage(debug_table);
@@ -138,6 +142,26 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
 		case 'H':
 			read_opt |= SKIP_HEADER;
 			break;
+		case 'u':
+			if (debug_table != BATCTL_TABLE_TRANSLOCAL &&
+			    debug_table != BATCTL_TABLE_TRANSGLOBAL) {
+				fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
+				debug_table_usage(debug_table);
+				return EXIT_FAILURE;
+			}
+
+			read_opt |= UNICAST_ONLY;
+			break;
+		case 'm':
+			if (debug_table != BATCTL_TABLE_TRANSLOCAL &&
+			    debug_table != BATCTL_TABLE_TRANSGLOBAL) {
+				fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
+				debug_table_usage(debug_table);
+				return EXIT_FAILURE;
+			}
+
+			read_opt |= MULTICAST_ONLY;
+			break;
 		case '?':
 			if (optopt == 't')
 				fprintf(stderr, "Error - option '-t' needs a number as argument\n");
@@ -156,6 +180,12 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
 		}
 	}
 
+	if (read_opt & UNICAST_ONLY && read_opt & MULTICAST_ONLY) {
+		fprintf(stderr, "Error - '-u' and '-m' are exclusive options\n");
+		debug_table_usage(debug_table);
+		return EXIT_FAILURE;
+	}
+
 	debugfs_mnt = debugfs_mount(NULL);
 	if (!debugfs_mnt) {
 		fprintf(stderr, "Error - can't mount or find debugfs\n");
diff --git a/functions.c b/functions.c
index 36804bd..117dcff 100644
--- a/functions.c
+++ b/functions.c
@@ -175,6 +175,14 @@ static void file_open_problem_dbg(const char *dir, const char *fname,
 	}
 }
 
+static int str_is_mcast_addr(char *addr)
+{
+	struct ether_addr *mac_addr = ether_aton(addr);
+
+	return !mac_addr ? 0 :
+		mac_addr->ether_addr_octet[0] & 0x01;
+}
+
 int read_file(const char *dir, const char *fname, int read_opt,
 	      float orig_timeout, float watch_interval, size_t header_lines)
 {
@@ -224,6 +232,20 @@ read:
 			    && (last_seen > orig_timeout))
 				continue;
 
+		/* translation table: skip multicast */
+		if (line > header_lines &&
+		    read_opt & UNICAST_ONLY &&
+		    strlen(line_ptr) > strlen(" * xx:xx:xx:") &&
+		    str_is_mcast_addr(line_ptr+3))
+			continue;
+
+		/* translation table: skip unicast */
+		if (line > header_lines &&
+		    read_opt & MULTICAST_ONLY &&
+		    strlen(line_ptr) > strlen(" * xx:xx:xx:") &&
+		    !str_is_mcast_addr(line_ptr+3))
+			continue;
+
 		if (!(read_opt & USE_BAT_HOSTS)) {
 			printf("%s", line_ptr);
 			continue;
diff --git a/functions.h b/functions.h
index 14ba525..43c3d9c 100644
--- a/functions.h
+++ b/functions.h
@@ -57,6 +57,8 @@ enum {
 	NO_OLD_ORIGS = 0x40,
 	COMPAT_FILTER = 0x80,
 	SKIP_HEADER = 0x100,
+	UNICAST_ONLY = 0x200,
+	MULTICAST_ONLY = 0x400,
 };
 
 #endif
diff --git a/man/batctl.8 b/man/batctl.8
index f92bf3a..79d7887 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -198,6 +198,8 @@ All of the debug tables support the following options:
 The originator table also supports the "\-t" filter option to remove all originators from the output that have not been seen
 for the specified amount of seconds (with optional decimal places).
 
+The local and global translation tables also support the "\-u" and "\-m" option to only display unicast or multicast translation table announcements respectively.
+
 List of debug tables:
 .RS 10
 \- originators|o
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode
  2014-03-11 20:04 [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode Linus Lüssing
  2014-03-11 20:04 ` [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output Linus Lüssing
@ 2014-03-12  4:16 ` Marek Lindner
  1 sibling, 0 replies; 8+ messages in thread
From: Marek Lindner @ 2014-03-12  4:16 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

On Tuesday 11 March 2014 21:04:32 Linus Lüssing wrote:
> This patch adds a switch for the new multicast_mode setting in
> batman-adv.
> 
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---
> v3: fix merge conflict
>     (ordex was quicker with his isolation mark support patch :P)
> 
>  README       |    7 +++++++
>  man/batctl.8 |    4 ++++
>  sys.c        |    6 ++++++
>  sys.h        |    1 +
>  4 files changed, 18 insertions(+)

Applied in revision 42ffd4c.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output
  2014-03-11 20:04 ` [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output Linus Lüssing
@ 2014-03-12  7:32   ` Marek Lindner
  2014-04-21  1:58     ` Linus Lüssing
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Lindner @ 2014-03-12  7:32 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

On Tuesday 11 March 2014 21:04:33 Linus Lüssing wrote:
> This patch adds the new "-u" and "-m" options for the local and global
> translation table output to only display announced unicast or multicast
> mac addresses to enhance readability.
> 
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---
> v3: unchanged
> 
>  debug.c      |   32 +++++++++++++++++++++++++++++++-
>  functions.c  |   22 ++++++++++++++++++++++
>  functions.h  |    2 ++
>  man/batctl.8 |    2 ++
>  4 files changed, 57 insertions(+), 1 deletion(-)

Applied in revision 6202831.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output
  2014-03-12  7:32   ` Marek Lindner
@ 2014-04-21  1:58     ` Linus Lüssing
  2014-04-21  3:27       ` Marek Lindner
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Lüssing @ 2014-04-21  1:58 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n

On Wed, Mar 12, 2014 at 03:32:37PM +0800, Marek Lindner wrote:
> On Tuesday 11 March 2014 21:04:33 Linus Lüssing wrote:
> > This patch adds the new "-u" and "-m" options for the local and global
> > translation table output to only display announced unicast or multicast
> > mac addresses to enhance readability.
> > 
> > Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> > ---
> > v3: unchanged
> > 
> >  debug.c      |   32 +++++++++++++++++++++++++++++++-
> >  functions.c  |   22 ++++++++++++++++++++++
> >  functions.h  |    2 ++
> >  man/batctl.8 |    2 ++
> >  4 files changed, 57 insertions(+), 1 deletion(-)
> 
> Applied in revision 6202831.
> 
> Thanks,
> Marek

Hi Marek,

Hm, was it? Can't find it - am I looking at the wrong places?

Cheers, Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output
  2014-04-21  1:58     ` Linus Lüssing
@ 2014-04-21  3:27       ` Marek Lindner
  2014-04-21 10:42         ` Linus Lüssing
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Lindner @ 2014-04-21  3:27 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]

On Monday 21 April 2014 03:58:21 Linus Lüssing wrote:
> Hm, was it? Can't find it - am I looking at the wrong places?

Where are you looking ? 

git show 6202831


Cheers,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output
  2014-04-21  3:27       ` Marek Lindner
@ 2014-04-21 10:42         ` Linus Lüssing
  2014-05-02  5:34           ` Linus Lüssing
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Lüssing @ 2014-04-21 10:42 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n



On Mon, Apr 21, 2014 at 11:27:23AM +0800, Marek Lindner wrote:
> On Monday 21 April 2014 03:58:21 Linus Lüssing wrote:
> > Hm, was it? Can't find it - am I looking at the wrong places?
> 
> Where are you looking ? 
> 
> git show 6202831
> 
> 

git show 6202831 does indeed show it for me. However this one
doesn't:

$ git branch --contains 6202831

Also on http://git.open-mesh.org/batctl.git I don't seem to be
able to find it, like:

http://git.open-mesh.org/batctl.git?a=search&h=HEAD&st=commit&s=multicast+address+filter+option

Cheers, Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output
  2014-04-21 10:42         ` Linus Lüssing
@ 2014-05-02  5:34           ` Linus Lüssing
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Lüssing @ 2014-05-02  5:34 UTC (permalink / raw)
  To: b.a.t.m.a.n

On Mon, Apr 21, 2014 at 12:42:57PM +0200, Linus Lüssing wrote:
> 
> 
> On Mon, Apr 21, 2014 at 11:27:23AM +0800, Marek Lindner wrote:
> > On Monday 21 April 2014 03:58:21 Linus Lüssing wrote:
> > > Hm, was it? Can't find it - am I looking at the wrong places?
> > 
> > Where are you looking ? 
> > 
> > git show 6202831
> > 
> > 
> 
> git show 6202831 does indeed show it for me. However this one
> doesn't:
> 
> $ git branch --contains 6202831
> 
> Also on http://git.open-mesh.org/batctl.git I don't seem to be
> able to find it, like:
> 
> http://git.open-mesh.org/batctl.git?a=search&h=HEAD&st=commit&s=multicast+address+filter+option
> 
> Cheers, Linus

Doing a clean git clone: The change is there, but - git blame/diff
tell me it's actually in 6a0489b4. Did this patch accidentally
get squashed into 6a0489b4 ("batctl: add switch for setting
multicast_mode")?

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-05-02  5:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 20:04 [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode Linus Lüssing
2014-03-11 20:04 ` [B.A.T.M.A.N.] [PATCHv3 2/2] batctl: add unicast/multicast address filter option for TT output Linus Lüssing
2014-03-12  7:32   ` Marek Lindner
2014-04-21  1:58     ` Linus Lüssing
2014-04-21  3:27       ` Marek Lindner
2014-04-21 10:42         ` Linus Lüssing
2014-05-02  5:34           ` Linus Lüssing
2014-03-12  4:16 ` [B.A.T.M.A.N.] [PATCHv3 1/2] batctl: add switch for setting multicast_mode Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).