iwinfo: Add support for WPA3
authorRobert Marko <robimarko@gmail.com>
Tue, 20 Aug 2019 12:18:16 +0000 (14:18 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Sep 2019 10:38:57 +0000 (12:38 +0200)
This patch adds support for WPA3, meaning SAE and OWE are now properly identified.
This fixes iwinfo and LuCi showing WPA2 NONE for WPA3 SAE and OWE.

Signed-off-by: Robert Marko <robimarko@gmail.com>
include/iwinfo.h
iwinfo_cli.c
iwinfo_lua.c
iwinfo_nl80211.c

index 9b2ffd1ea1116fb63bcf152361abed9c725423c4..d035c9c89a596cbb8f5d105303747b5f14307ffb 100644 (file)
@@ -43,7 +43,9 @@
 #define IWINFO_KMGMT_NONE    (1 << 0)
 #define IWINFO_KMGMT_8021x   (1 << 1)
 #define IWINFO_KMGMT_PSK     (1 << 2)
-#define IWINFO_KMGMT_COUNT   3
+#define IWINFO_KMGMT_SAE     (1 << 3)
+#define IWINFO_KMGMT_OWE     (1 << 4)
+#define IWINFO_KMGMT_COUNT   5
 
 #define IWINFO_AUTH_OPEN     (1 << 0)
 #define IWINFO_AUTH_SHARED   (1 << 1)
index dba752999996897569eff49d03b61688e6fd92db..4a4727be7808ce2354d40e4c7fef885b149b3010 100644 (file)
@@ -186,6 +186,12 @@ static char * format_enc_suites(int suites)
        if (suites & IWINFO_KMGMT_8021x)
                pos += sprintf(pos, "802.1X/");
 
+       if (suites & IWINFO_KMGMT_SAE)
+               pos += sprintf(pos, "SAE/");
+
+       if (suites & IWINFO_KMGMT_OWE)
+               pos += sprintf(pos, "OWE/");
+
        if (!suites || (suites & IWINFO_KMGMT_NONE))
                pos += sprintf(pos, "NONE/");
 
@@ -229,6 +235,12 @@ static char * format_encryption(struct iwinfo_crypto_entry *c)
                else if (c->wpa_version)
                {
                        switch (c->wpa_version) {
+                               case 4:
+                                       snprintf(buf, sizeof(buf), "WPA3 %s (%s)",
+                                               format_enc_suites(c->auth_suites),
+                                               format_enc_ciphers(c->pair_ciphers | c->group_ciphers));
+                                       break;
+
                                case 3:
                                        snprintf(buf, sizeof(buf), "mixed WPA/WPA2 %s (%s)",
                                                format_enc_suites(c->auth_suites),
index bb43438d8dd531b745dd27935e11cb7c9a2073c2..3d9d95e54b5fa4d36614118d569e2f82dd00f8d8 100644 (file)
@@ -89,6 +89,12 @@ static char * iwinfo_crypto_print_suites(int suites)
        if (suites & IWINFO_KMGMT_8021x)
                pos += sprintf(pos, "802.1X/");
 
+       if (suites & IWINFO_KMGMT_SAE)
+               pos += sprintf(pos, "SAE/");
+
+       if (suites & IWINFO_KMGMT_OWE)
+               pos += sprintf(pos, "OWE/");
+
        if (!suites || (suites & IWINFO_KMGMT_NONE))
                pos += sprintf(pos, "NONE/");
 
@@ -130,6 +136,13 @@ static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
                        else if (c->wpa_version)
                        {
                                switch (c->wpa_version) {
+                                       case 4:
+                                               sprintf(desc, "WPA3 %s (%s)",
+                                                       iwinfo_crypto_print_suites(c->auth_suites),
+                                                       iwinfo_crypto_print_ciphers(
+                                                               c->pair_ciphers | c->group_ciphers));
+                                               break;
+
                                        case 3:
                                                sprintf(desc, "mixed WPA/WPA2 %s (%s)",
                                                        iwinfo_crypto_print_suites(c->auth_suites),
index e0d0e0bb743d4633162fc43408c2975720cfb187..83c75bf176e69f65a4adce1bf3e8d3bcdd378c1a 100644 (file)
@@ -1588,6 +1588,16 @@ static int nl80211_get_encryption(const char *ifname, char *buf)
                        if (strstr(wpa_key_mgmt, "EAP"))
                                c->auth_suites |= IWINFO_KMGMT_8021x;
 
+                       if (strstr(wpa_key_mgmt, "SAE")){
+                               c->auth_suites |= IWINFO_KMGMT_SAE;
+                               c->wpa_version = 4;
+                       }
+
+                       if (strstr(wpa_key_mgmt, "OWE")){
+                               c->auth_suites |= IWINFO_KMGMT_OWE;
+                               c->wpa_version = 4;
+                       }
+
                        if (strstr(wpa_key_mgmt, "NONE"))
                                c->auth_suites |= IWINFO_KMGMT_NONE;
                }