diff -Nru batctl-2011.3.0/debian/changelog batctl-2011.4.0/debian/changelog --- batctl-2011.3.0/debian/changelog 2011-10-24 19:28:58.000000000 +0000 +++ batctl-2011.4.0/debian/changelog 2012-01-19 09:39:58.000000000 +0000 @@ -1,3 +1,16 @@ +batctl (2011.4.0-2) unstable; urgency=low + + * Upload to unstable for Linux 3.2 + * Update copyright years in debian/copyright + + -- Sven Eckelmann Thu, 19 Jan 2012 10:39:27 +0100 + +batctl (2011.4.0-1) experimental; urgency=low + + * New Upstream Version + + -- Sven Eckelmann Mon, 14 Nov 2011 15:46:16 +0100 + batctl (2011.3.0-3) unstable; urgency=low * Upload to unstable for Linux 3.1 diff -Nru batctl-2011.3.0/debian/copyright batctl-2011.4.0/debian/copyright --- batctl-2011.3.0/debian/copyright 2011-10-24 19:28:58.000000000 +0000 +++ batctl-2011.4.0/debian/copyright 2012-01-19 09:39:58.000000000 +0000 @@ -16,8 +16,8 @@ License: GPL-2 Files: debian/* -Copyright: 2008-2011, Simon Wunderlich - 2008-2011, Sven Eckelmann +Copyright: 2008-2012, Simon Wunderlich + 2008-2012, Sven Eckelmann License: GPL-2 License: GPL-2 diff -Nru batctl-2011.3.0/functions.h batctl-2011.4.0/functions.h --- batctl-2011.3.0/functions.h 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/functions.h 2011-11-13 22:18:46.000000000 +0000 @@ -40,7 +40,7 @@ extern char *line_ptr; enum { - SINGLE_READ = 0x00, + NO_FLAGS = 0x00, CONT_READ = 0x01, CLR_CONT_READ = 0x02, USE_BAT_HOSTS = 0x04, diff -Nru batctl-2011.3.0/main.c batctl-2011.4.0/main.c --- batctl-2011.3.0/main.c 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/main.c 2011-11-13 22:18:46.000000000 +0000 @@ -36,9 +36,11 @@ #include "tcpdump.h" #include "bisect.h" #include "vis.h" +#include "functions.h" #include char mesh_dfl_iface[] = "bat0"; +char module_ver_path[] = "/sys/module/batman_adv/version"; void print_usage(void) { printf("Usage: batctl [options] commands \n"); @@ -58,6 +60,7 @@ printf(" \taggregation|ag [0|1] \tdisplay or modify the packet aggregation setting\n"); printf(" \tbonding|b [0|1] \tdisplay or modify the bonding mode setting\n"); printf(" \tfragmentation|f [0|1] \tdisplay or modify the fragmentation mode setting\n"); + printf(" \tap_isolation|ap [0|1] \tdisplay or modify the ap isolation mode setting\n"); printf("\n"); printf(" \tping|p \tping another batman adv host via layer 2\n"); printf(" \ttraceroute|tr \ttraceroute another batman adv host via layer 2\n"); @@ -95,7 +98,18 @@ goto err; if (strcmp(argv[1], "-v") == 0) { - printf("batctl %s\n", SOURCE_VERSION); + printf("batctl %s [batman-adv: ", SOURCE_VERSION); + + ret = read_file("", module_ver_path, USE_READ_BUFF | SILENCE_ERRORS, 0, 0); + if ((line_ptr) && (line_ptr[strlen(line_ptr) - 1] == '\n')) + line_ptr[strlen(line_ptr) - 1] = '\0'; + + if (ret == EXIT_SUCCESS) + printf("%s]\n", line_ptr); + else + printf("module not loaded]\n"); + + free(line_ptr); exit(EXIT_SUCCESS); } @@ -188,6 +202,11 @@ ret = handle_sys_setting(mesh_iface, argc - 1, argv + 1, SYS_FRAG, fragmentation_usage, sysfs_param_enable); + } else if ((strcmp(argv[1], "ap_isolation") == 0) || (strcmp(argv[1], "ap") == 0)) { + + ret = handle_sys_setting(mesh_iface, argc - 1, argv + 1, + SYS_AP_ISOLA, ap_isolation_usage, sysfs_param_enable); + } else if ((strcmp(argv[1], "bisect") == 0)) { ret = bisect(argc - 1, argv + 1); diff -Nru batctl-2011.3.0/main.h batctl-2011.4.0/main.h --- batctl-2011.3.0/main.h 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/main.h 2011-11-13 22:18:46.000000000 +0000 @@ -20,7 +20,7 @@ */ #ifndef SOURCE_VERSION -#define SOURCE_VERSION "2011.3.0" +#define SOURCE_VERSION "2011.4.0" #endif #define SOCKET_PATH_FMT "%s/batman_adv/%s/socket" diff -Nru batctl-2011.3.0/man/batctl.8 batctl-2011.4.0/man/batctl.8 --- batctl-2011.3.0/man/batctl.8 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/man/batctl.8 2011-11-13 22:18:46.000000000 +0000 @@ -51,7 +51,7 @@ .br \-h print general batctl help .br -\-v print batctl version +\-v print batctl version and batman-adv version (if the module is loaded) .br .TP .I \fBcommands: @@ -64,8 +64,8 @@ .IP "\fBinterval\fP|\fBit\fP [\fBorig_interval\fP]" If no parameter is given the current originator interval setting is displayed otherwise the parameter is used to set the originator interval. The interval is in units of milliseconds. .br -.IP "\fBloglevel\fP|\fBll\fP [\fBlevel\fP]" -If no parameter is given the current log level settings are displayed otherwise the parameter is used to set the log level. Level 0 disables all verbose logging. Level 1 enables messages related to routing / flooding / broadcasting. Level 2 enables messages related to route or tt entry added / changed / deleted. Level 3 enables all messages. The messages are sent to the batman-adv debug log. Use \fBbatctl log\fP to see them. Make sure to have debugging output enabled when compiling the module otherwise the output as well as the loglevel options won't be available. +.IP "\fBloglevel\fP|\fBll\fP [\fBlevel\fP[ \fBlevel\fP[ \fBlevel\fP]] \fB...\fP]" +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 'all' enables all messages. The messages are sent to the batman-adv debug log. Use \fBbatctl log\fP to see them. 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 replace the MAC addresses with bat\-host names in the output. @@ -152,6 +152,9 @@ .IP "\fBfragmentation\fP|\fBf\fP [\fB1\fP|\fB0\fP]" If no parameter is given the current fragmentation mode setting is displayed. Otherwise the parameter is used to enable or disable fragmentation. .br +.IP "\fBap_isolation\fP|\fBap\fP [\fB1\fP|\fB0\fP]" +If no parameter is given the current ap isolation setting is displayed. Otherwise the parameter is used to enable or disable ap isolation. +.br .IP "\fBping\fP|\fBp\fP [\fB\-c count\fP][\fB\-i interval\fP][\fB\-t time\fP][\fB\-R\fP] \fBMAC_address\fP|\fBbat\-host_name\fP" Layer 2 ping of a MAC address or bat\-host name. batctl will try to find the bat\-host name if the given parameter was not a MAC diff -Nru batctl-2011.3.0/packet.h batctl-2011.4.0/packet.h --- batctl-2011.3.0/packet.h 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/packet.h 2011-11-13 22:18:46.000000000 +0000 @@ -25,14 +25,14 @@ #define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ enum bat_packettype { - BAT_PACKET = 0x01, - BAT_ICMP = 0x02, - BAT_UNICAST = 0x03, - BAT_BCAST = 0x04, - BAT_VIS = 0x05, + BAT_OGM = 0x01, + BAT_ICMP = 0x02, + BAT_UNICAST = 0x03, + BAT_BCAST = 0x04, + BAT_VIS = 0x05, BAT_UNICAST_FRAG = 0x06, - BAT_TT_QUERY = 0x07, - BAT_ROAM_ADV = 0x08 + BAT_TT_QUERY = 0x07, + BAT_ROAM_ADV = 0x08 }; /* this file is included by batctl which needs these defines */ @@ -84,12 +84,13 @@ enum tt_client_flags { TT_CLIENT_DEL = 1 << 0, TT_CLIENT_ROAM = 1 << 1, + TT_CLIENT_WIFI = 1 << 2, TT_CLIENT_NOPURGE = 1 << 8, TT_CLIENT_NEW = 1 << 9, TT_CLIENT_PENDING = 1 << 10 }; -struct batman_packet { +struct batman_ogm_packet { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t ttl; @@ -104,7 +105,7 @@ uint16_t tt_crc; } __packed; -#define BAT_PACKET_LEN sizeof(struct batman_packet) +#define BATMAN_OGM_LEN sizeof(struct batman_ogm_packet) struct icmp_packet { uint8_t packet_type; diff -Nru batctl-2011.3.0/README batctl-2011.4.0/README --- batctl-2011.3.0/README 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/README 2011-11-13 22:18:46.000000000 +0000 @@ -84,21 +84,26 @@ batctl tcpdump =============== -tcpdump layer 2 traffic on the given interface +tcpdump layer 2 and/or layer 3 traffic on the given interface Usage: batctl tcpdump [options] interface [interface] options: -h print this help -n don't convert addresses to bat-host names -p dump specific packet type - 1 - batman ogm packets - 2 - batman icmp packets - 4 - batman unicast packets - 8 - batman broadcast packets - 16 - batman vis packets - 32 - batman fragmented packets - 64 - non batman packets - 65 - batman ogm & non batman packets + -x dump all packet types except specified +packet types: + 1 - batman ogm packets + 2 - batman icmp packets + 4 - batman unicast packets + 8 - batman broadcast packets + 16 - batman vis packets + 32 - batman fragmented packets + 64 - batman tt / roaming packets + 128 - non batman packets + 129 - batman ogm & non batman packets + +tcpdump supports standard interfaces as well as raw wifi interfaces running in monitor mode. Example output for tcpdump: @@ -228,15 +233,16 @@ Example: $ batctl originators - Originator (#/255) Nexthop [outgoingIF]: Potential nexthops ... [B.A.T.M.A.N. adv 0.2-beta r1457, MainIF/MAC: eth0/fe:fe:00:00:01:01] -fe:fe:00:00:05:01 (223) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 96) fe:fe:00:00:02:01 (223) -fe:fe:00:00:04:01 (233) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 (100) fe:fe:00:00:02:01 (233) -fe:fe:00:00:02:01 (254) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:02:01 (254) fe:fe:00:00:03:01 (100) -fe:fe:00:00:07:01 (203) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:02:01 (203) fe:fe:00:00:03:01 ( 88) -fe:fe:00:00:08:01 (196) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 0) fe:fe:00:00:02:01 (196) -fe:fe:00:00:03:01 (244) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 (104) fe:fe:00:00:02:01 (244) -fe:fe:00:00:09:01 (184) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:02:01 (184) fe:fe:00:00:03:01 ( 72) -fe:fe:00:00:06:01 (214) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 76) fe:fe:00:00:02:01 (214) +[B.A.T.M.A.N. adv 2011.4.0, MainIF/MAC: eth0/fe:fe:00:00:01:01 (bat0)] + Originator last-seen (#/255) Nexthop [outgoingIF]: Potential nexthops ... +fe:fe:00:00:08:01 0.820s (194) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 65) fe:fe:00:00:02:01 (194) +fe:fe:00:00:03:01 0.980s (245) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 81) fe:fe:00:00:02:01 (245) +fe:fe:00:00:05:01 0.140s (221) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 76) fe:fe:00:00:02:01 (221) +fe:fe:00:00:04:01 0.010s (235) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:02:01 (235) fe:fe:00:00:03:01 ( 81) +fe:fe:00:00:09:01 0.830s (187) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 63) fe:fe:00:00:02:01 (187) +fe:fe:00:00:06:01 0.830s (213) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 71) fe:fe:00:00:02:01 (213) +fe:fe:00:00:02:01 0.240s (255) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 81) fe:fe:00:00:02:01 (255) +fe:fe:00:00:07:01 0.670s (200) fe:fe:00:00:02:01 [ eth0]: fe:fe:00:00:03:01 ( 68) fe:fe:00:00:02:01 (200) batctl interface ================ @@ -290,10 +296,10 @@ Example: $ batctl loglevel -[x] all debug output disabled (0) -[ ] messages related to routing / flooding / broadcasting (1) -[ ] messages related to route or hna added / changed / deleted (2) -[ ] all debug messages (3) +[x] all debug output disabled (none) +[ ] messages related to routing / flooding / broadcasting (batman) +[ ] messages related to route added / changed / deleted (routes) +[ ] messages related to translation table operations (tt) batctl aggregation ================== @@ -313,7 +319,21 @@ $ batctl translocal Locally retrieved addresses (from bat0) announced via TT: - * d6:e0:fd:d9:00:00 + * d6:e0:fd:d9:00:00 [RPNXW] + +In particular, RPNXW are flags which have the following meanings: + +- R/Roaming: this client moved to another node but it is still kept for + consistency purposes up to the next OGM sending. +- P/noPurge: this client represents the local soft interface and has to never be + deleted. +- N/New: this client has recently been added but it has to not be advertised up + to the next OGM sending (for consistency purposes). +- X/delete: this client has to be removed for some reason, but it is still kept + for consistency purposes up to the next OGM sending. +- W/Wireless: this client is connected to the node through a Wireless device. + +If any of the flags is not enabled, a '.' will substitute its symbol. batctl transglobal ================== @@ -324,15 +344,26 @@ Example: -Globally announced TT entries received via the mesh (translation table): - * 16:aa:c4:a2:00:00 via fe:fe:00:00:09:01 - * 5a:32:f9:df:00:00 via fe:fe:00:00:03:01 - * 32:ae:5a:00:00:00 via fe:fe:00:00:04:01 - * 86:88:80:29:00:00 via fe:fe:00:00:08:01 - * 9e:d8:72:f2:00:00 via fe:fe:00:00:02:01 - * 76:84:68:49:00:00 via fe:fe:00:00:05:01 - * 86:4b:b2:d2:00:00 via fe:fe:00:00:07:01 - * ca:a1:5b:e5:00:00 via fe:fe:00:00:06:01 +Globally announced TT entries received via the mesh bat0 + Client (TTVN) Originator (Curr TTVN) Flags + * 16:aa:c4:a2:00:00 ( 12) via fe:fe:00:00:09:01 ( 50) [RXW] + +where: +- TTVN: is the translation-table-version-number which introduced this + client +- Curr TTVN: is the translation-table-version-number currently advertised by + the originator serving this client (different clients + advertised by the same originator have the same Curr TTVN) +- Flags that mean: + - R/Roaming: this client moved to another node but it is still kept for + consistency purposes up to the next OGM received from its + originator + - X/delete: this client has to be removed for some reason, but it is + still kept for consistency purposes. + - W/Wireless: this client is connected to the node through a Wireless + device. + +If any of the flags is not enabled, a '.' will substitute its symbol. batctl vis_mode ================= diff -Nru batctl-2011.3.0/sys.c batctl-2011.4.0/sys.c --- batctl-2011.3.0/sys.c 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/sys.c 2011-11-13 22:18:46.000000000 +0000 @@ -79,7 +79,7 @@ while ((iface_dir = readdir(iface_base_dir)) != NULL) { snprintf(path_buff, PATH_BUFF_LEN, SYS_MESH_IFACE_FMT, iface_dir->d_name); - res = read_file("", path_buff, SINGLE_READ | USE_READ_BUFF | SILENCE_ERRORS, 0, 0); + res = read_file("", path_buff, USE_READ_BUFF | SILENCE_ERRORS, 0, 0); if (res != EXIT_SUCCESS) continue; @@ -96,7 +96,7 @@ line_ptr = NULL; snprintf(path_buff, PATH_BUFF_LEN, SYS_IFACE_STATUS_FMT, iface_dir->d_name); - res = read_file("", path_buff, SINGLE_READ | USE_READ_BUFF | SILENCE_ERRORS, 0, 0); + res = read_file("", path_buff, USE_READ_BUFF | SILENCE_ERRORS, 0, 0); if (res != EXIT_SUCCESS) { printf("\n"); continue; @@ -174,16 +174,24 @@ static void log_level_usage(void) { - printf("Usage: batctl [options] loglevel [level]\n"); + printf("Usage: batctl [options] loglevel [level[ level[ level]]...]\n"); printf("options:\n"); printf(" \t -h print this help\n"); + printf("levels:\n"); + printf(" \t none Debug logging is disabled\n"); + printf(" \t all Print messages from all below\n"); + printf(" \t batman Messages related to routing / flooding / broadcasting\n"); + printf(" \t routes Messages related to route added / changed / deleted\n"); + printf(" \t tt Messages related to translation table operations\n"); } int handle_loglevel(char *mesh_iface, int argc, char **argv) { int optchar, res; - int log_level; + int log_level = 0; char *path_buff; + char str[4]; + int i; while ((optchar = getopt(argc, argv, "h")) != -1) { switch (optchar) { @@ -200,25 +208,44 @@ snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT, mesh_iface); if (argc != 1) { - res = write_file(path_buff, SYS_LOG_LEVEL, argv[1], NULL); + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "none") == 0) { + log_level = 0; + break; + } else if (strcmp(argv[i], "all") == 0) { + log_level = 15; + break; + } else if (strcmp(argv[i], "batman") == 0) + log_level |= (1 << 0); + else if (strcmp(argv[i], "routes") == 0) + log_level |= (1 << 1); + else if (strcmp(argv[i], "tt") == 0) + log_level |= (1 << 2); + else + log_level_usage(); + } + + snprintf(str, sizeof(str), "%i", log_level); + res = write_file(path_buff, SYS_LOG_LEVEL, str, NULL); goto out; } - res = read_file(path_buff, SYS_LOG_LEVEL, SINGLE_READ | USE_READ_BUFF, 0, 0); + res = read_file(path_buff, SYS_LOG_LEVEL, USE_READ_BUFF, 0, 0); if (res != EXIT_SUCCESS) goto out; log_level = strtol(line_ptr, (char **) NULL, 10); - printf("[%c] %s (%d)\n", (!log_level) ? 'x' : ' ', - "all debug output disabled", 0); - printf("[%c] %s (%d)\n", (log_level & 1) ? 'x' : ' ', - "messages related to routing / flooding / broadcasting", 1); - printf("[%c] %s (%d)\n", (log_level & 2) ? 'x' : ' ', - "messages related to route added / changed / deleted", 2); - printf("[%c] %s (%d)\n", (log_level & 4) ? 'x' : ' ', - "messages related to translation table operations", 4); + printf("[%c] %s (%s)\n", (!log_level) ? 'x' : ' ', + "all debug output disabled", "none"); + printf("[%c] %s (%s)\n", (log_level & 1) ? 'x' : ' ', + "messages related to routing / flooding / broadcasting", + "batman"); + printf("[%c] %s (%s)\n", (log_level & 2) ? 'x' : ' ', + "messages related to route added / changed / deleted", "routes"); + printf("[%c] %s (%s)\n", (log_level & 4) ? 'x' : ' ', + "messages related to translation table operations", "tt"); out: if (errno == ENOENT) @@ -270,6 +297,13 @@ printf(" \t -h print this help\n"); } +void ap_isolation_usage(void) +{ + printf("Usage: batctl [options] ap_isolation [0|1]\n"); + printf("options:\n"); + printf(" \t -h print this help\n"); +} + int handle_sys_setting(char *mesh_iface, int argc, char **argv, char *file_path, void setting_usage(void), const char *sysfs_param[]) @@ -293,7 +327,7 @@ snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT, mesh_iface); if (argc == 1) { - res = read_file(path_buff, file_path, SINGLE_READ, 0, 0); + res = read_file(path_buff, file_path, NO_FLAGS, 0, 0); goto out; } @@ -348,7 +382,7 @@ snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT, mesh_iface); if (argc == 1) { - res = read_file(path_buff, SYS_GW_MODE, SINGLE_READ | USE_READ_BUFF, 0, 0); + res = read_file(path_buff, SYS_GW_MODE, USE_READ_BUFF, 0, 0); if (res != EXIT_SUCCESS) goto out; @@ -368,10 +402,10 @@ switch (gw_mode) { case GW_MODE_CLIENT: - res = read_file(path_buff, SYS_GW_SEL, SINGLE_READ | USE_READ_BUFF, 0, 0); + res = read_file(path_buff, SYS_GW_SEL, USE_READ_BUFF, 0, 0); break; case GW_MODE_SERVER: - res = read_file(path_buff, SYS_GW_BW, SINGLE_READ | USE_READ_BUFF, 0, 0); + res = read_file(path_buff, SYS_GW_BW, USE_READ_BUFF, 0, 0); break; default: printf("off\n"); diff -Nru batctl-2011.3.0/sys.h batctl-2011.4.0/sys.h --- batctl-2011.3.0/sys.h 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/sys.h 2011-11-13 22:18:46.000000000 +0000 @@ -34,6 +34,7 @@ #define SYS_MESH_IFACE_FMT SYS_IFACE_PATH"/%s/batman_adv/mesh_iface" #define SYS_IFACE_STATUS_FMT SYS_IFACE_PATH"/%s/batman_adv/iface_status" #define SYS_FRAG "fragmentation" +#define SYS_AP_ISOLA "ap_isolation" enum gw_modes { GW_MODE_OFF, @@ -47,6 +48,7 @@ void aggregation_usage(void); void bonding_usage(void); void fragmentation_usage(void); +void ap_isolation_usage(void); void gw_mode_usage(void); void vis_mode_usage(void); void orig_interval_usage(void); diff -Nru batctl-2011.3.0/tcpdump.c batctl-2011.4.0/tcpdump.c --- batctl-2011.3.0/tcpdump.c 2011-08-03 07:18:41.000000000 +0000 +++ batctl-2011.4.0/tcpdump.c 2011-11-13 22:18:46.000000000 +0000 @@ -318,27 +318,27 @@ static void dump_batman_ogm(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed) { struct ether_header *ether_header; - struct batman_packet *batman_packet; + struct batman_ogm_packet *batman_ogm_packet; - LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct batman_packet), "BAT OGM"); + LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct batman_ogm_packet), "BAT OGM"); ether_header = (struct ether_header *)packet_buff; - batman_packet = (struct batman_packet *)(packet_buff + sizeof(struct ether_header)); + batman_ogm_packet = (struct batman_ogm_packet *)(packet_buff + sizeof(struct ether_header)); if (!time_printed) print_time(); printf("BAT %s: ", - get_name_by_macaddr((struct ether_addr *)batman_packet->orig, read_opt)); + get_name_by_macaddr((struct ether_addr *)batman_ogm_packet->orig, read_opt)); - printf("OGM via neigh %s, seq %u, tq %3d, ttvn %d, ttcrc %d, ttl %2d, v %d, flags [%c%c%c%c], length %zu\n", + printf("OGM via neigh %s, seq %u, tq %3d, ttvn %d, ttcrc %hu, ttl %2d, v %d, flags [%c%c%c%c], length %zu\n", get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt), - ntohl(batman_packet->seqno), batman_packet->tq, batman_packet->ttvn, - ntohl(batman_packet->tt_crc), batman_packet->ttl, batman_packet->version, - (batman_packet->flags & DIRECTLINK ? 'D' : '.'), - (batman_packet->flags & VIS_SERVER ? 'V' : '.'), - (batman_packet->flags & PRIMARIES_FIRST_HOP ? 'F' : '.'), - (batman_packet->gw_flags ? 'G' : '.'), + ntohl(batman_ogm_packet->seqno), batman_ogm_packet->tq, batman_ogm_packet->ttvn, + ntohs(batman_ogm_packet->tt_crc), batman_ogm_packet->ttl, batman_ogm_packet->version, + (batman_ogm_packet->flags & DIRECTLINK ? 'D' : '.'), + (batman_ogm_packet->flags & VIS_SERVER ? 'V' : '.'), + (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP ? 'F' : '.'), + (batman_ogm_packet->gw_flags ? 'G' : '.'), (size_t)buff_len - sizeof(struct ether_header)); } @@ -469,7 +469,7 @@ static void parse_eth_hdr(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed) { - struct batman_packet *batman_packet; + struct batman_ogm_packet *batman_ogm_packet; struct ether_header *eth_hdr; eth_hdr = (struct ether_header *)packet_buff; @@ -488,10 +488,10 @@ dump_vlan(packet_buff, buff_len, read_opt, time_printed); break; case ETH_P_BATMAN: - batman_packet = (struct batman_packet *)(packet_buff + ETH_HLEN); + batman_ogm_packet = (struct batman_ogm_packet *)(packet_buff + ETH_HLEN); - switch (batman_packet->packet_type) { - case BAT_PACKET: + switch (batman_ogm_packet->packet_type) { + case BAT_OGM: if (dump_level & DUMP_TYPE_BATOGM) dump_batman_ogm(packet_buff, buff_len, read_opt, time_printed); break; @@ -524,7 +524,7 @@ dump_batman_roam(packet_buff, buff_len, read_opt, time_printed); break; default: - printf("Warning - packet contains unknown batman packet type: 0x%02x\n", batman_packet->packet_type); + printf("Warning - packet contains unknown batman packet type: 0x%02x\n", batman_ogm_packet->packet_type); break; }