summaryrefslogtreecommitdiffhomepage
path: root/libs/iwinfo/src/iwinfo_lualib.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-08-24 13:31:20 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-08-24 13:31:20 +0000
commit335e519dd64bbc8b0c938945745a92d86c2ff9fc (patch)
treef1b784f41d1d18c5abd8d47cf6d2c7c212a43525 /libs/iwinfo/src/iwinfo_lualib.c
parent12f582bcc7dc8ab447c01e2cfa939caa7dfa321b (diff)
libs/iwinfo: fixes for wpa/wep detection in wifi scan
Diffstat (limited to 'libs/iwinfo/src/iwinfo_lualib.c')
-rw-r--r--libs/iwinfo/src/iwinfo_lualib.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/libs/iwinfo/src/iwinfo_lualib.c b/libs/iwinfo/src/iwinfo_lualib.c
index 1a0d71b99a..d9c82b1ec9 100644
--- a/libs/iwinfo/src/iwinfo_lualib.c
+++ b/libs/iwinfo/src/iwinfo_lualib.c
@@ -133,7 +133,7 @@ static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int
e->mac[3], e->mac[4], e->mac[5]);
lua_pushstring(L, macstr);
- lua_setfield(L, -2, "mac");
+ lua_setfield(L, -2, "bssid");
/* ESSID */
if( e->ssid[0] )
@@ -152,12 +152,15 @@ static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int
/* Crypto */
lua_pushinteger(L, e->crypto.wpa_version);
- lua_setfield(L, -2, "wpa_version");
+ lua_setfield(L, -2, "wpa");
+
+ lua_pushboolean(L, (!e->crypto.wpa_version && e->crypto.enabled));
+ lua_setfield(L, -2, "wep");
lua_newtable(L);
- for( j = 0, y = 1; j < sizeof(e->crypto.group_ciphers); j++ )
+ for( j = 0, y = 1; j < 8; j++ )
{
- if( e->crypto.group_ciphers[j] )
+ if( e->crypto.group_ciphers & (1<<j) )
{
lua_pushstring(L, (j < IW_IE_CYPHER_NUM)
? iw_ie_cypher_name[j] : "Proprietary");
@@ -168,9 +171,9 @@ static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int
lua_setfield(L, -2, "group_ciphers");
lua_newtable(L);
- for( j = 0, y = 1; j < sizeof(e->crypto.pair_ciphers); j++ )
+ for( j = 0, y = 1; j < 8; j++ )
{
- if( e->crypto.pair_ciphers[j] )
+ if( e->crypto.pair_ciphers & (1<<j) )
{
lua_pushstring(L, (j < IW_IE_CYPHER_NUM)
? iw_ie_cypher_name[j] : "Proprietary");
@@ -181,9 +184,9 @@ static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int
lua_setfield(L, -2, "pair_ciphers");
lua_newtable(L);
- for( j = 0, y = 1; j < sizeof(e->crypto.auth_suites); j++ )
+ for( j = 0, y = 1; j < 8; j++ )
{
- if( e->crypto.auth_suites[j] )
+ if( e->crypto.auth_suites & (1<<j) )
{
lua_pushstring(L, (j < IW_IE_KEY_MGMT_NUM)
? iw_ie_key_mgmt_name[j] : "Proprietary");