lua: fix string description of mixed WPA3 modes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
a29b7d4e26
commit
3ac846e7dc
1 changed files with 19 additions and 26 deletions
45
iwinfo_lua.c
45
iwinfo_lua.c
|
@ -106,6 +106,8 @@ static char * iwinfo_crypto_print_suites(int suites)
|
||||||
static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
|
static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
|
||||||
{
|
{
|
||||||
static char desc[512] = { 0 };
|
static char desc[512] = { 0 };
|
||||||
|
char *pos = desc;
|
||||||
|
int i, n;
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
|
@ -135,35 +137,26 @@ static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
|
||||||
/* WPA */
|
/* WPA */
|
||||||
else if (c->wpa_version)
|
else if (c->wpa_version)
|
||||||
{
|
{
|
||||||
switch (c->wpa_version) {
|
for (i = 0, n = 0; i < 3; i++)
|
||||||
case 4:
|
if (c->wpa_version & (1 << i))
|
||||||
sprintf(desc, "WPA3 %s (%s)",
|
n++;
|
||||||
iwinfo_crypto_print_suites(c->auth_suites),
|
|
||||||
iwinfo_crypto_print_ciphers(
|
|
||||||
c->pair_ciphers | c->group_ciphers));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
if (n > 1)
|
||||||
sprintf(desc, "mixed WPA/WPA2 %s (%s)",
|
pos += sprintf(pos, "mixed ");
|
||||||
iwinfo_crypto_print_suites(c->auth_suites),
|
|
||||||
iwinfo_crypto_print_ciphers(
|
|
||||||
c->pair_ciphers | c->group_ciphers));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
for (i = 0; i < 3; i++)
|
||||||
sprintf(desc, "WPA2 %s (%s)",
|
if (c->wpa_version & (1 << i))
|
||||||
iwinfo_crypto_print_suites(c->auth_suites),
|
if (i)
|
||||||
iwinfo_crypto_print_ciphers(
|
pos += sprintf(pos, "WPA%d/", i + 1);
|
||||||
c->pair_ciphers | c->group_ciphers));
|
else
|
||||||
break;
|
pos += sprintf(pos, "WPA/");
|
||||||
|
|
||||||
case 1:
|
pos--;
|
||||||
sprintf(desc, "WPA %s (%s)",
|
|
||||||
iwinfo_crypto_print_suites(c->auth_suites),
|
sprintf(pos, " %s (%s)",
|
||||||
iwinfo_crypto_print_ciphers(
|
iwinfo_crypto_print_suites(c->auth_suites),
|
||||||
c->pair_ciphers | c->group_ciphers));
|
iwinfo_crypto_print_ciphers(
|
||||||
break;
|
c->pair_ciphers | c->group_ciphers));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue