diff options
Diffstat (limited to 'libs/iwinfo/src/iwinfo_lualib.c')
-rw-r--r-- | libs/iwinfo/src/iwinfo_lualib.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/libs/iwinfo/src/iwinfo_lualib.c b/libs/iwinfo/src/iwinfo_lualib.c index a798d7729..2efc7871a 100644 --- a/libs/iwinfo/src/iwinfo_lualib.c +++ b/libs/iwinfo/src/iwinfo_lualib.c @@ -161,44 +161,47 @@ static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int lua_setfield(L, -2, "signal"); /* Crypto */ - lua_pushinteger(L, e->crypto.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 < IW_IE_CYPHER_NUM; j++ ) + if( e->crypto.wpa_version ) { - if( e->crypto.group_ciphers & (1<<j) ) + lua_pushinteger(L, e->crypto.wpa_version); + lua_setfield(L, -2, "wpa"); + + lua_newtable(L); + for( j = 0, y = 1; j < IW_IE_CYPHER_NUM; j++ ) { - lua_pushstring(L, iw_ie_cypher_name[j]); - lua_rawseti(L, -2, y++); + if( e->crypto.group_ciphers & (1<<j) ) + { + lua_pushstring(L, iw_ie_cypher_name[j]); + lua_rawseti(L, -2, y++); + } } - } - lua_setfield(L, -2, "group_ciphers"); + lua_setfield(L, -2, "group_ciphers"); - lua_newtable(L); - for( j = 0, y = 1; j < IW_IE_CYPHER_NUM; j++ ) - { - if( e->crypto.pair_ciphers & (1<<j) ) + lua_newtable(L); + for( j = 0, y = 1; j < IW_IE_CYPHER_NUM; j++ ) { - lua_pushstring(L, iw_ie_cypher_name[j]); - lua_rawseti(L, -2, y++); + if( e->crypto.pair_ciphers & (1<<j) ) + { + lua_pushstring(L, iw_ie_cypher_name[j]); + lua_rawseti(L, -2, y++); + } } - } - lua_setfield(L, -2, "pair_ciphers"); + lua_setfield(L, -2, "pair_ciphers"); - lua_newtable(L); - for( j = 0, y = 1; j < IW_IE_KEY_MGMT_NUM; j++ ) - { - if( e->crypto.auth_suites & (1<<j) ) + lua_newtable(L); + for( j = 0, y = 1; j < IW_IE_KEY_MGMT_NUM; j++ ) { - lua_pushstring(L, iw_ie_key_mgmt_name[j]); - lua_rawseti(L, -2, y++); + if( e->crypto.auth_suites & (1<<j) ) + { + lua_pushstring(L, iw_ie_key_mgmt_name[j]); + lua_rawseti(L, -2, y++); + } } + lua_setfield(L, -2, "auth_suites"); } - lua_setfield(L, -2, "auth_suites"); lua_rawseti(L, -2, x); } |