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);
}
return res;
}
-static int wext_extract_event(struct stream_descr *stream, struct iw_event *iwe)
+static int wext_extract_event(struct stream_descr *stream, struct iw_event *iwe, int wev)
{
const struct iw_ioctl_description *descr = NULL;
int event_type = 0;
/* Unknown events -> event_type=0 => IW_EV_LCP_PK_LEN */
event_len = event_type_size[event_type];
+ /* Fixup for earlier version of WE */
+ if((wev <= 18) && (event_type == IW_HEADER_TYPE_POINT))
+ event_len += IW_EV_POINT_OFF;
+
/* Check if we know about this event */
if(event_len <= IW_EV_LCP_PK_LEN)
{
/* Fixup for WE-19 and later : pointer no longer in the stream */
/* Beware of alignement. Dest has local alignement, not packed */
- if( event_type == IW_HEADER_TYPE_POINT )
+ if( (wev > 18) && (event_type == IW_HEADER_TYPE_POINT) )
memcpy((char *) iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, pointer, event_len);
else
memcpy((char *) iwe + IW_EV_LCP_LEN, pointer, event_len);
struct iwinfo_crypto_entry *ce = &e->crypto;
- if( !ce->enabled )
- return;
-
- //memset(&e->crypto, 0, sizeof(struct iwinfo_crypto_entry));
-
if(ielen > buflen)
ielen = buflen;
sprintf((char *) e->mode, "Ad-Hoc");
break;
+ case 2:
case 3:
sprintf((char *) e->mode, "Master");
break;
do
{
/* Extract an event and print it */
- ret = wext_extract_event(&stream, &iwe);
+ ret = wext_extract_event(&stream, &iwe, range.we_version_compiled);
if(ret >= 0)
{
}
else if( (entrylen + sizeof(struct iwinfo_scanlist_entry)) <= IWINFO_BUFSIZE )
{
+ /* if encryption is off, clear the crypto strunct */
+ if( !e.crypto.enabled )
+ memset(&e.crypto, 0, sizeof(struct iwinfo_crypto_entry));
+
memcpy(&buf[entrylen], &e, sizeof(struct iwinfo_scanlist_entry));
entrylen += sizeof(struct iwinfo_scanlist_entry);
}