Skip to contentSkip to conversation

batctl: tcpdump - parse TVLV containers

PATCH Superseded Antonio Quartulli 2 participants 4 messages Jun 26, 2014

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 main.h    |   7 +++
 tcpdump.c | 199 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 tcpdump.h |  13 ++--
 3 files changed, 199 insertions(+), 20 deletions(-)
main.h +7 -0
index c68801a..1c444dd 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 +185 -14

248 lines not on this page · raw message

tcpdump.h +7 -6
index cfb1c69..328f19f 100644
@@ -37,12 +37,13 @@
 #define ARPHRD_IEEE80211_RADIOTAP 803
 #endif
 
-#define DUMP_TYPE_BATOGM 1
-#define DUMP_TYPE_BATICMP 2
-#define DUMP_TYPE_BATUCAST 4
-#define DUMP_TYPE_BATBCAST 8
-#define DUMP_TYPE_BATFRAG 32
-#define DUMP_TYPE_NONBAT 128
+#define DUMP_TYPE_BATOGM	BIT(0)
+#define DUMP_TYPE_BATICMP	BIT(1)
+#define DUMP_TYPE_BATUCAST	BIT(2)
+#define DUMP_TYPE_BATBCAST	BIT(3)
+#define DUMP_TYPE_BATFRAG	BIT(4)
+#define DUMP_TYPE_BATUTVLV	BIT(5)
+#define DUMP_TYPE_NONBAT	BIT(6)
 
 #define IEEE80211_FCTL_FTYPE 0x0c00
 #define IEEE80211_FCTL_TODS 0x0001
Signature · 1 line
1.8.5.5
#1 lore raw
Quoted 3 lines · On Thursday 26 June 2014 02:24:00 Antonio Quartulli wrote:

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.

Can you please split the new features from the style changes ?

Thanks,
Marek

#2 lore raw
Quoted 6 lines · Marek Lindner
Quoted 3 lines · On Thursday 26 June 2014 02:24:00 Antonio Quartulli wrote:

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.

Can you please split the new features from the style changes ?

Oky, I can, but most of the style changes are done on lines that I am already changing (in the worst case they are happening at the line above or below - like for the introduction of the BIT macros).

Shall I keep those ? Or I should just make no style change in the patch?

Cheers,

Signature · 1 line
Antonio Quartulli
#3 lore raw
Quoted 6 lines · On Thursday 26 June 2014 08:21:28 Antonio Quartulli wrote:
Quoted 5 lines · Marek Lindner
Quoted 3 lines · On Thursday 26 June 2014 02:24:00 Antonio Quartulli wrote:

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.

Quoted 7 lines
Quoted 1 line

Can you please split the new features from the style changes ?

Oky, I can, but most of the style changes are done on lines that I am already changing (in the worst case they are happening at the line above or below - like for the introduction of the BIT macros).

Shall I keep those ? Or I should just make no style change in the patch?

No mix of style patches and feature patches please.

Thanks,
Marek