With the introduction of DAT in batman-adv, another table is now exported through debugfs. This patch adds the possibility to print it
Signed-off-by: Antonio Quartulli ordex@autistici.org --- README | 18 ++++++++++++++++++ debug.c | 5 +++++ debug.h | 1 + man/batctl.8 | 3 +++ 4 files changed, 27 insertions(+)
diff --git a/README b/README index 03d36c4..8ee2c9f 100644 --- a/README +++ b/README @@ -408,6 +408,24 @@ where:
If any of the flags is not enabled, a '.' will substitute its symbol.
+batctl datcache +================= + +display the local D.A.T. cache + +Usage batctl datcache|dc + +Example: + +Distributed ARP Table (bat0): + IPv4 MAC last-seen + * 172.100.0.1 b6:9b:d0:ea:b1:13 0:00 + +where: +- IPv4 is the IP address of a client in the mesh network +- MAC is the MAC address associated to that IP +- last-seen is the amount of time since last refresh of this entry + batctl vis_mode =================
diff --git a/debug.c b/debug.c index 9b5146f..163bfc9 100644 --- a/debug.c +++ b/debug.c @@ -64,6 +64,11 @@ const struct debug_table_data batctl_debug_tables[BATCTL_TABLE_NUM] = { .opt_short = "bbt", .debugfs_name = "bla_backbone_table", }, + { + .opt_long = "datcache", + .opt_short = "dc", + .debugfs_name = "dat_cache", + }, };
void debug_table_usage(int debug_table) diff --git a/debug.h b/debug.h index 6068c2c..4e935cb 100644 --- a/debug.h +++ b/debug.h @@ -31,6 +31,7 @@ enum batctl_debug_tables { BATCTL_TABLE_TRANSGLOBAL, BATCTL_TABLE_BLA_CLAIMS, BATCTL_TABLE_BLA_BACKBONES, + BATCTL_TABLE_DAT, BATCTL_TABLE_NUM, };
diff --git a/man/batctl.8 b/man/batctl.8 index ab02e9a..310b43f 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -187,6 +187,9 @@ List of debug tables: .RS 10 - backbonetable|bbt (compile time option) .RE +.RS 10 +- datcache|dc (compile time option) +.RE .RE .br .IP "\fBstatistics\fP|\fBs\fP"
Signed-off-by: Antonio Quartulli ordex@autistici.org --- README | 1 + man/batctl.8 | 7 ++++--- sys.c | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/README b/README index 8ee2c9f..b3127a0 100644 --- a/README +++ b/README @@ -342,6 +342,7 @@ $ batctl loglevel [ ] messages related to route added / changed / deleted (routes) [ ] messages related to translation table operations (tt) [ ] messages related to bridge loop avoidance (bla) +[ ] messages related to arp snooping and distributetd arp table (dat)
batctl aggregation ================== diff --git a/man/batctl.8 b/man/batctl.8 index 310b43f..250e461 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -85,9 +85,10 @@ disable fragmentation. 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. Level 'routes' enables messages related to routes being added / changed / deleted. Level 'tt' enables messages related to -translation table operations. Level 'bla' enables messages related to the bridge loop avoidance. Level 'all' enables all -messages. The messages are sent to the batman-adv debug log. Use \fBbatctl log\fP to retrieve it. Make sure to have debugging -output enabled when compiling the module otherwise the output as well as the loglevel options won't be available. +translation table operations. Level 'bla' enables messages related to the bridge loop avoidance. Level 'dat' enables +messages related to ARP snooping and the Distributed Arp Table. Level 'all' enables all messages. The messages are sent +to the batman-adv debug log. Use \fBbatctl log\fP to retrieve it. Make sure to have debugging output enabled when compiling +the module otherwise the output as well as the loglevel options won't be available. .br .IP "\fBlog\fP|\fBl\fP [\fB-n\fP]\fP" batctl will read the batman-adv debug log which has to be compiled into the kernel module. If "-n" is given batctl will not diff --git a/sys.c b/sys.c index 6f94483..4c2d6a5 100644 --- a/sys.c +++ b/sys.c @@ -258,6 +258,7 @@ static void log_level_usage(void) printf(" \t routes Messages related to route added / changed / deleted\n"); printf(" \t tt Messages related to translation table operations\n"); printf(" \t bla Messages related to bridge loop avoidance\n"); + printf(" \t dat Messages reated to arp snooping and sitributed arp table\n"); }
int handle_loglevel(char *mesh_iface, int argc, char **argv) @@ -288,7 +289,7 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv) log_level = 0; break; } else if (strcmp(argv[i], "all") == 0) { - log_level = 15; + log_level = 31; break; } else if (strcmp(argv[i], "batman") == 0) log_level |= BIT(0); @@ -298,6 +299,8 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv) log_level |= BIT(2); else if (strcmp(argv[i], "bla") == 0) log_level |= BIT(3); + else if (strcmp(argv[i], "dat") == 0) + log_level |= BIT(4); else { log_level_usage(); goto out; @@ -327,6 +330,8 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv) "messages related to translation table operations", "tt"); printf("[%c] %s (%s)\n", (log_level & BIT(3)) ? 'x' : ' ', "messages related to bridge loop avoidance", "bla"); + printf("[%c] %s (%s)\n", (log_level & 16) ? 'x' : ' ', + "messages related to arp snooping and distributetd arp table", "dat");
out: free(path_buff);
Signed-off-by: Antonio Quartulli ordex@autistici.org --- man/batctl.8 | 4 ++++ sys.c | 6 ++++++ sys.h | 1 + 3 files changed, 11 insertions(+)
diff --git a/man/batctl.8 b/man/batctl.8 index 250e461..4359411 100644 --- a/man/batctl.8 +++ b/man/batctl.8 @@ -66,6 +66,10 @@ If no parameter is given the current bridge loop avoidance setting is displayed. or disable the bridge loop avoidance. Bridge loop avoidance support has to be enabled when compiling the module otherwise this option won't be available. .br +.IP "\fBdistributed_arp_table\fP|\fBdat\fP [\fB0\fP|\fB1\fP]" +If no parameter is given the current distributed arp table setting is displayed. Otherwise the parameter is used to +enable or disable the distributed arp table. +.br .IP "\fBvis_mode|vm\fP [\fBclient|server\fP]\fP" If no parameter is given the current vis mode is displayed otherwise the parameter is used to set the vis mode. .br diff --git a/sys.c b/sys.c index 4c2d6a5..d4d2175 100644 --- a/sys.c +++ b/sys.c @@ -69,6 +69,12 @@ const struct settings_data batctl_settings[BATCTL_SETTINGS_NUM] = { .params = sysfs_param_enable, }, { + .opt_long = "distributed_arp_table", + .opt_short = "dat", + .sysfs_name = "distributed_arp_table", + .params = sysfs_param_enable, + }, + { .opt_long = "vis_mode", .opt_short = "vm", .sysfs_name = "vis_mode", diff --git a/sys.h b/sys.h index 1fc473e..40b64b1 100644 --- a/sys.h +++ b/sys.h @@ -35,6 +35,7 @@ enum batctl_settings_list { BATCTL_SETTINGS_ORIG_INTERVAL, BATCTL_SETTINGS_AP_ISOLATION, BATCTL_SETTINGS_BLA, + BATCTL_SETTINGS_DAT, BATCTL_SETTINGS_VIS_MODE, BATCTL_SETTINGS_AGGREGATION, BATCTL_SETTINGS_BONDING,
On Sunday, October 07, 2012 03:11:21 Antonio Quartulli wrote:
--- a/debug.c +++ b/debug.c @@ -64,6 +64,11 @@ const struct debug_table_data batctl_debug_tables[BATCTL_TABLE_NUM] = { .opt_short = "bbt", .debugfs_name = "bla_backbone_table", },
{
.opt_long = "datcache",
.opt_short = "dc",
.debugfs_name = "dat_cache",
},
};
How about adding this entry to the "can be compiled out" parameter list ? Check "fs_compile_out_param" list in functions.c. Same applies to patch3.
Cheers, Marek
On Sun, Oct 07, 2012 at 03:22:06AM +0800, Marek Lindner wrote:
On Sunday, October 07, 2012 03:11:21 Antonio Quartulli wrote:
--- a/debug.c +++ b/debug.c @@ -64,6 +64,11 @@ const struct debug_table_data batctl_debug_tables[BATCTL_TABLE_NUM] = { .opt_short = "bbt", .debugfs_name = "bla_backbone_table", },
{
.opt_long = "datcache",
.opt_short = "dc",
.debugfs_name = "dat_cache",
},
};
How about adding this entry to the "can be compiled out" parameter list ? Check "fs_compile_out_param" list in functions.c. Same applies to patch3.
Oh right! Bactl is getting better every day! :-)
Will send v2.
thanks!
b.a.t.m.a.n@lists.open-mesh.org