* [B.A.T.M.A.N.] [PATCH 1/2] batctl: fix 4addr parsing in tcpdump
@ 2013-03-31 20:03 Antonio Quartulli
2013-03-31 20:03 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: tcpdump - print subtype for UNICAST4ADDR packets Antonio Quartulli
0 siblings, 1 reply; 4+ messages in thread
From: Antonio Quartulli @ 2013-03-31 20:03 UTC (permalink / raw)
To: b.a.t.m.a.n
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>
---
tcpdump.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tcpdump.c b/tcpdump.c
index f357c6d..39239dd 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();
@@ -560,12 +560,12 @@ 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, ",
- get_name_by_macaddr((struct ether_addr *)unicast_4addr_packet->dest, read_opt),
- unicast_4addr_packet->ttvn, unicast_4addr_packet->header.ttl);
+ printf("%s: 4ADDR, subtype %d, 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);
- 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);
}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [B.A.T.M.A.N.] [PATCH 2/2] batctl: tcpdump - print subtype for UNICAST4ADDR packets
2013-03-31 20:03 [B.A.T.M.A.N.] [PATCH 1/2] batctl: fix 4addr parsing in tcpdump Antonio Quartulli
@ 2013-03-31 20:03 ` Antonio Quartulli
2013-04-02 8:41 ` Marek Lindner
0 siblings, 1 reply; 4+ messages in thread
From: Antonio Quartulli @ 2013-03-31 20:03 UTC (permalink / raw)
To: b.a.t.m.a.n
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
tcpdump.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tcpdump.c b/tcpdump.c
index 39239dd..bf4edd4 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -562,7 +562,8 @@ static void dump_batman_4addr(unsigned char *packet_buff, ssize_t buff_len, int
printf("%s: 4ADDR, subtype %d, 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),
--
1.8.1.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 2/2] batctl: tcpdump - print subtype for UNICAST4ADDR packets
2013-03-31 20:03 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: tcpdump - print subtype for UNICAST4ADDR packets Antonio Quartulli
@ 2013-04-02 8:41 ` Marek Lindner
2013-04-02 13:41 ` Antonio Quartulli
0 siblings, 1 reply; 4+ messages in thread
From: Marek Lindner @ 2013-04-02 8:41 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Monday, April 01, 2013 04:03:18 Antonio Quartulli wrote:
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
> tcpdump.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tcpdump.c b/tcpdump.c
> index 39239dd..bf4edd4 100644
> --- a/tcpdump.c
> +++ b/tcpdump.c
> @@ -562,7 +562,8 @@ static void dump_batman_4addr(unsigned char
> *packet_buff, ssize_t buff_len, int
>
> printf("%s: 4ADDR, subtype %d, 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);
>
You added the subtype printf format string with the previous patch
already. You might want to fix this.
Cheers,
Marek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 2/2] batctl: tcpdump - print subtype for UNICAST4ADDR packets
2013-04-02 8:41 ` Marek Lindner
@ 2013-04-02 13:41 ` Antonio Quartulli
0 siblings, 0 replies; 4+ messages in thread
From: Antonio Quartulli @ 2013-04-02 13:41 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]
On Tue, Apr 02, 2013 at 04:41:31PM +0800, Marek Lindner wrote:
> On Monday, April 01, 2013 04:03:18 Antonio Quartulli wrote:
> > Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> > ---
> > tcpdump.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tcpdump.c b/tcpdump.c
> > index 39239dd..bf4edd4 100644
> > --- a/tcpdump.c
> > +++ b/tcpdump.c
> > @@ -562,7 +562,8 @@ static void dump_batman_4addr(unsigned char
> > *packet_buff, ssize_t buff_len, int
> >
> > printf("%s: 4ADDR, subtype %d, 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);
> >
>
> You added the subtype printf format string with the previous patch
> already. You might want to fix this.
ops, thanks! I did not realised that when I created the two patches.
Thanks a lot.
Will send v2.
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-02 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-31 20:03 [B.A.T.M.A.N.] [PATCH 1/2] batctl: fix 4addr parsing in tcpdump Antonio Quartulli
2013-03-31 20:03 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: tcpdump - print subtype for UNICAST4ADDR packets Antonio Quartulli
2013-04-02 8:41 ` Marek Lindner
2013-04-02 13:41 ` Antonio Quartulli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).