Changeset 5308
- Timestamp:
- 08/24/09 17:11:15 (4 years ago)
- Location:
- luci/trunk/libs/iwinfo/src
- Files:
-
- 2 modified
-
iwinfo_lualib.c (modified) (1 diff)
-
iwinfo_wext_scan.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/libs/iwinfo/src/iwinfo_lualib.c
r5307 r5308 162 162 163 163 /* Crypto */ 164 lua_pushinteger(L, e->crypto.wpa_version);165 lua_setfield(L, -2, "wpa");166 167 164 lua_pushboolean(L, (!e->crypto.wpa_version && e->crypto.enabled)); 168 165 lua_setfield(L, -2, "wep"); 169 166 170 lua_newtable(L); 171 for( j = 0, y = 1; j < IW_IE_CYPHER_NUM; j++ ) 167 if( e->crypto.wpa_version ) 172 168 { 173 if( e->crypto.group_ciphers & (1<<j) ) 169 lua_pushinteger(L, e->crypto.wpa_version); 170 lua_setfield(L, -2, "wpa"); 171 172 lua_newtable(L); 173 for( j = 0, y = 1; j < IW_IE_CYPHER_NUM; j++ ) 174 174 { 175 lua_pushstring(L, iw_ie_cypher_name[j]); 176 lua_rawseti(L, -2, y++); 175 if( e->crypto.group_ciphers & (1<<j) ) 176 { 177 lua_pushstring(L, iw_ie_cypher_name[j]); 178 lua_rawseti(L, -2, y++); 179 } 177 180 } 181 lua_setfield(L, -2, "group_ciphers"); 182 183 lua_newtable(L); 184 for( j = 0, y = 1; j < IW_IE_CYPHER_NUM; j++ ) 185 { 186 if( e->crypto.pair_ciphers & (1<<j) ) 187 { 188 lua_pushstring(L, iw_ie_cypher_name[j]); 189 lua_rawseti(L, -2, y++); 190 } 191 } 192 lua_setfield(L, -2, "pair_ciphers"); 193 194 lua_newtable(L); 195 for( j = 0, y = 1; j < IW_IE_KEY_MGMT_NUM; j++ ) 196 { 197 if( e->crypto.auth_suites & (1<<j) ) 198 { 199 lua_pushstring(L, iw_ie_key_mgmt_name[j]); 200 lua_rawseti(L, -2, y++); 201 } 202 } 203 lua_setfield(L, -2, "auth_suites"); 178 204 } 179 lua_setfield(L, -2, "group_ciphers");180 181 lua_newtable(L);182 for( j = 0, y = 1; j < IW_IE_CYPHER_NUM; j++ )183 {184 if( e->crypto.pair_ciphers & (1<<j) )185 {186 lua_pushstring(L, iw_ie_cypher_name[j]);187 lua_rawseti(L, -2, y++);188 }189 }190 lua_setfield(L, -2, "pair_ciphers");191 192 lua_newtable(L);193 for( j = 0, y = 1; j < IW_IE_KEY_MGMT_NUM; j++ )194 {195 if( e->crypto.auth_suites & (1<<j) )196 {197 lua_pushstring(L, iw_ie_key_mgmt_name[j]);198 lua_rawseti(L, -2, y++);199 }200 }201 lua_setfield(L, -2, "auth_suites");202 205 203 206 lua_rawseti(L, -2, x); -
luci/trunk/libs/iwinfo/src/iwinfo_wext_scan.c
r5307 r5308 44 44 } 45 45 46 static int wext_extract_event(struct stream_descr *stream, struct iw_event *iwe )46 static int wext_extract_event(struct stream_descr *stream, struct iw_event *iwe, int wev) 47 47 { 48 48 const struct iw_ioctl_description *descr = NULL; … … 84 84 event_len = event_type_size[event_type]; 85 85 86 /* Fixup for earlier version of WE */ 87 if((wev <= 18) && (event_type == IW_HEADER_TYPE_POINT)) 88 event_len += IW_EV_POINT_OFF; 89 86 90 /* Check if we know about this event */ 87 91 if(event_len <= IW_EV_LCP_PK_LEN) … … 110 114 /* Fixup for WE-19 and later : pointer no longer in the stream */ 111 115 /* Beware of alignement. Dest has local alignement, not packed */ 112 if( event_type == IW_HEADER_TYPE_POINT)116 if( (wev > 18) && (event_type == IW_HEADER_TYPE_POINT) ) 113 117 memcpy((char *) iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, pointer, event_len); 114 118 else … … 231 235 struct iwinfo_crypto_entry *ce = &e->crypto; 232 236 233 if( !ce->enabled )234 return;235 236 //memset(&e->crypto, 0, sizeof(struct iwinfo_crypto_entry));237 238 237 if(ielen > buflen) 239 238 ielen = buflen; … … 392 391 break; 393 392 393 case 2: 394 394 case 3: 395 395 sprintf((char *) e->mode, "Master"); … … 609 609 { 610 610 /* Extract an event and print it */ 611 ret = wext_extract_event(&stream, &iwe );611 ret = wext_extract_event(&stream, &iwe, range.we_version_compiled); 612 612 613 613 if(ret >= 0) … … 621 621 else if( (entrylen + sizeof(struct iwinfo_scanlist_entry)) <= IWINFO_BUFSIZE ) 622 622 { 623 /* if encryption is off, clear the crypto strunct */ 624 if( !e.crypto.enabled ) 625 memset(&e.crypto, 0, sizeof(struct iwinfo_crypto_entry)); 626 623 627 memcpy(&buf[entrylen], &e, sizeof(struct iwinfo_scanlist_entry)); 624 628 entrylen += sizeof(struct iwinfo_scanlist_entry);
