From 335e519dd64bbc8b0c938945745a92d86c2ff9fc Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 24 Aug 2009 13:31:20 +0000 Subject: libs/iwinfo: fixes for wpa/wep detection in wifi scan --- libs/iwinfo/src/iwinfo_lualib.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'libs/iwinfo/src/iwinfo_lualib.c') 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<crypto.pair_ciphers); j++ ) + for( j = 0, y = 1; j < 8; j++ ) { - if( e->crypto.pair_ciphers[j] ) + if( e->crypto.pair_ciphers & (1<crypto.auth_suites); j++ ) + for( j = 0, y = 1; j < 8; j++ ) { - if( e->crypto.auth_suites[j] ) + if( e->crypto.auth_suites & (1<