+
+ GSList *bssid_list = (GSList *)connman_network_get_bssid_list(network);
+ if (bssid_list && g_slist_length(bssid_list) > 1) {
+
+ /* If there are more than one bssid,
+ * the user-specified bssid is tried only once at the beginning.
+ * After that, the bssids in the list are tried in order.
+ */
+ if (set_connman_bssid(CHECK_BSSID, NULL, ifname) == 6) {
+ set_connman_bssid(RESET_BSSID, NULL, ifname);
+ goto done;
+ }
+
+ GSList *list;
+ char buff[MAC_ADDRESS_LENGTH];
+ for (list = bssid_list; list; list = list->next) {
+ struct connman_bssids * bssids = (struct connman_bssids *)list->data;
+
+ g_snprintf(buff, MAC_ADDRESS_LENGTH, "%02x:%02x:%02x:%02x:%02x:%02x",
+ bssids->bssid[0], bssids->bssid[1], bssids->bssid[2],
+ bssids->bssid[3], bssids->bssid[4], bssids->bssid[5]);
+ buff[MAC_ADDRESS_LENGTH - 1] = '\0';
+
+ gchar *curr_bssid = g_strdup((const gchar *)buff);
+
+ if (g_hash_table_contains(failed_bssids, curr_bssid)) {
+ DBG("bssid match, try next bssid");
+ g_free(curr_bssid);
+ continue;
+ } else {
+ g_hash_table_add(failed_bssids, curr_bssid);
+
+ memcpy(buff_bssid, bssids->bssid, WIFI_BSSID_LEN_MAX);
+ ssid->bssid = buff_bssid;
+ ssid->freq = (unsigned int)bssids->frequency;
+ break;
+ }
+ }
+
+ if (!list) {
+ ssid->bssid = connman_network_get_bssid(network);
+ g_hash_table_remove_all(failed_bssids);
+ }
+ } else
+ ssid->bssid = connman_network_get_bssid(network);
+
+done:
+ ssid->eap_keymgmt = network_eap_keymgmt(
+ connman_network_get_string(network, "WiFi.KeymgmtType"));
+ ssid->phase1 = connman_network_get_string(network, "WiFi.Phase1");
+
+ if(g_strcmp0(ssid->eap, "fast") == 0)
+ ssid->pac_file = g_strdup(WIFI_EAP_FAST_PAC_FILE);
+
+ ssid->keymgmt = connman_network_get_keymgmt(network);