diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-20 12:57:16 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-20 13:12:56 +0200 |
commit | 629b5ffdd92af78d7122bfa28ef955ebe536ad8d (patch) | |
tree | 16e3e73647d26af268e382b33d56006215eb18a8 | |
parent | 3d47ddda0c64ad790a26de085e3a3e70c3578e12 (diff) | |
download | iwinfo-629b5ffdd92af78d7122bfa28ef955ebe536ad8d.tar.gz |
nl80211: do not confuse open connections with WEP ones
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | iwinfo_nl80211.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c index 2a4cc1e..6e438a7 100644 --- a/iwinfo_nl80211.c +++ b/iwinfo_nl80211.c @@ -1605,15 +1605,21 @@ static int nl80211_get_encryption(const char *ifname, char *buf) "group_cipher", wpa_groupwise, sizeof(wpa_groupwise), "key_mgmt", wpa_key_mgmt, sizeof(wpa_key_mgmt))) { - /* WEP */ + /* WEP or Open */ if (!strcmp(wpa_key_mgmt, "NONE")) { parse_wpa_ciphers(wpa_pairwise, &c->pair_ciphers); parse_wpa_ciphers(wpa_groupwise, &c->group_ciphers); - c->enabled = !!(c->pair_ciphers | c->group_ciphers); - c->auth_suites |= IWINFO_KMGMT_NONE; - c->auth_algs |= IWINFO_AUTH_OPEN; /* XXX: assumption */ + if (c->pair_ciphers != 0 && c->pair_ciphers != IWINFO_CIPHER_NONE) { + c->enabled = 1; + c->auth_suites = IWINFO_KMGMT_NONE; + c->auth_algs = IWINFO_AUTH_OPEN | IWINFO_AUTH_SHARED; + } + else { + c->pair_ciphers = 0; + c->group_ciphers = 0; + } } /* WPA */ @@ -1690,11 +1696,12 @@ static int nl80211_get_encryption(const char *ifname, char *buf) break; } - c->enabled = c->auth_algs ? 1 : 0; c->pair_ciphers |= nl80211_check_wepkey(wep_key0); c->pair_ciphers |= nl80211_check_wepkey(wep_key1); c->pair_ciphers |= nl80211_check_wepkey(wep_key2); c->pair_ciphers |= nl80211_check_wepkey(wep_key3); + + c->enabled = (c->auth_algs && c->pair_ciphers) ? 1 : 0; } c->group_ciphers = c->pair_ciphers; |