Skip to contentSkip to conversation

doc: document Security diagnostic value

PATCH In review James Prestwood 2 participants 5 messages Mar 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 doc: document Security diagnostic value

---
 doc/station-diagnostic-api.txt | 2 ++
 1 file changed, 2 insertions(+)

v3:
* Updated AKMSuite to Security

doc/station-diagnostic-api.txt +2 -0
index b5a73b5d..d1a340ad 100644
@@ -23,6 +23,8 @@ Methods		dict GetDiagnostics()
 
 			Frequency - Frequency of currently connected BSS.
 
+			Security - The chosen security for the connection.
+
 			RSSI [optional] - The RSSI of the currently connected BSS.
 
 			AverageRSSI [optional] - Average RSSI of currently connected BSS.
Signature · 1 line
2.26.2
#1 lore raw

PATCH v3 2/4 diagnostic: add diagnostic_akm_suite_to_security

Converts ie_rsn_akm_suite values (and WPA1 hint) into a more human readable security string such as:

WPA2-Personal, WPA3-Personal, WPA2-Personal + FT etc.

---
 src/diagnostic.c | 41 +++++++++++++++++++++++++++++++++++++++++
 src/diagnostic.h |  5 +++++
 2 files changed, 46 insertions(+)

v3:
* Added wpa1 hint
* Moved this from ie.c into diagnostic.c

src/diagnostic.c +41 -0
index d690cf3a..a7d9c52c 100644
@@ -28,6 +28,7 @@
 
 #include "src/diagnostic.h"
 #include "src/dbus.h"
+#include "src/ie.h"
 
 /*
  * Appends values from diagnostic_station_info into a DBus dictionary. This
@@ -111,3 +112,43 @@ bool diagnostic_info_to_dict(const struct diagnostic_station_info *info,
 
 	return true;
 }
+
+const char *diagnostic_akm_suite_to_security(enum ie_rsn_akm_suite akm,
+						bool wpa)
+{
+	switch (akm) {
+	case IE_RSN_AKM_SUITE_8021X:
+	case IE_RSN_AKM_SUITE_8021X_SHA256:
+		return "WPA2-Enterprise";
+	case IE_RSN_AKM_SUITE_PSK:
+	case IE_RSN_AKM_SUITE_PSK_SHA256:
+		if (wpa)
+			return "WPA1-Personal";
+
+		return "WPA2-Personal";
+	case IE_RSN_AKM_SUITE_FT_OVER_8021X:
+	case IE_RSN_AKM_SUITE_FT_OVER_8021X_SHA384:
+		return "WPA2-Enterprise + FT";
+	case IE_RSN_AKM_SUITE_FT_USING_PSK:
+		if (wpa)
+			return "WPA1-Personal + FT";
+
+		return "WPA2-Personal + FT";
+	case IE_RSN_AKM_SUITE_SAE_SHA256:
+		return "WPA3-Personal";
+	case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
+		return "WPA3-Personal + FT";
+	case IE_RSN_AKM_SUITE_OWE:
+		return "OWE";
+	case IE_RSN_AKM_SUITE_FILS_SHA256:
+	case IE_RSN_AKM_SUITE_FILS_SHA384:
+		return "FILS";
+	case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
+	case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
+		return "FILS + FT";
+	case IE_RSN_AKM_SUITE_OSEN:
+		return "OSEN";
+	default:
+		return NULL;
+	}
+}
src/diagnostic.h +5 -0
index dab45c0b..fd965839 100644
@@ -20,6 +20,8 @@
  *
  */
 
+enum ie_rsn_akm_suite;
+
 enum diagnostic_mcs_type {
 	DIAGNOSTIC_MCS_TYPE_NONE,
 	DIAGNOSTIC_MCS_TYPE_HT,
@@ -52,3 +54,6 @@ struct diagnostic_station_info {
 
 bool diagnostic_info_to_dict(const struct diagnostic_station_info *info,
 				struct l_dbus_message_builder *builder);
+
+const char *diagnostic_akm_suite_to_security(enum ie_rsn_akm_suite suite,
+						bool wpa);
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH v3 2/4] diagnostic: add diagnostic_akm_suite_to_security

Hi James,

Quoted 13 lines · James Prestwood

Converts ie_rsn_akm_suite values (and WPA1 hint) into a more human readable security string such as:

WPA2-Personal, WPA3-Personal, WPA2-Personal + FT etc.

---
  src/diagnostic.c | 41 +++++++++++++++++++++++++++++++++++++++++
  src/diagnostic.h |  5 +++++
  2 files changed, 46 insertions(+)

v3:
* Added wpa1 hint
* Moved this from ie.c into diagnostic.c

<snip>

src/diagnostic.c bool diagnostic_info_to_dict(const struct diagnostic_station_info *info, · line 120

Quoted 6 lines
src/diagnostic.c +6 -0
+
+const char *diagnostic_akm_suite_to_security(enum ie_rsn_akm_suite akm,
+						bool wpa)
+{
+	switch (akm) {
+	case IE_RSN_AKM_SUITE_8021X:

FYI, there is in theory WPA1-Enterprise, but I've never seen that in the wild...

src/diagnostic.c bool diagnostic_info_to_dict(const struct diagnostic_station_info *info, · line 124

Quoted 4 lines
src/diagnostic.c +4 -0
+	case IE_RSN_AKM_SUITE_8021X_SHA256:
+		return "WPA2-Enterprise";
+	case IE_RSN_AKM_SUITE_PSK:
+	case IE_RSN_AKM_SUITE_PSK_SHA256:

PSK_SHA256 isn't a valid AKM for WPA1, so I amended this patch slightly to fix that...

src/diagnostic.c bool diagnostic_info_to_dict(const struct diagnostic_station_info *info, · line 132

Quoted 8 lines
src/diagnostic.c +8 -0
+		if (wpa)
+			return "WPA1-Personal";
+
+		return "WPA2-Personal";
+	case IE_RSN_AKM_SUITE_FT_OVER_8021X:
+	case IE_RSN_AKM_SUITE_FT_OVER_8021X_SHA384:
+		return "WPA2-Enterprise + FT";
+	case IE_RSN_AKM_SUITE_FT_USING_PSK:

And FT isn't an option in WPA1 either, so I amended this part as well.

Quoted 12 lines
src/diagnostic.c +12 -0
+		if (wpa)
+			return "WPA1-Personal + FT";
+
+		return "WPA2-Personal + FT";
+	case IE_RSN_AKM_SUITE_SAE_SHA256:
+		return "WPA3-Personal";
+	case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
+		return "WPA3-Personal + FT";
+	case IE_RSN_AKM_SUITE_OWE:
+		return "OWE";
+	case IE_RSN_AKM_SUITE_FILS_SHA256:
+	case IE_RSN_AKM_SUITE_FILS_SHA384:

src/diagnostic.c bool diagnostic_info_to_dict(const struct diagnostic_station_info *info, · line 154

Quoted 10 lines
src/diagnostic.c +10 -0
+		return "FILS";
+	case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
+	case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
+		return "FILS + FT";
+	case IE_RSN_AKM_SUITE_OSEN:
+		return "OSEN";
+	default:
+		return NULL;
+	}
+}

All 4 patches have been applied, thanks.

Regards,
-Denis

#3 lore raw

PATCH v3 3/4 station: add Security key to GetDiagnostics

In reply to James Prestwood
---
 src/station.c | 4 ++++
 1 file changed, 4 insertions(+)
src/station.c +4 -0
index bfc23f88..ba4483e6 100644
@@ -3631,6 +3631,7 @@ static void station_get_diagnostic_cb(
 	struct station *station = user_data;
 	struct l_dbus_message *reply;
 	struct l_dbus_message_builder *builder;
+	struct handshake_state *hs = netdev_get_handshake(station->netdev);
 
 	if (!info) {
 		reply = dbus_error_aborted(station->get_station_pending);
@@ -3647,6 +3648,9 @@ static void station_get_diagnostic_cb(
 					util_address_to_string(info->addr));
 	dbus_append_dict_basic(builder, "Frequency", 'u',
 				&station->connected_bss->frequency);
+	dbus_append_dict_basic(builder, "Security", 's',
+				diagnostic_akm_suite_to_security(hs->akm_suite,
+								hs->wpa_ie));
 
 	diagnostic_info_to_dict(info, builder);
 
Signature · 1 line
2.26.2
#4 lore raw

PATCH v3 4/4 client: add Security key to diagnostics

In reply to James Prestwood
---
 client/diagnostic.c | 1 +
 1 file changed, 1 insertion(+)
client/diagnostic.c +1 -0
index 58c646d7..9e255918 100644
@@ -92,6 +92,7 @@ static const struct diagnostic_dict_mapping diagnostic_mapping[] = {
 	{ "RxMCS", 'y' },
 	{ "TxMCS", 'y' },
 	{ "Frequency", 'u' },
+	{ "Security", 's' },
 	{ NULL }
 };
 
Signature · 1 line
2.26.2