#define NL80211_CMD_NEW_SCAN_RESULTS 34
#define NL80211_BSS_BSSID 1
#define NL80211_BSS_FREQUENCY 2
+#define NL80211_BSS_CAPABILITY 5
#define NL80211_BSS_INFORMATION_ELEMENTS 6
#define NL80211_BSS_SIGNAL_MBM 7
#define NL80211_BSS_MAX 15
#define NL80211_ATTR_SCAN_SSIDS 45
#define NL80211_ATTR_MAX 221
+#define WLAN_CAPABILITY_PRIVACY (1<<4)
+
struct bss_scan_info_t {
char bssid[NETCONFIG_BSSID_LEN+1];
char ssid[NETCONFIG_SSID_LEN+1];
char ssid[NETCONFIG_SSID_LEN+1] = {0, };
wifi_security_type_e sec_type = WIFI_SECURITY_TYPE_NONE;
wifi_encryption_type_e enc_type = WIFI_ENCRYPTION_TYPE_NONE;
+ int wep_check = 0;
GSList *vsie = NULL;
struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct nlattr *bss[NL80211_BSS_MAX + 1];
struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = {
[NL80211_BSS_FREQUENCY] = {.type = NLA_U32},
[NL80211_BSS_BSSID] = { },
+ [NL80211_BSS_CAPABILITY] = {.type = NLA_U16},
[NL80211_BSS_INFORMATION_ELEMENTS] = { },
[NL80211_BSS_SIGNAL_MBM] = {.type = NLA_U32},
};
__netconfig_macaddress_str(bssid, nla_data(bss[NL80211_BSS_BSSID]));
__netconfig_found_ap(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]), nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]), ssid);
__netconfig_get_vsie(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]), nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]), &vsie);
+
+ if (bss[NL80211_BSS_CAPABILITY]) {
+ __u16 capa = nla_get_u16(bss[NL80211_BSS_CAPABILITY]);
+ if (capa & WLAN_CAPABILITY_PRIVACY) {
+ wep_check = 1;
+ }
+ }
__netconfig_get_security(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]), &sec_type, &enc_type);
+ if (wep_check && sec_type == WIFI_SECURITY_TYPE_NONE) {
+ sec_type = WIFI_SECURITY_TYPE_WEP;
+ enc_type = WIFI_ENCRYPTION_TYPE_WEP;
+ }
+
if (sec_type == WIFI_SECURITY_TYPE_EAP) {
g_slist_free_full(vsie, g_free);
return NL_SKIP;