The following commit has been merged in the next branch:
commit 2f58a5d6f890ed575063ced0695239ba569ad649
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Fri Aug 19 00:35:55 2011 +0200
batctl: rename all instances of batman_packet to batman_ogm_packet
The follow-up routing code changes are going to introduce additional
routing packet types which make this distinction necessary.
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
diff --git a/packet.h b/packet.h
index 8802eab..4d9e54c 100644
--- a/packet.h
+++ b/packet.h
@@ -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 */
@@ -90,7 +90,7 @@ enum tt_client_flags {
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;
@@ -105,7 +105,7 @@ struct batman_packet {
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 --git a/tcpdump.c b/tcpdump.c
index 0e69431..977bedc 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -318,27 +318,27 @@ static void dump_batman_roam(unsigned char *packet_buff, ssize_t buff_len, int r
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",
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,
+ ntohl(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 dump_batman_frag(unsigned char *packet_buff, ssize_t buff_len, int r
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 @@ static void parse_eth_hdr(unsigned char *packet_buff, ssize_t buff_len, int read
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 @@ static void parse_eth_hdr(unsigned char *packet_buff, ssize_t buff_len, int read
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;
}
--
batctl