From e969407e2c7c725bf984fc6b46ff420aace02c60 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 10 Aug 2014 21:48:22 -0700 Subject: [PATCH] monitor: Add support for decoding cipher suites attribute --- monitor/nlmon.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/monitor/nlmon.c b/monitor/nlmon.c index 2386263e..2f2ac014 100644 --- a/monitor/nlmon.c +++ b/monitor/nlmon.c @@ -329,7 +329,22 @@ static void print_key_cipher(unsigned int level, const char *label, } } - print_attr(level, "%s: %s (0x%08x)", label, str, cipher); + if (label) + print_attr(level, "%s: %s (0x%08x)", label, str, cipher); + else + print_attr(level, "%s (0x%08x)", str, cipher); +} + +static void print_cipher_suites(unsigned int level, const char *label, + const void *data, uint16_t size) +{ + print_attr(level, "%s: len %u", label, size); + + while (size > 4) { + print_key_cipher(level + 1, NULL, data, 4); + data += 4; + size -= 4; + } } typedef void (*attr_func_t) (unsigned int level, const char *label, @@ -644,7 +659,8 @@ static const struct attr_entry attr_table[] = { { NL80211_ATTR_MAX_SCAN_IE_LEN, "Max Scan IE Length", ATTR_U16 }, { NL80211_ATTR_CIPHER_SUITES, - "Cipher Suites" }, + "Cipher Suites", ATTR_CUSTOM, + { .function = print_cipher_suites } }, { NL80211_ATTR_FREQ_BEFORE, "Frequency Before" }, { NL80211_ATTR_FREQ_AFTER,