* [PATCH 01/12] iwmon: add support for new key format
@ 2021-10-04 16:48 James Prestwood
0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2021-10-04 16:48 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]
The kernel has two ways SET_KEY/NEW_KEY messages can be structured.
This implements parsers for the new key format.
---
monitor/nlmon.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 71 insertions(+), 1 deletion(-)
diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index 728d7857..6ded9aa2 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -5863,6 +5863,76 @@ static void print_scan_flags(unsigned int level, const char *label,
}
}
+static void print_key_type(unsigned int level, const char *label,
+ const void *data, uint16_t size)
+{
+ const uint8_t *ptr = data;
+ const char *str;
+
+ switch (*ptr) {
+ case NL80211_KEYTYPE_GROUP:
+ str = "Group";
+ break;
+ case NL80211_KEYTYPE_PAIRWISE:
+ str = "Pairwise";
+ break;
+ case NL80211_KEYTYPE_PEERKEY:
+ str = "Peerkey";
+ break;
+ default:
+ str = "Unknown";
+ }
+
+ print_attr(level, "%s: %s", label, str);
+}
+
+static void print_key_mode(unsigned int level, const char *label,
+ const void *data, uint16_t size)
+{
+ const uint8_t *ptr = data;
+ const char *str;
+
+ switch (*ptr) {
+ case NL80211_KEY_RX_TX:
+ str = "RX/TX";
+ break;
+ case NL80211_KEY_NO_TX:
+ str = "RX Only";
+ break;
+ case NL80211_KEY_SET_TX:
+ str = "Set TX";
+ break;
+ default:
+ str = "Unknown";
+ }
+
+ print_attr(level, "%s: %s", label, str);
+}
+
+static const struct attr_entry default_key_type_table[] = {
+ { NL80211_KEY_DEFAULT_TYPE_UNICAST, "Unicast", ATTR_FLAG },
+ { NL80211_KEY_DEFAULT_TYPE_MULTICAST, "Multicast", ATTR_FLAG },
+ { }
+};
+
+static const struct attr_entry key_table[] = {
+ { NL80211_KEY_DATA, "Key Data", ATTR_BINARY },
+ { NL80211_KEY_IDX, "Key Index", ATTR_U8 },
+ { NL80211_KEY_CIPHER, "Key Cipher", ATTR_CUSTOM,
+ { .function = print_cipher_suite } },
+ { NL80211_KEY_SEQ, "Key Sequence", ATTR_BINARY },
+ { NL80211_KEY_DEFAULT, "Default", ATTR_FLAG },
+ { NL80211_KEY_DEFAULT_MGMT, "Default Management", ATTR_FLAG },
+ { NL80211_KEY_TYPE, "Key Type", ATTR_CUSTOM,
+ { .function = print_key_type} },
+ { NL80211_KEY_DEFAULT_TYPES, "Default Key Types", ATTR_NESTED,
+ { default_key_type_table } },
+ { NL80211_KEY_MODE, "Key Mode", ATTR_CUSTOM,
+ { .function = print_key_mode } },
+ { NL80211_KEY_DEFAULT_BEACON, "Default Beacon", ATTR_FLAG },
+ { }
+};
+
static const struct attr_entry attr_table[] = {
{ NL80211_ATTR_WIPHY,
"Wiphy", ATTR_U32 },
@@ -6038,7 +6108,7 @@ static const struct attr_entry attr_table[] = {
{ NL80211_ATTR_PREV_BSSID,
"Previous BSSID", ATTR_ADDRESS },
{ NL80211_ATTR_KEY,
- "Key" },
+ "Key", ATTR_NESTED, { key_table } },
{ NL80211_ATTR_KEYS,
"Keys" },
{ NL80211_ATTR_PID,
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 01/12] iwmon: add support for new key format
@ 2021-10-04 18:43 Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-10-04 18:43 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
Hi James,
On 10/4/21 11:48 AM, James Prestwood wrote:
> The kernel has two ways SET_KEY/NEW_KEY messages can be structured.
> This implements parsers for the new key format.
> ---
> monitor/nlmon.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 71 insertions(+), 1 deletion(-)
>
Patch 1 & 2 applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-04 18:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 16:48 [PATCH 01/12] iwmon: add support for new key format James Prestwood
2021-10-04 18:43 Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.