Repository : ssh://git@open-mesh.org/batctl
On branch : master
>---------------------------------------------------------------
commit ac02d8a905f7726bcc495830da6330bccd205e2b
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Sat Aug 25 10:57:58 2012 +0200
batctl: rename bisect to bisect_iv
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
>---------------------------------------------------------------
ac02d8a905f7726bcc495830da6330bccd205e2b
Makefile | 2 +-
README | 34 ++++++++++++++++------------------
bisect.c => bisect_iv.c | 14 +++++++-------
bisect.h => bisect_iv.h | 2 +-
main.c | 10 +++++-----
man/batctl.8 | 14 +++++++-------
6 files changed, 37 insertions(+), 39 deletions(-)
diff --git a/Makefile b/Makefile
index 72cecde..efe57c1 100755
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@
# batctl build
BINARY_NAME = batctl
-OBJ = main.o bat-hosts.o functions.o sys.o debug.o ping.o traceroute.o tcpdump.o list-batman.o hash.o vis.o debugfs.o bisect.o ioctl.o
+OBJ = main.o bat-hosts.o functions.o sys.o debug.o ping.o traceroute.o tcpdump.o list-batman.o hash.o vis.o debugfs.o bisect_iv.o ioctl.o
MANPAGE = man/batctl.8
# batctl flags and options
diff --git a/README b/README
index a2b0266..03d36c4 100644
--- a/README
+++ b/README
@@ -167,22 +167,20 @@ $ batctl tcpdump mesh0
01:51:43.600999 BAT wyoming: OGM via neigh kansas, seqno 6722, tq 245, ttl 49, v 9, flags [.D.], length 28
01:51:44.381064 BAT kansas: OGM via neigh kansas, seqno 6720, tq 255, ttl 50, v 9, flags [..I], length 28
-batctl bisect
-=============
-
-Analyzes the logfiles to build a small internal database of all sent sequence
-numbers and routing table changes. This database can be used to search for
-routing loops (default action), to trace OGMs of a host (use "-t" to
-specify the mac address or bat-host name) throughout the network or to
-display routing tables of the nodes (use "-r" to specify the mac address or
-bat-host name). You can name a specific sequence number or a range using the
-"-s" option to limit the output's range. Furthermore you can filter the
-output by specifying an originator (use "-o" to specify the mac address or
-bat-host name) to only see data connected to this originator. If "-n" was
-given batctl will not replace the mac addresses with bat-host names in the
-output.
-
-Usage: batctl bisect [parameters] <file1> <file2> .. <fileN>
+batctl bisect_iv
+================
+
+Analyzes the B.A.T.M.A.N. IV logfiles to build a small internal database of all sent sequence
+numbers and routing table changes. This database can be used to search for routing loops
+(default action), to trace OGMs of a host (use "-t" to specify the mac address or
+bat-host name) throughout the network or to display routing tables of the nodes (use "-r" to
+specify the mac address or bat-host name). You can name a specific sequence number or a range
+using the "-s" option to limit the output's range. Furthermore you can filter the output by
+specifying an originator (use "-o" to specify the mac address or bat-host name) to only see
+data connected to this originator. If "-n" was given batctl will not replace the mac
+addresses with bat-host names in the output.
+
+Usage: batctl bisect_iv [parameters] <file1> <file2> .. <fileN>
parameters:
-h print this help
-l run a loop detection of given mac address or bat-host (default)
@@ -193,7 +191,7 @@ parameters:
Examples:
-$ batctl bisect log/* -l uml3
+$ batctl bisect_iv log/* -l uml3
Analyzing routing tables of originator: uml3 [all sequence numbers]
Checking host: uml3
@@ -211,7 +209,7 @@ Path towards uml9 (seqno 12 via neigh uml4): -> uml4 -> uml5 -> uml6 -> uml7 ->
Path towards uml9 (seqno 21 via neigh uml5): -> uml5 -> uml6 -> uml7 -> uml8 -> uml9.
Path towards uml9 (seqno 22 via neigh uml4): -> uml4 -> uml5 -> uml6 -> uml7 -> uml8 -> uml9.
-$ ./batctl bisect -t uml3 log/*
+$ ./batctl bisect_iv -t uml3 log/*
Sequence number flow of originator: uml3 [all sequence numbers]
[...]
+=> uml3 (seqno 19)
diff --git a/bisect.c b/bisect_iv.c
similarity index 99%
rename from bisect.c
rename to bisect_iv.c
index 8bc9c65..c4c06c2 100644
--- a/bisect.c
+++ b/bisect_iv.c
@@ -27,7 +27,7 @@
#include <errno.h>
#include "main.h"
-#include "bisect.h"
+#include "bisect_iv.h"
#include "bat-hosts.h"
#include "hash.h"
#include "functions.h"
@@ -35,9 +35,9 @@
static struct hashtable_t *node_hash = NULL;
static struct bat_node *curr_bat_node = NULL;
-static void bisect_usage(void)
+static void bisect_iv_usage(void)
{
- printf("Usage: batctl bisect [parameters] <file1> <file2> .. <fileN>\n");
+ printf("Usage: batctl bisect_iv [parameters] <file1> <file2> .. <fileN>\n");
printf("parameters:\n");
printf(" \t -h print this help\n");
printf(" \t -l run a loop detection of given mac address or bat-host (default)\n");
@@ -1441,7 +1441,7 @@ err:
return 0;
}
-int bisect(int argc, char **argv)
+int bisect_iv(int argc, char **argv)
{
int ret = EXIT_FAILURE, res, optchar, found_args = 1;
int read_opt = USE_BAT_HOSTS, num_parsed_files;
@@ -1455,7 +1455,7 @@ int bisect(int argc, char **argv)
while ((optchar = getopt(argc, argv, "hl:no:r:s:t:")) != -1) {
switch (optchar) {
case 'h':
- bisect_usage();
+ bisect_iv_usage();
return EXIT_SUCCESS;
case 'l':
loop_orig_ptr = optarg;
@@ -1501,14 +1501,14 @@ int bisect(int argc, char **argv)
found_args += ((*((char*)(optarg - 1)) == optchar ) ? 1 : 2);
break;
default:
- bisect_usage();
+ bisect_iv_usage();
return EXIT_FAILURE;
}
}
if (argc <= found_args + 1) {
printf("Error - need at least 2 log files to compare\n");
- bisect_usage();
+ bisect_iv_usage();
goto err;
}
diff --git a/bisect.h b/bisect_iv.h
similarity index 98%
rename from bisect.h
rename to bisect_iv.h
index 7c43708..d6f2bc9 100644
--- a/bisect.h
+++ b/bisect_iv.h
@@ -29,7 +29,7 @@
#define RT_FLAG_UPDATE 2
#define RT_FLAG_DELETE 3
-int bisect(int argc, char **argv);
+int bisect_iv(int argc, char **argv);
diff --git a/main.c b/main.c
index 1086f8e..390736d 100644
--- a/main.c
+++ b/main.c
@@ -34,7 +34,7 @@
#include "ping.h"
#include "traceroute.h"
#include "tcpdump.h"
-#include "bisect.h"
+#include "bisect_iv.h"
#include "vis.h"
#include "ioctl.h"
#include "functions.h"
@@ -85,7 +85,7 @@ void print_usage(void)
printf(" \tping|p <destination> \tping another batman adv host via layer 2\n");
printf(" \ttraceroute|tr <destination> \ttraceroute another batman adv host via layer 2\n");
printf(" \ttcpdump|td <interface> \ttcpdump layer 2 traffic on the given interface\n");
- printf(" \tbisect <file1> .. <fileN>\tanalyze given log files for routing stability\n");
+ printf(" \tbisect_iv <file1> .. <fileN>\tanalyze given batman iv log files for routing stability\n");
}
int main(int argc, char **argv)
@@ -131,7 +131,7 @@ int main(int argc, char **argv)
/* TODO: remove this generic check here and move it into the individual functions */
/* check if user is root */
- if ((strcmp(argv[1], "bisect") != 0) && ((getuid()) || (getgid()))) {
+ if ((strncmp(argv[1], "bisect", strlen("bisect")) != 0) && ((getuid()) || (getgid()))) {
fprintf(stderr, "Error - you must be root to run '%s' !\n", argv[0]);
exit(EXIT_FAILURE);
}
@@ -172,9 +172,9 @@ int main(int argc, char **argv)
ret = ioctl_statistics_get(mesh_iface);
- } else if ((strcmp(argv[1], "bisect") == 0)) {
+ } else if ((strcmp(argv[1], "bisect_iv") == 0)) {
- ret = bisect(argc - 1, argv + 1);
+ ret = bisect_iv(argc - 1, argv + 1);
} else {
diff --git a/man/batctl.8 b/man/batctl.8
index f904719..ab02e9a 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -250,13 +250,13 @@ except specified). The following packet types are available:
Example: batctl td <interface> -p 129 \-> only display batman ogm packets and non batman packets
.RE
.br
-.IP "\fBbisect\fP [\fB\-l MAC\fP][\fB\-t MAC\fP][\fB\-r MAC\fP][\fB\-s min\fP [\fB\- max\fP]][\fB\-o MAC\fP][\fB\-n\fP] \fBlogfile1\fP [\fBlogfile2\fP ... \fBlogfileN\fP]"
-Analyses the logfiles to build a small internal database of all sent sequence numbers and routing table changes. This
-database can then be analyzed in a number of different ways. With "\-l" the database can be used to search for routing
-loops. Use "\-t" to trace OGMs of a host throughout the network. Use "\-r" to display routing tables of the nodes. The
-option "\-s" can be used to limit the output to a range of sequence numbers, between min and max, or to one specific
-sequence number, min. Furthermore using "\-o" you can filter the output to a specified originator. If "\-n" is given
-batctl will not replace the MAC addresses with bat\-host names in the output.
+.IP "\fBbisect_iv\fP [\fB\-l MAC\fP][\fB\-t MAC\fP][\fB\-r MAC\fP][\fB\-s min\fP [\fB\- max\fP]][\fB\-o MAC\fP][\fB\-n\fP] \fBlogfile1\fP [\fBlogfile2\fP ... \fBlogfileN\fP]"
+Analyses the B.A.T.M.A.N. IV logfiles to build a small internal database of all sent sequence numbers and routing table
+changes. This database can then be analyzed in a number of different ways. With "\-l" the database can be used to search
+for routing loops. Use "\-t" to trace OGMs of a host throughout the network. Use "\-r" to display routing tables of the
+nodes. The option "\-s" can be used to limit the output to a range of sequence numbers, between min and max, or to one
+specific sequence number, min. Furthermore using "\-o" you can filter the output to a specified originator. If "\-n" is
+given batctl will not replace the MAC addresses with bat\-host names in the output.
.br
.SH FILES
.TP