The following commit has been merged in the master branch: commit 58a3030a35f49b50b42ebb6c233b83aec21a0d42 Author: Marek Lindner lindner_marek@yahoo.de Date: Wed Nov 15 00:54:52 2006 +0100
on the way to rc4
diff --git a/batman.c b/batman.c index 9f259be..86e8a58 100755 --- a/batman.c +++ b/batman.c @@ -520,6 +520,7 @@ static void debug() { unsigned int batman_count = 0; static char str[ADDR_STR_LEN], str2[ADDR_STR_LEN];
+ if ( ( debug_level == 0 ) || ( debug_level == 3 ) ) return;
@@ -554,8 +555,8 @@ static void debug() {
if ( debug_level == 4 ) {
- output("------------------ DEBUG ------------------\n"); - output("Forward list\n"); + output( "------------------ DEBUG ------------------\n" ); + output( "Forward list\n" );
list_for_each(forw_pos, &forw_list) { forw_node = list_entry(forw_pos, struct forw_node, list); @@ -563,80 +564,67 @@ static void debug() { output(" %s at %u\n", str, forw_node->when); }
+ output( "Originator list\n" ); + }
- if ( debug_level == 4 ) - output("Originator list\n"); + list_for_each(orig_pos, &orig_list) { + orig_node = list_entry(orig_pos, struct orig_node, list); + + if ( orig_node->router == 0 ) + continue;
- if ( list_empty(&orig_list) ) { + batman_count++; + + addr_to_string( orig_node->orig, str, sizeof (str) ); + addr_to_string( orig_node->router, str2, sizeof (str2) );
if ( debug_level != 4 ) { - printf( "No batman nodes in range ...\n" ); + printf( "%s, GW: %s(%i) via:", str, str2, orig_node->packet_count ); } else { - output( "No batman nodes in range ...\n" ); + output( "%s, GW: %s(%i), last_aware:%u, last_reply:%u, last_seen:%u via:\n", str, str2, orig_node->packet_count, orig_node->last_aware, orig_node->last_reply, orig_node->last_seen ); }
- } else { - - list_for_each(orig_pos, &orig_list) { - orig_node = list_entry(orig_pos, struct orig_node, list); - - if ( orig_node->router == 0 ) - continue; - - batman_count++; + list_for_each(neigh_pos, &orig_node->neigh_list) { + neigh_node = list_entry(neigh_pos, struct neigh_node, list);
- addr_to_string( orig_node->orig, str, sizeof (str) ); - addr_to_string( orig_node->router, str2, sizeof (str2) ); + addr_to_string(neigh_node->addr, str, sizeof (str));
if ( debug_level != 4 ) { - printf( "%s, GW: %s(%i) via:", str, str2, orig_node->packet_count ); + printf( " %s(%i)", str, neigh_node->packet_count ); } else { - output("%s, GW: %s(%i), last_aware:%u, last_reply:%u, last_seen:%u via:\n", str, str2, orig_node->packet_count, orig_node->last_aware, orig_node->last_reply, orig_node->last_seen); + output( "\t\t%s (%d)\n", str, neigh_node->packet_count ); }
- list_for_each(neigh_pos, &orig_node->neigh_list) { - neigh_node = list_entry(neigh_pos, struct neigh_node, list); - - addr_to_string(neigh_node->addr, str, sizeof (str)); - - if ( debug_level != 4 ) { - printf( " %s(%i)", str, neigh_node->packet_count ); - } else { - output( "\t\t%s (%d)\n", str, neigh_node->packet_count ); - } - - if ( debug_level == 4 ) { - - list_for_each(pack_pos, &neigh_node->pack_list) { - pack_node = list_entry(pack_pos, struct pack_node, list); - output(" Sequence number: %d, TTL: %d at: %u \n", - pack_node->seqno, pack_node->ttl, pack_node->time); - } + if ( debug_level == 4 ) {
+ list_for_each(pack_pos, &neigh_node->pack_list) { + pack_node = list_entry(pack_pos, struct pack_node, list); + output(" Sequence number: %d, TTL: %d at: %u \n", + pack_node->seqno, pack_node->ttl, pack_node->time); }
}
- if ( debug_level != 4 ) - printf( "\n" ); - }
- if ( batman_count == 0 ) { + if ( debug_level != 4 ) + printf( "\n" );
- if ( debug_level != 4 ) { - printf( "No batman nodes in range ...\n" ); - } else { - output( "No batman nodes in range ...\n" ); - } + }
+ if ( batman_count == 0 ) { + + if ( debug_level != 4 ) { + printf( "No batman nodes in range ...\n" ); + } else { + output( "No batman nodes in range ...\n" ); }
}
if ( debug_level == 4 ) - output("---------------------------------------------- END DEBUG\n"); + output( "---------------------------------------------- END DEBUG\n" );
}
diff --git a/batman.h b/batman.h index fe6dbbd..3542f9a 100755 --- a/batman.h +++ b/batman.h @@ -24,7 +24,7 @@ #include <pthread.h> #include "list.h"
-#define VERSION "0.1" +#define VERSION "0.1 rc4" #define BATMAN_VERSION 1 #define PORT 1966 #define UNIDIRECTIONAL 0xF0 diff --git a/posix.c b/posix.c index fde3c28..ac597a2 100644 --- a/posix.c +++ b/posix.c @@ -565,7 +565,8 @@ void *gw_listen( void *arg ) { socklen_t sin_size = sizeof(struct sockaddr_in); char gw_addr[16], str2[16], tun_dev[IFNAMSIZ], tun_ip[] = "104.255.255.254\0"; int res, status, max_sock_min, max_sock, buff_len, tun_fd; - unsigned int addr_len, client_timeout, buff[1500]; + unsigned int addr_len, client_timeout; + unsigned char buff[1500]; fd_set wait_sockets, tmp_wait_sockets;
@@ -673,9 +674,9 @@ void *gw_listen( void *arg ) { /* client sent keep alive */ } else {
- list_for_each_safe(client_pos, client_pos_tmp, &batman_if->client_list) { + max_sock = max_sock_min;
- max_sock = max_sock_min; + list_for_each_safe(client_pos, client_pos_tmp, &batman_if->client_list) {
gw_client = list_entry(client_pos, struct gw_client, list);
@@ -798,7 +799,7 @@ int main(int argc, char *argv[]) dev = NULL; memset(&tmp_ip_holder, 0, sizeof (struct in_addr));
- while ( ( optchar = getopt ( argc, argv, "a:d:hHo:g:p:r:s:" ) ) != -1 ) { + while ( ( optchar = getopt ( argc, argv, "a:d:hHo:g:p:r:s:V" ) ) != -1 ) {
switch ( optchar ) {
@@ -956,6 +957,16 @@ int main(int argc, char *argv[]) found_args += 2; break;
+ case 'V': + printf( "B.A.T.M.A.N-III v%s (internal version %i)\n\n", VERSION, BATMAN_VERSION ); + printf( " ____________ ____________\n" ); + printf( " /` ´\ \n" ); + printf( " / _ \__^..^__/ _ \ \n" ); + printf( " _\vv/ _\n" ); + printf( " \/ \n\n" ); + printf( "May the bat guide your paths ...\n" ); + return (0); + case 'h': default: usage(); @@ -1240,6 +1251,11 @@ int main(int argc, char *argv[]) printf( "preferred gateway: %s\n", str1 ); }
+ if ( vis_server > 0 ) { + addr_to_string(vis_server, str1, sizeof (str1)); + printf( "visualisation server: %s\n", str1 ); + } + }