In the UNICAST4ADDR parsing routing a wrong type is used to parse the batman header, resulting in a wrong data visualization. Fix this by using the correct data type.
Introduced by 70aefcf8abefd509e5721c6ae228d3854d5e8b16 ("batctl: Add minimal unicast 4addr dissector support")
Signed-off-by: Antonio Quartulli ordex@autistici.org ---
v2: - removed subtype print format
tcpdump.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tcpdump.c b/tcpdump.c index f357c6d..f69ac6f 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -545,14 +545,14 @@ static void dump_batman_frag(unsigned char *packet_buff, ssize_t buff_len, int r static void dump_batman_4addr(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed) { struct ether_header *ether_header; - struct batadv_unicast_packet *unicast_4addr_packet; + struct batadv_unicast_4addr_packet *unicast_4addr_packet;
- LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct batadv_unicast_packet), "BAT 4ADDR"); - LEN_CHECK((size_t)buff_len - sizeof(struct ether_header) - sizeof(struct batadv_unicast_packet), + LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct batadv_unicast_4addr_packet), "BAT 4ADDR"); + LEN_CHECK((size_t)buff_len - sizeof(struct ether_header) - sizeof(struct batadv_unicast_4addr_packet), sizeof(struct ether_header), "BAT 4ADDR (unpacked)");
ether_header = (struct ether_header *)packet_buff; - unicast_4addr_packet = (struct batadv_unicast_packet *)(packet_buff + sizeof(struct ether_header)); + unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)(packet_buff + sizeof(struct ether_header));
if (!time_printed) time_printed = print_time(); @@ -561,11 +561,11 @@ static void dump_batman_4addr(unsigned char *packet_buff, ssize_t buff_len, int get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt));
printf("%s: 4ADDR, ttvn %d, ttl %hhu, ", - get_name_by_macaddr((struct ether_addr *)unicast_4addr_packet->dest, read_opt), - unicast_4addr_packet->ttvn, unicast_4addr_packet->header.ttl); + get_name_by_macaddr((struct ether_addr *)unicast_4addr_packet->u.dest, read_opt), + unicast_4addr_packet->u.ttvn, unicast_4addr_packet->u.header.ttl);
- parse_eth_hdr(packet_buff + ETH_HLEN + sizeof(struct batadv_unicast_packet), - buff_len - ETH_HLEN - sizeof(struct batadv_unicast_packet), + parse_eth_hdr(packet_buff + ETH_HLEN + sizeof(struct batadv_unicast_4addr_packet), + buff_len - ETH_HLEN - sizeof(struct batadv_unicast_4addr_packet), read_opt, time_printed); }
Signed-off-by: Antonio Quartulli ordex@autistici.org ---
v2: - added subtype print format
tcpdump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tcpdump.c b/tcpdump.c index f69ac6f..b4cfec9 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -560,9 +560,10 @@ static void dump_batman_4addr(unsigned char *packet_buff, ssize_t buff_len, int printf("BAT %s > ", get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost, read_opt));
- printf("%s: 4ADDR, ttvn %d, ttl %hhu, ", + printf("%s: 4ADDR, subtybe %hhu, ttvn %d, ttl %hhu, ", get_name_by_macaddr((struct ether_addr *)unicast_4addr_packet->u.dest, read_opt), - unicast_4addr_packet->u.ttvn, unicast_4addr_packet->u.header.ttl); + unicast_4addr_packet->subtype, unicast_4addr_packet->u.ttvn, + unicast_4addr_packet->u.header.ttl);
parse_eth_hdr(packet_buff + ETH_HLEN + sizeof(struct batadv_unicast_4addr_packet), buff_len - ETH_HLEN - sizeof(struct batadv_unicast_4addr_packet),
On Wednesday, April 03, 2013 04:34:30 Antonio Quartulli wrote:
Signed-off-by: Antonio Quartulli ordex@autistici.org
v2:
- added subtype print format
tcpdump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Applied in revision 02921f7.
Thanks, Marek
On Wednesday, April 03, 2013 04:34:29 Antonio Quartulli wrote:
In the UNICAST4ADDR parsing routing a wrong type is used to parse the batman header, resulting in a wrong data visualization. Fix this by using the correct data type.
Introduced by 70aefcf8abefd509e5721c6ae228d3854d5e8b16 ("batctl: Add minimal unicast 4addr dissector support")
Signed-off-by: Antonio Quartulli ordex@autistici.org
v2:
- removed subtype print format
tcpdump.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Applied in revision 0ae03c9.
Thanks, Marek
b.a.t.m.a.n@lists.open-mesh.org