* [B.A.T.M.A.N.] [PATCH] batctl: add option for multiif orig table
@ 2014-02-18 14:13 Simon Wunderlich
2014-02-19 7:21 ` Marek Lindner
0 siblings, 1 reply; 3+ messages in thread
From: Simon Wunderlich @ 2014-02-18 14:13 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Simon Wunderlich
From: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
---
debug.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/debug.c b/debug.c
index d57324d..78c6e55 100644
--- a/debug.c
+++ b/debug.c
@@ -89,8 +89,10 @@ static void debug_table_usage(int debug_table)
fprintf(stderr, " \t -H don't show the header\n");
fprintf(stderr, " \t -w [interval] watch mode - refresh the table continuously\n");
- if (debug_table == BATCTL_TABLE_ORIGINATORS)
+ if (debug_table == BATCTL_TABLE_ORIGINATORS) {
fprintf(stderr, " \t -t timeout interval - don't print originators not seen for x.y seconds \n");
+ fprintf(stderr, " \t -i [interface] - show multiif originator table for a specific interface\n");
+ }
}
int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
@@ -98,11 +100,12 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
int optchar, read_opt = USE_BAT_HOSTS;
char full_path[MAX_PATH+1];
char *debugfs_mnt;
+ char *orig_iface = NULL;
float orig_timeout;
float watch_interval = 1;
opterr = 0;
- while ((optchar = getopt(argc, argv, "hnw:t:H")) != -1) {
+ while ((optchar = getopt(argc, argv, "hnw:t:Hi:")) != -1) {
switch (optchar) {
case 'h':
debug_table_usage(debug_table);
@@ -138,11 +141,21 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
case 'H':
read_opt |= SKIP_HEADER;
break;
+ case 'i':
+ if (debug_table != BATCTL_TABLE_ORIGINATORS) {
+ fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
+ debug_table_usage(debug_table);
+ return EXIT_FAILURE;
+ }
+
+ orig_iface = optarg;
+ break;
case '?':
- if (optopt == 't')
+ if (optopt == 't') {
fprintf(stderr, "Error - option '-t' needs a number as argument\n");
-
- else if (optopt == 'w') {
+ } else if (optopt == 'i') {
+ fprintf(stderr, "Error - option '-i' needs an interface as argument\n");
+ } else if (optopt == 'w') {
read_opt |= CLR_CONT_READ;
break;
}
@@ -162,7 +175,10 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv)
return EXIT_FAILURE;
}
- debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface, full_path, sizeof(full_path));
+ if (orig_iface)
+ debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", orig_iface, full_path, sizeof(full_path));
+ else
+ debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface, full_path, sizeof(full_path));
return read_file(full_path, (char *)batctl_debug_tables[debug_table].debugfs_name,
read_opt, orig_timeout, watch_interval,
batctl_debug_tables[debug_table].header_lines);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batctl: add option for multiif orig table
2014-02-18 14:13 [B.A.T.M.A.N.] [PATCH] batctl: add option for multiif orig table Simon Wunderlich
@ 2014-02-19 7:21 ` Marek Lindner
2014-02-19 18:18 ` Simon Wunderlich
0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2014-02-19 7:21 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]
On Tuesday 18 February 2014 15:13:24 Simon Wunderlich wrote:
> @@ -162,7 +175,10 @@ int handle_debug_table(char *mesh_iface, int
> debug_table, int argc, char **argv) return EXIT_FAILURE;
> }
>
> - debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface, full_path,
> sizeof(full_path)); + if (orig_iface)
> + debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", orig_iface,
> full_path, sizeof(full_path)); + else
> + debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface,
> full_path, sizeof(full_path)); return read_file(full_path, (char
> *)batctl_debug_tables[debug_table].debugfs_name, read_opt, orig_timeout,
> watch_interval,
> batctl_debug_tables[debug_table].header_lines);
While playing with your patch I noticed a couple of things:
* 'batctl originators -i eth0' is equivalent to 'batctl -m eth0 originators'
* the latter works even without your patch
* the orig table output does not say which interface we are looking at but
always reports: (bat0 BATMAN_IV)
* /sys/kernel/debug/batman_adv/ contains all sorts of hard-interfaces on my
test setup even if they are not used by batman-adv - is the intended ?
Cheers,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batctl: add option for multiif orig table
2014-02-19 7:21 ` Marek Lindner
@ 2014-02-19 18:18 ` Simon Wunderlich
0 siblings, 0 replies; 3+ messages in thread
From: Simon Wunderlich @ 2014-02-19 18:18 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Marek Lindner
> On Tuesday 18 February 2014 15:13:24 Simon Wunderlich wrote:
> > @@ -162,7 +175,10 @@ int handle_debug_table(char *mesh_iface, int
> > debug_table, int argc, char **argv) return EXIT_FAILURE;
> >
> > }
> >
> > - debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface,
> > full_path, sizeof(full_path)); + if (orig_iface)
> > + debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", orig_iface,
> > full_path, sizeof(full_path)); + else
> > + debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface,
> > full_path, sizeof(full_path)); return read_file(full_path, (char
> > *)batctl_debug_tables[debug_table].debugfs_name, read_opt, orig_timeout,
> > watch_interval,
> >
> > batctl_debug_tables[debug_table].header_lines);
>
> While playing with your patch I noticed a couple of things:
>
> * 'batctl originators -i eth0' is equivalent to 'batctl -m eth0
> originators'
> * the latter works even without your patch
Both is true, because the originators file is at the same position
(eth0/originators instead of bat0/originators).
> * the orig table output does not say which interface we are looking at but
> always reports: (bat0 BATMAN_IV)
Yes, check the whole first line:
bat0/originators: [B.A.T.M.A.N. adv master-b82b9b2, MainIF/MAC:
eth0/fe:f0:00:00:02:01 (bat0 BATMAN_IV)]
eth0/originators: [B.A.T.M.A.N. adv master-b82b9b2, IF/MAC:
eth0/fe:f0:00:00:02:01 (bat0 BATMAN_IV)]
eth1/originators: [B.A.T.M.A.N. adv master-b82b9b2, IF/MAC:
eth1/fe:f1:00:00:02:01 (bat0 BATMAN_IV)]
> * /sys/kernel/debug/batman_adv/ contains all sorts of hard-interfaces on
> my test setup even if they are not used by batman-adv - is the intended ?
Yes. Like the for the sysfs, a folder is created for every interface even if
not used - creating/removing on the fly would bring us a lot of locking fun
which I wanted to avoid (I think we have discussed that when the batman-adv
patches came in).
Cheers,
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-19 18:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-18 14:13 [B.A.T.M.A.N.] [PATCH] batctl: add option for multiif orig table Simon Wunderlich
2014-02-19 7:21 ` Marek Lindner
2014-02-19 18:18 ` Simon Wunderlich
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).