batctl: tcpdump - parse TVLV containers
PATCH v3 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.
Signed-off-by Antonio Quartulli <[email protected]>
---
changes since v2:
- extended doc in README and manpage
changes since v1:
- remove all the style changes
- make tvlv_len of type ssize_t in dump_batman_iv_ogm()
README | 1 + main.h | 7 +++ man/batctl.8 | 3 ++ tcpdump.c | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- tcpdump.h | 1 + 5 files changed, 177 insertions(+), 5 deletions(-)
README +1 -0
@@ -161,6 +161,7 @@ packet types: 2 - batman icmp packets 4 - batman unicast packets 8 - batman broadcast packets + 16 - batman unicast tvlv packets 32 - batman fragmented packets 64 - batman tt / roaming packets 128 - non batman packets
main.h +7 -0
@@ -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
man/batctl.8 +3 -0
@@ -288,6 +288,9 @@ except specified). The following packet types are available: 8 - batman broadcast packets .RE .RS 16 +16 - batman unicast tvlv packets +.RE +.RS 16 32 - batman fragmented packets .RE .RS 16
tcpdump.c +165 -5
213 lines not on this page · raw message
tcpdump.h +1 -0
@@ -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