summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/iwinfo/src/iwinfo_madwifi.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/package/iwinfo/src/iwinfo_madwifi.c')
-rw-r--r--contrib/package/iwinfo/src/iwinfo_madwifi.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/contrib/package/iwinfo/src/iwinfo_madwifi.c b/contrib/package/iwinfo/src/iwinfo_madwifi.c
index cb21ac5a0..3572f0011 100644
--- a/contrib/package/iwinfo/src/iwinfo_madwifi.c
+++ b/contrib/package/iwinfo/src/iwinfo_madwifi.c
@@ -539,7 +539,7 @@ int madwifi_get_quality_max(const char *ifname, int *buf)
int madwifi_get_encryption(const char *ifname, char *buf)
{
- int ciphers = 0, key_type = 0, key_len = 0;
+ int ciphers = 0, key_len = 0;
struct iwinfo_crypto_entry *c = (struct iwinfo_crypto_entry *)buf;
struct iwreq wrq;
struct ieee80211req_key wk;
@@ -548,16 +548,6 @@ int madwifi_get_encryption(const char *ifname, char *buf)
memset(&wk, 0, sizeof(wk));
memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
- /* Get key information */
- if( get80211priv(ifname, IEEE80211_IOCTL_GETKEY, &wk, sizeof(wk)) >= 0 )
- {
- key_type = wk.ik_type;
-
- /* Type 0 == WEP */
- if( key_type == 0 )
- c->auth_algs = (IWINFO_AUTH_OPEN | IWINFO_AUTH_SHARED);
- }
-
/* Get wpa protocol version */
wrq.u.mode = IEEE80211_PARAM_WPA;
if( madwifi_wrq(&wrq, ifname, IEEE80211_IOCTL_GETPARAM, NULL, 0) >= 0 )
@@ -576,12 +566,28 @@ int madwifi_get_encryption(const char *ifname, char *buf)
c->auth_suites |= IWINFO_KMGMT_PSK;
break;
+ case IEEE80211_AUTH_OPEN:
+ c->auth_algs |= IWINFO_AUTH_OPEN;
+ break;
+
+ case IEEE80211_AUTH_SHARED:
+ c->auth_algs |= IWINFO_AUTH_SHARED;
+ break;
+
default:
c->auth_suites |= IWINFO_KMGMT_NONE;
break;
}
}
+ /* Get key information */
+ if( get80211priv(ifname, IEEE80211_IOCTL_GETKEY, &wk, sizeof(wk)) >= 0 )
+ {
+ /* Type 0 == WEP */
+ if( (wk.ik_type == 0) && (c->auth_algs == 0) )
+ c->auth_algs = (IWINFO_AUTH_OPEN | IWINFO_AUTH_SHARED);
+ }
+
/* Get group key length */
wrq.u.mode = IEEE80211_PARAM_MCASTKEYLEN;
if( madwifi_wrq(&wrq, ifname, IEEE80211_IOCTL_GETPARAM, NULL, 0) >= 0 )