GSList *bss_info_list = NULL;
const gchar *ssid = NULL;
const gchar *bssid = NULL;
- const gchar *vsie = NULL;
+ GSList *vsie_list = NULL;
int freq = 0;
int rssi = 0;
int sec_type = 0;
} else if (g_strcmp0(key, "encryption") == 0) {
enc_type = g_variant_get_int32(value);
encryption_found = TRUE;
- } else if (g_strcmp0(key, "vsie") == 0) {
- vsie = g_variant_get_string(value, NULL);
+ } else if (g_strcmp0(key, "vsie_list") == 0) {
+ GVariantIter *iter_sub = NULL;
+ const unsigned char *vsie_bytes = NULL;
+ unsigned char *vsie = NULL;
+ GVariant *value_sub;
+ gchar *key_sub = NULL;
+ gsize size;
+ g_variant_get(value, "a{sv}", &iter_sub);
+ vsie_list = NULL;
+
+ while (g_variant_iter_loop(iter_sub, "{sv}", &key_sub, &value_sub)) {
+ vsie_bytes = g_variant_get_fixed_array(value_sub, &size, sizeof(guchar));
+
+ if (vsie_bytes) {
+ vsie = (unsigned char *)g_try_malloc0(size);
+
+ if (vsie) {
+ memcpy(vsie, vsie_bytes, size);
+ vsie_list = g_slist_append(vsie_list, vsie);
+ } else
+ WIFI_LOG(WIFI_ERROR, "Failed to allocate memory.");
+ }
+ }
+
+ g_variant_iter_free(iter_sub);
vsie_found = TRUE;
}
freq_found == TRUE && rssi_found == TRUE && vsie_found == TRUE) {
net_netlink_scan_bss_info_s *bss = NULL;
bss = g_try_new0(net_netlink_scan_bss_info_s, 1);
+
if (bss == NULL) {
WIFI_LOG(WIFI_ERROR, "Memory allocation error");
+ GSList *list_sub = bss_info_list;
+ g_slist_free_full(vsie_list, g_free);
+
+ for (list_sub = bss_info_list; list_sub; list_sub = list_sub->next) {
+ net_netlink_scan_bss_info_s *ap_sub = (net_netlink_scan_bss_info_s *)list_sub->data;
+
+ if (ap_sub->vsie_list) {
+ g_slist_free_full(ap_sub->vsie_list, g_free);
+ ap_sub->vsie_list = NULL;
+ }
+ }
g_slist_free_full(bss_info_list, g_free);
g_variant_unref(value);
"Security type : %d, Encryption type: %d", bssid, freq, rssi, ssid,
sec_type, enc_type);
- if (strncmp(vsie, "dd", 2) == 0) {
- WIFI_LOG(WIFI_INFO, "vsie: %s", vsie);
- g_strlcpy(bss->vsie, vsie, strlen(vsie)+1);
- }
-
+ bss->vsie_list = vsie_list;
bss_info_list = g_slist_append(bss_info_list, bss);
ssid_found = bssid_found = freq_found = rssi_found = vsie_found = FALSE;
}
return type;
}
+
+static void __clear_profile_internal_list(GSList **iterator)
+{
+ GSList *list;
+
+ for (list = *iterator; list; list = list->next) {
+ net_profile_info_s *prof_info = (net_profile_info_s *)list->data;
+
+ if (prof_info->vsie_list) {
+ g_slist_free_full(prof_info->vsie_list, g_free);
+ prof_info->vsie_list = NULL;
+ }
+
+ if (prof_info->bssid_list) {
+ g_slist_free_full(prof_info->bssid_list, g_free);
+ prof_info->bssid_list = NULL;
+ }
+ }
+}
+
//LCOV_EXCL_STOP
static void __clear_profile_list(GSList **iterator)
{
if (*iterator) {
*iterator = g_slist_nth(*iterator, 0);
+ __clear_profile_internal_list(iterator);
g_slist_free_full(*iterator, g_free);
*iterator = NULL;
}
g_strlcpy(profile->essid, ap->ssid, NET_WLAN_ESSID_LEN+1);
g_strlcpy(profile->bssid, ap->bssid, NET_MAX_MAC_ADDR_LEN+1);
+
+ if (ap->vsie_list) {
+ GSList *list;
+
+ for (list = ap->vsie_list; list; list = list->next) {
+ unsigned char *str = (unsigned char *)list->data;
+ unsigned char *vsie;
+ vsie = g_try_malloc0(str[1]+2);
+
+ if (vsie) {
+ memcpy(vsie, str, str[1]+2);
+ profile->vsie_list = g_slist_append(profile->vsie_list, vsie);
+ } else
+ WIFI_LOG(WIFI_ERROR, "Failed to allocate memory.");
+ }
+
+ g_slist_free_full(ap->vsie_list, g_free);
+ ap->vsie_list = NULL;
+ }
+
profile->frequency = (unsigned int)ap->freq;
profile->Strength = 120 + ap->rssi;