iwinfo: add device id for Mikrotik R11e-5HacD miniPCIe card
[oweals/iwinfo.git] / iwinfo_lua.c
index 94913ac0d41e2e1a3527bf28e1735407275ae1ed..58a5537b638634a21298eeb706c3e080741e8e6e 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/");
 
@@ -100,6 +106,8 @@ static char * iwinfo_crypto_print_suites(int suites)
 static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
 {
        static char desc[512] = { 0 };
+       char *pos = desc;
+       int i, n;
 
        if (c)
        {
@@ -129,28 +137,26 @@ static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
                        /* WPA */
                        else if (c->wpa_version)
                        {
-                               switch (c->wpa_version) {
-                                       case 3:
-                                               sprintf(desc, "mixed WPA/WPA2 %s (%s)",
-                                                       iwinfo_crypto_print_suites(c->auth_suites),
-                                                       iwinfo_crypto_print_ciphers(
-                                                               c->pair_ciphers & c->group_ciphers));
-                                               break;
-
-                                       case 2:
-                                               sprintf(desc, "WPA2 %s (%s)",
-                                                       iwinfo_crypto_print_suites(c->auth_suites),
-                                                       iwinfo_crypto_print_ciphers(
-                                                               c->pair_ciphers & c->group_ciphers));
-                                               break;
-
-                                       case 1:
-                                               sprintf(desc, "WPA %s (%s)",
-                                                       iwinfo_crypto_print_suites(c->auth_suites),
-                                                       iwinfo_crypto_print_ciphers(
-                                                               c->pair_ciphers & c->group_ciphers));
-                                               break;
-                               }
+                               for (i = 0, n = 0; i < 3; i++)
+                                       if (c->wpa_version & (1 << i))
+                                               n++;
+
+                               if (n > 1)
+                                       pos += sprintf(pos, "mixed ");
+
+                               for (i = 0; i < 3; i++)
+                                       if (c->wpa_version & (1 << i))
+                                               if (i)
+                                                       pos += sprintf(pos, "WPA%d/", i + 1);
+                                               else
+                                                       pos += sprintf(pos, "WPA/");
+
+                               pos--;
+
+                               sprintf(pos, " %s (%s)",
+                                       iwinfo_crypto_print_suites(c->auth_suites),
+                                       iwinfo_crypto_print_ciphers(
+                                               c->pair_ciphers | c->group_ciphers));
                        }
                        else
                        {
@@ -328,6 +334,11 @@ static int iwinfo_L_assoclist(lua_State *L, int (*func)(const char *, char *, in
                        set_rateinfo(L, &e->rx_rate, true);
                        set_rateinfo(L, &e->tx_rate, false);
 
+                       if (e->thr) {
+                               lua_pushnumber(L, e->thr);
+                               lua_setfield(L, -2, "expected_throughput");
+                       }
+
                        lua_setfield(L, -2, macstr);
                }
        }
@@ -513,6 +524,9 @@ static int iwinfo_L_hwmodelist(lua_State *L, int (*func)(const char *, int *))
                lua_pushboolean(L, hwmodes & IWINFO_80211_AC);
                lua_setfield(L, -2, "ac");
 
+               lua_pushboolean(L, hwmodes & IWINFO_80211_AD);
+               lua_setfield(L, -2, "ad");
+
                return 1;
        }