Skip to contentSkip to conversation

batctl: tcpdump - parse TVLV containers

PATCH Superseded Antonio Quartulli 2 participants 2 messages Jun 26, 2014 – Jul 19, 2014

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 batctl: tcpdump - parse TVLV containers

From: Antonio Quartulli <[email protected]>

OGMs and unicast TVLV packets carry TVLV containers as payload.
With this patch such containers are now parsed and the relevant information is printed to screen.

Moreover, the parts of code that have been touched by this patch have also been re-arranged a bit from the style point of view.

---

changes since v1:
- remove all the style changes
- make tvlv_len of type ssize_t in dump_batman_iv_ogm()

 main.h    |   7 +++
 tcpdump.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 tcpdump.h |   1 +
 3 files changed, 173 insertions(+), 5 deletions(-)
main.h +7 -0
index 2557c56..dbf7912 100644
@@ -49,4 +49,11 @@
 
 extern char module_ver_path[];
 
+#ifndef VLAN_VID_MASK
+#define VLAN_VID_MASK   0xfff
+#endif
+
+#define BATADV_PRINT_VID(vid) (vid & BATADV_VLAN_HAS_TAG ? \
+			       (int)(vid & VLAN_VID_MASK) : -1)
+
 #endif
tcpdump.c +165 -5

213 lines not on this page · raw message

tcpdump.h +1 -0
index cfb1c69..5d936f2 100644
@@ -41,6 +41,7 @@
 #define DUMP_TYPE_BATICMP 2
 #define DUMP_TYPE_BATUCAST 4
 #define DUMP_TYPE_BATBCAST 8
+#define DUMP_TYPE_BATUTVLV 16
 #define DUMP_TYPE_BATFRAG 32
 #define DUMP_TYPE_NONBAT 128
 
Signature · 1 line
1.8.5.5
#1 lore raw

tcpdump.c static void tcpdump_usage(void) · line 87

Quoted 7 lines · On Thursday 26 June 2014 09:47:20 Antonio Quartulli wrote:
tcpdump.c +1 -0
@@ -83,6 +82,7 @@ static void tcpdump_usage(void)
        fprintf(stderr, " \t\t%3d - batman unicast packets\n", DUMP_TYPE_BATUCAST); 
        fprintf(stderr, " \t\t%3d - batman broadcast packets\n", DUMP_TYPE_BATBCAST);
        fprintf(stderr, " \t\t%3d - batman fragmented packets\n", DUMP_TYPE_BATFRAG); 
+       fprintf(stderr, " \t\t%3d - batman unicast tvlv packets\n", DUMP_TYPE_BATUTVLV);
        fprintf(stderr, " \t\t%3d - non batman packets\n", DUMP_TYPE_NONBAT);
        fprintf(stderr, " \t\t%3d - batman ogm & non batman packets\n", DUMP_TYPE_BATOGM | DUMP_TYPE_NONBAT); }

Manpage and README update ?

Cheers,
Marek