From patchwork Fri Dec 11 22:58:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 5179 Return-Path: Received: from fmmailgate02.web.de (fmmailgate02.web.de [217.72.192.227]) by open-mesh.net (Postfix) with ESMTP id 62AFC15410E for ; Fri, 11 Dec 2009 23:43:40 +0000 (UTC) Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate02.web.de (Postfix) with ESMTP id 5D8BF148394C3 for ; Fri, 11 Dec 2009 23:58:37 +0100 (CET) Received: from [85.179.236.44] (helo=localhost) by smtp08.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #314) id 1NJERY-0000i0-00 for b.a.t.m.a.n@lists.open-mesh.net; Fri, 11 Dec 2009 23:58:36 +0100 Date: Fri, 11 Dec 2009 23:58:35 +0100 From: Linus =?utf-8?Q?L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.net Message-ID: <20091211225835.GA17140@Linus-Debian> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091130211445.GN4150@lunn.ch> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linus.luessing@web.de X-Sender: linus.luessing@web.de X-Provags-ID: V01U2FsdGVkX1+mIdz/Gje+ps0pNePMcFIV0jqhOgU4wQSF6Xyo wCePOygGb85OFyGoLW1Atuc0O+H1mWeabgkvrh47ohLppu9qK4 ZhnucQnDzXzrNz/MXt8w== Subject: Re: [B.A.T.M.A.N.] /proc vis rework X-BeenThere: b.a.t.m.a.n@lists.open-mesh.net X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2009 23:43:40 -0000 Hi Andrew, your patch seems to work pretty well here, tested it with 9 batman-nodes in the same room. Nevertheless I found a couple of smaller bugs in there: - batctl segfaults, if "batctl vis" has no following argument - batctl now displays the help-page in certain situations where we don't want it to - batctl ommits the first TQ tupel The attached patch for your patch should fix these issues :). And I wanted to ask, what do you think about unifying the specific help output? For instance having this "Usage: ..."-header and the alignment for the following items the same way as it is done for other batctl commands as well. Cheers, Linus PS: Hmm, I'm also missing a couple of link/TQ entries already in the unified /proc/../vis. The 9 nodes in the same room should be able to see each other - the originator table on those nodes is also saying so. But I think I had seen this before without your patch, the problems has to be somewhere else. I'm attaching a batctl-vis- and proc-vis-output of the setup here too, just in case someone might spot some (more) parsing mistakes. 06:24:01:b7:69:c1,TQ 06:24:01:b7:6a:d9 247, TQ 06:24:01:b7:6a:d1 247, TQ 06:24:01:b7:61:1b 255, TQ 06:24:01:b7:6a:b3 255, TQ 06:24:01:b7:6a:fd 255, TQ 06:24:01:b7:61:49 251, HNA 72:43:e7:02:8f:96, HNA 00:24:01:b7:69:c1, PRIMARY, 06:24:01:b7:61:19,TQ 06:24:01:b7:6a:d9 249, TQ 06:24:01:b7:6a:d1 255, TQ 06:24:01:b7:61:1b 255, TQ 06:24:01:b7:6a:b3 247, TQ 00:13:e8:50:c0:ff 248, HNA 00:24:01:b7:61:19, HNA d6:59:34:c6:ee:ce, PRIMARY, 06:24:01:b7:6a:b3,TQ 06:24:01:b7:69:c1 251, TQ 06:24:01:b7:6a:d9 255, TQ 06:24:01:b7:6a:d1 254, TQ 06:24:01:b7:61:19 247, TQ 06:24:01:b7:61:1b 255, TQ 00:13:e8:50:c0:ff 247, TQ 06:24:01:b7:6a:fd 255, TQ 06:24:01:b7:61:49 255, HNA 6e:49:09:0e:30:1f, HNA 00:24:01:b7:6a:b3, PRIMARY, 06:24:01:b7:6a:fd,TQ 06:24:01:b7:69:c1 255, TQ 06:24:01:b7:6a:d9 251, TQ 06:24:01:b7:61:19 247, TQ 06:24:01:b7:61:1b 255, TQ 06:24:01:b7:6a:b3 255, TQ 00:13:e8:50:c0:ff 251, TQ 06:24:01:b7:61:49 247, HNA be:38:d5:48:ad:58, HNA 00:24:01:b7:6a:fd, PRIMARY, 06:24:01:b7:61:49,TQ 06:24:01:b7:69:c1 254, TQ 06:24:01:b7:6a:d1 251, TQ 06:24:01:b7:61:19 255, TQ 06:24:01:b7:61:1b 252, TQ 06:24:01:b7:6a:b3 255, TQ 00:13:e8:50:c0:ff 255, TQ 06:24:01:b7:6a:fd 255, HNA 00:24:01:b7:61:49, HNA 86:44:91:74:79:cc, PRIMARY, 06:24:01:b7:6a:d9,TQ 06:24:01:b7:69:c1 255, TQ 06:24:01:b7:6a:d1 251, TQ 06:24:01:b7:61:19 255, TQ 06:24:01:b7:61:1b 251, TQ 06:24:01:b7:6a:b3 255, TQ 00:13:e8:50:c0:ff 255, TQ 06:24:01:b7:6a:fd 247, TQ 06:24:01:b7:61:49 250, HNA 00:24:01:b7:6a:d9, HNA 9a:6e:8f:f0:90:a2, PRIMARY, 06:24:01:b7:6a:d1,TQ 06:24:01:b7:69:c1 251, TQ 06:24:01:b7:6a:d9 250, TQ 06:24:01:b7:61:19 255, TQ 06:24:01:b7:61:1b 255, TQ 06:24:01:b7:6a:b3 253, TQ 00:13:e8:50:c0:ff 251, TQ 06:24:01:b7:6a:fd 255, HNA 00:24:01:b7:6a:d1, HNA 9a:8e:ad:ea:e0:dc, PRIMARY, 06:24:01:b7:61:1b,TQ 06:24:01:b7:6a:d9 255, TQ 06:24:01:b7:6a:d1 255, TQ 06:24:01:b7:61:19 247, TQ 06:24:01:b7:6a:b3 255, TQ 00:13:e8:50:c0:ff 255, TQ 06:24:01:b7:6a:fd 251, HNA 5e:2b:6b:67:d7:17, HNA 00:24:01:b7:61:1b, PRIMARY, 00:13:e8:50:c0:ff,TQ 06:24:01:b7:69:c1 255, TQ 06:24:01:b7:6a:d9 251, TQ 06:24:01:b7:6a:d1 255, TQ 06:24:01:b7:61:1b 247, TQ 06:24:01:b7:6a:b3 255, TQ 06:24:01:b7:6a:fd 255, HNA 72:c5:18:83:3a:a3, PRIMARY, digraph { "06:24:01:b7:69:c1" -> "06:24:01:b7:6a:d9" [label="1.32"] "06:24:01:b7:69:c1" -> "06:24:01:b7:6a:d1" [label="1.32"] "06:24:01:b7:69:c1" -> "06:24:01:b7:61:1b" [label="1.0"] "06:24:01:b7:69:c1" -> "06:24:01:b7:6a:b3" [label="1.0"] "06:24:01:b7:69:c1" -> "06:24:01:b7:6a:fd" [label="1.0"] "06:24:01:b7:69:c1" -> "06:24:01:b7:61:49" [label="1.15"] "06:24:01:b7:69:c1" -> "72:43:e7:02:8f:96" [label="HNA"] "06:24:01:b7:69:c1" -> "00:24:01:b7:69:c1" [label="HNA"] subgraph "cluster_06:24:01:b7:69:c1" { "06:24:01:b7:69:c1" [peripheries=2] } "06:24:01:b7:61:19" -> "06:24:01:b7:6a:d9" [label="1.24"] "06:24:01:b7:61:19" -> "06:24:01:b7:6a:d1" [label="1.0"] "06:24:01:b7:61:19" -> "06:24:01:b7:61:1b" [label="1.0"] "06:24:01:b7:61:19" -> "06:24:01:b7:6a:b3" [label="1.32"] "06:24:01:b7:61:19" -> "00:13:e8:50:c0:ff" [label="1.28"] "06:24:01:b7:61:19" -> "00:24:01:b7:61:19" [label="HNA"] "06:24:01:b7:61:19" -> "d6:59:34:c6:ee:ce" [label="HNA"] subgraph "cluster_06:24:01:b7:61:19" { "06:24:01:b7:61:19" [peripheries=2] } "06:24:01:b7:6a:b3" -> "06:24:01:b7:69:c1" [label="1.15"] "06:24:01:b7:6a:b3" -> "06:24:01:b7:6a:d9" [label="1.0"] "06:24:01:b7:6a:b3" -> "06:24:01:b7:6a:d1" [label="1.3"] "06:24:01:b7:6a:b3" -> "06:24:01:b7:61:19" [label="1.32"] "06:24:01:b7:6a:b3" -> "06:24:01:b7:61:1b" [label="1.0"] "06:24:01:b7:6a:b3" -> "00:13:e8:50:c0:ff" [label="1.32"] "06:24:01:b7:6a:b3" -> "06:24:01:b7:6a:fd" [label="1.0"] "06:24:01:b7:6a:b3" -> "06:24:01:b7:61:49" [label="1.0"] "06:24:01:b7:6a:b3" -> "6e:49:09:0e:30:1f" [label="HNA"] "06:24:01:b7:6a:b3" -> "00:24:01:b7:6a:b3" [label="HNA"] subgraph "cluster_06:24:01:b7:6a:b3" { "06:24:01:b7:6a:b3" [peripheries=2] } "06:24:01:b7:6a:fd" -> "06:24:01:b7:69:c1" [label="1.0"] "06:24:01:b7:6a:fd" -> "06:24:01:b7:6a:d9" [label="1.15"] "06:24:01:b7:6a:fd" -> "06:24:01:b7:61:19" [label="1.32"] "06:24:01:b7:6a:fd" -> "06:24:01:b7:61:1b" [label="1.0"] "06:24:01:b7:6a:fd" -> "06:24:01:b7:6a:b3" [label="1.0"] "06:24:01:b7:6a:fd" -> "00:13:e8:50:c0:ff" [label="1.15"] "06:24:01:b7:6a:fd" -> "06:24:01:b7:61:49" [label="1.32"] "06:24:01:b7:6a:fd" -> "be:38:d5:48:ad:58" [label="HNA"] "06:24:01:b7:6a:fd" -> "00:24:01:b7:6a:fd" [label="HNA"] subgraph "cluster_06:24:01:b7:6a:fd" { "06:24:01:b7:6a:fd" [peripheries=2] } "06:24:01:b7:61:49" -> "06:24:01:b7:69:c1" [label="1.3"] "06:24:01:b7:61:49" -> "06:24:01:b7:6a:d1" [label="1.15"] "06:24:01:b7:61:49" -> "06:24:01:b7:61:19" [label="1.0"] "06:24:01:b7:61:49" -> "06:24:01:b7:61:1b" [label="1.11"] "06:24:01:b7:61:49" -> "06:24:01:b7:6a:b3" [label="1.0"] "06:24:01:b7:61:49" -> "00:13:e8:50:c0:ff" [label="1.0"] "06:24:01:b7:61:49" -> "06:24:01:b7:6a:fd" [label="1.0"] "06:24:01:b7:61:49" -> "00:24:01:b7:61:49" [label="HNA"] "06:24:01:b7:61:49" -> "86:44:91:74:79:cc" [label="HNA"] subgraph "cluster_06:24:01:b7:61:49" { "06:24:01:b7:61:49" [peripheries=2] } "06:24:01:b7:6a:d9" -> "06:24:01:b7:69:c1" [label="1.0"] "06:24:01:b7:6a:d9" -> "06:24:01:b7:6a:d1" [label="1.15"] "06:24:01:b7:6a:d9" -> "06:24:01:b7:61:19" [label="1.0"] "06:24:01:b7:6a:d9" -> "06:24:01:b7:61:1b" [label="1.15"] "06:24:01:b7:6a:d9" -> "06:24:01:b7:6a:b3" [label="1.0"] "06:24:01:b7:6a:d9" -> "00:13:e8:50:c0:ff" [label="1.0"] "06:24:01:b7:6a:d9" -> "06:24:01:b7:6a:fd" [label="1.32"] "06:24:01:b7:6a:d9" -> "06:24:01:b7:61:49" [label="1.20"] "06:24:01:b7:6a:d9" -> "00:24:01:b7:6a:d9" [label="HNA"] "06:24:01:b7:6a:d9" -> "9a:6e:8f:f0:90:a2" [label="HNA"] subgraph "cluster_06:24:01:b7:6a:d9" { "06:24:01:b7:6a:d9" [peripheries=2] } "06:24:01:b7:6a:d1" -> "06:24:01:b7:69:c1" [label="1.15"] "06:24:01:b7:6a:d1" -> "06:24:01:b7:6a:d9" [label="1.20"] "06:24:01:b7:6a:d1" -> "06:24:01:b7:61:19" [label="1.0"] "06:24:01:b7:6a:d1" -> "06:24:01:b7:61:1b" [label="1.0"] "06:24:01:b7:6a:d1" -> "06:24:01:b7:6a:b3" [label="1.7"] "06:24:01:b7:6a:d1" -> "00:13:e8:50:c0:ff" [label="1.15"] "06:24:01:b7:6a:d1" -> "06:24:01:b7:6a:fd" [label="1.0"] "06:24:01:b7:6a:d1" -> "00:24:01:b7:6a:d1" [label="HNA"] "06:24:01:b7:6a:d1" -> "9a:8e:ad:ea:e0:dc" [label="HNA"] subgraph "cluster_06:24:01:b7:6a:d1" { "06:24:01:b7:6a:d1" [peripheries=2] } "06:24:01:b7:61:1b" -> "06:24:01:b7:6a:d9" [label="1.0"] "06:24:01:b7:61:1b" -> "06:24:01:b7:6a:d1" [label="1.0"] "06:24:01:b7:61:1b" -> "06:24:01:b7:61:19" [label="1.32"] "06:24:01:b7:61:1b" -> "06:24:01:b7:6a:b3" [label="1.0"] "06:24:01:b7:61:1b" -> "00:13:e8:50:c0:ff" [label="1.0"] "06:24:01:b7:61:1b" -> "06:24:01:b7:6a:fd" [label="1.15"] "06:24:01:b7:61:1b" -> "5e:2b:6b:67:d7:17" [label="HNA"] "06:24:01:b7:61:1b" -> "00:24:01:b7:61:1b" [label="HNA"] subgraph "cluster_06:24:01:b7:61:1b" { "06:24:01:b7:61:1b" [peripheries=2] } "00:13:e8:50:c0:ff" -> "06:24:01:b7:69:c1" [label="1.0"] "00:13:e8:50:c0:ff" -> "06:24:01:b7:6a:d9" [label="1.15"] "00:13:e8:50:c0:ff" -> "06:24:01:b7:6a:d1" [label="1.0"] "00:13:e8:50:c0:ff" -> "06:24:01:b7:61:1b" [label="1.32"] "00:13:e8:50:c0:ff" -> "06:24:01:b7:6a:b3" [label="1.0"] "00:13:e8:50:c0:ff" -> "06:24:01:b7:6a:fd" [label="1.0"] "00:13:e8:50:c0:ff" -> "72:c5:18:83:3a:a3" [label="HNA"] subgraph "cluster_00:13:e8:50:c0:ff" { "00:13:e8:50:c0:ff" [peripheries=2] } } diff -ur batctl/functions.c batctl2/functions.c --- batctl/functions.c 2009-12-11 23:10:31.000000000 +0100 +++ batctl2/functions.c 2009-12-11 23:09:48.000000000 +0100 @@ -161,10 +161,10 @@ if (read_opt & USE_READ_BUFF) { read_ptr = read_buff; - read_len = sizeof(read_buff); + read_len = sizeof(read_buff)-1; } else { read_ptr = lbuff; - read_len = sizeof(lbuff); + read_len = sizeof(lbuff)-1; } open: diff -ur batctl/main.c batctl2/main.c --- batctl/main.c 2009-12-11 23:10:31.000000000 +0100 +++ batctl2/main.c 2009-12-11 23:09:48.000000000 +0100 @@ -121,7 +121,7 @@ ret = handle_proc_setting(argc - 1, argv + 1, PROC_ORIG_INTERVAL, orig_interval_usage); - } if (strcmp(argv[1], "vis") == 0) { + } else if (strcmp(argv[1], "vis") == 0) { ret = vis(argc - 1, argv + 1); diff -ur batctl/vis.c batctl2/vis.c --- batctl/vis.c 2009-12-11 23:10:48.000000000 +0100 +++ batctl2/vis.c 2009-12-11 23:29:04.000000000 +0100 @@ -215,7 +215,7 @@ while ((read = getline(&line, &len, fp)) != -1) { /* First MAC address is the originator */ - orig = strtok_r(line, " ", &line_save_ptr); + orig = strtok_r(line, ",", &line_save_ptr); duplet_save_ptr = line_save_ptr; while ((duplet = strtok_r(NULL, ",", &duplet_save_ptr)) != NULL) { @@ -265,10 +265,12 @@ int c; /* Do we know the requested format? */ - if (strcmp(argv[1], "dot") == 0) - dot=true; - if (strcmp(argv[1], "json") == 0) - json=true; + if(argc > 1) { + if (strcmp(argv[1], "dot") == 0) + dot=true; + if (strcmp(argv[1], "json") == 0) + json=true; + } if (!dot && !json) { usage(); @@ -319,5 +321,3 @@ return EXIT_FAILURE; } - -