projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libiwinfo: fix several nl80211 issues, detect used WEP mode in madwifi
[project/luci.git]
/
contrib
/
package
/
iwinfo
/
src
/
iwinfo_madwifi.c
diff --git
a/contrib/package/iwinfo/src/iwinfo_madwifi.c
b/contrib/package/iwinfo/src/iwinfo_madwifi.c
index
cb21ac5
..
3572f00
100644
(file)
--- 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 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;
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);
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 )
/* 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;
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;
}
}
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 )
/* Get group key length */
wrq.u.mode = IEEE80211_PARAM_MCASTKEYLEN;
if( madwifi_wrq(&wrq, ifname, IEEE80211_IOCTL_GETPARAM, NULL, 0) >= 0 )