From: Vadim Kochan <[email protected]>

Signed-off-by: Vadim Kochan <[email protected]>
---
 proto_80211_mac_hdr.c | 9 +++++++++
 str.c                 | 8 ++++++++
 str.h                 | 1 +
 3 files changed, 18 insertions(+)

diff --git a/proto_80211_mac_hdr.c b/proto_80211_mac_hdr.c
index 9bd6ee1..41ce265 100644
--- a/proto_80211_mac_hdr.c
+++ b/proto_80211_mac_hdr.c
@@ -23,6 +23,7 @@
 #include "pkt_buff.h"
 #include "oui.h"
 #include "linktype.h"
+#include "str.h"
 
 #define        TU              0.001024
 
@@ -3151,10 +3152,18 @@ static void ieee80211(struct pkt_buff *pkt)
 
        if (pkt->link_type == LINKTYPE_IEEE802_11_RADIOTAP) {
                struct ieee80211_radiotap_header *rtap;
+               char flags_bits_str[33] = {0};
 
                rtap = (struct ieee80211_radiotap_header *)pkt_pull(pkt,
                                sizeof(*rtap));
 
+               tprintf(" [ Radiotap ");
+               tprintf("Version (%u), ", rtap->version);
+               tprintf("Length (%u), ", le16_to_cpu(rtap->len));
+               tprintf("Flags (0x%x -> %sb) ]\n", le32_to_cpu(rtap->present),
+                       bits_to_str(le32_to_cpu(rtap->present), 32,
+                       &flags_bits_str[0]));
+
                pkt_pull(pkt, le16_to_cpu(rtap->len) - sizeof(*rtap));
        }
 
diff --git a/str.c b/str.c
index 7a5cb49..0579f76 100644
--- a/str.c
+++ b/str.c
@@ -86,3 +86,11 @@ char *strtrim_right(char *p, char c)
 
        return p;
 }
+
+char *bits_to_str(int val, int len, char *str)
+{
+       for (; val && len; --len, val >>= 1)
+               str[len] = val % 2 ? '1' : '0';
+
+       return &str[len + 1];
+}
diff --git a/str.h b/str.h
index 7b8916c..4603e93 100644
--- a/str.h
+++ b/str.h
@@ -8,5 +8,6 @@ extern int slprintf(char *dst, size_t size, const char *fmt, 
...)  __check_forma
 extern int slprintf_nocheck(char *dst, size_t size, const char *fmt, ...);
 extern char *strtrim_right(char *p, char c);
 extern noinline void *xmemset(void *s, int c, size_t n);
+extern char *bits_to_str(int val, int bits_len, char *str);
 
 #endif /* STR_H */
-- 
2.3.1

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to