]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: print hexdump when vendor event
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Wed, 27 Aug 2014 07:58:28 +0000 (09:58 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 3 Sep 2014 11:43:58 +0000 (13:43 +0200)
print hexdump when vendor event and -f requested

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
event.c
iw.h
util.c

diff --git a/event.c b/event.c
index 6775eb21759badde421f8b028254d5c68c28ed87..d903f9eba89fd84f9fbfd033fb14d3ec182f5065 100644 (file)
--- a/event.c
+++ b/event.c
@@ -535,6 +535,10 @@ static int print_event(struct nl_msg *msg, void *arg)
                printf("vendor event %.6x:%d\n",
                        nla_get_u32(tb[NL80211_ATTR_VENDOR_ID]),
                        nla_get_u32(tb[NL80211_ATTR_VENDOR_SUBCMD]));
+               if (args->frame && tb[NL80211_ATTR_VENDOR_DATA])
+                       iw_hexdump("vendor event",
+                                  nla_data(tb[NL80211_ATTR_VENDOR_DATA]),
+                                  nla_len(tb[NL80211_ATTR_VENDOR_DATA]));
                break;
        default:
                printf("unknown event %d (%s)\n",
diff --git a/iw.h b/iw.h
index 317f0a6e1372ec9666c8edfc35bfed32e6ec3d18..db88a868f38cc6a0e70a12f3479de637c9458f1c 100644 (file)
--- a/iw.h
+++ b/iw.h
@@ -171,6 +171,7 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
               enum print_ie_type ptype);
 
 void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
+void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
 
 DECLARE_SECTION(set);
 DECLARE_SECTION(get);
diff --git a/util.c b/util.c
index 97307ec57ad6991ed711d82cef9b650cb59e1152..ce4b0ac0ceaef35ee19d697694d1c30f766aae8e 100644 (file)
--- a/util.c
+++ b/util.c
@@ -702,3 +702,16 @@ void print_vht_info(__u32 capa, const __u8 *mcs)
        tmp = mcs[6] | (mcs[7] << 8);
        printf("\t\tVHT TX highest supported: %d Mbps\n", tmp & 0x1fff);
 }
+
+void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
+{
+       int i;
+
+       printf("%s: ", prefix);
+       for (i = 0; i < size; i++) {
+               if (i && i % 16 == 0)
+                       printf("\n%s: ", prefix);
+               printf("%02x ", buf[i]);
+       }
+       printf("\n\n");
+}