diff options
| -rw-r--r-- | wpa_supplicant/bss.c | 6 | ||||
| -rw-r--r-- | wpa_supplicant/events.c | 54 | ||||
| -rw-r--r-- | wpa_supplicant/scan.c | 7 | ||||
| -rw-r--r-- | wpa_supplicant/wpa_supplicant.c | 27 |
4 files changed, 93 insertions, 1 deletions
diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 96e1a623..39a16095 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -322,6 +322,12 @@ static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) return !is_zero_ether_addr(bss->bssid) && (os_memcmp(bss->bssid, wpa_s->bssid, ETH_ALEN) == 0 || +#ifdef MTK_HARDWARE + /* if we're trying to connect this ssid, don't remove it from scan result */ + (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE) && wpa_s->current_ssid && + wpa_s->current_ssid->ssid_len > 0 && + os_strncmp(wpa_s->current_ssid->ssid, bss->ssid, wpa_s->current_ssid->ssid_len) == 0) || +#endif os_memcmp(bss->bssid, wpa_s->pending_bssid, ETH_ALEN) == 0); } diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index cfc8350d..567fbc0e 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1075,6 +1075,13 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, int only_first_ssid) { unsigned int i; +#ifdef MTK_HARDWARE + struct wpa_bss *temp_bss = NULL; + struct dl_list *list_next = NULL; + int shared_freq = 0; + int num = 0; +#endif + if (only_first_ssid) wpa_dbg(wpa_s, MSG_DEBUG, "Try to find BSS matching pre-selected network id=%d", @@ -1082,6 +1089,49 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, else wpa_dbg(wpa_s, MSG_DEBUG, "Selecting BSS from priority group %d", group->priority); +#ifdef MTK_HARDWARE + if (os_strncmp(wpa_s->ifname, "wlan", 4) == 0) + num = get_shared_radio_freqs(wpa_s, &shared_freq, 1); + /* + * for channel conflict revise feature + * if p2p/wfd is connected, search in full scan result to find the ssid. + * because framework also base on + * this result, but not last scan result. + * + * changes in function wpa_bss_in_use will asure the intended bsses + * are not removed from full scan result. + */ + if (num > 0 && shared_freq > 0) { + wpa_printf(MSG_DEBUG, "try to find a bss on freq %d", shared_freq); + temp_bss = dl_list_first(&wpa_s->bss, struct wpa_bss, list); + for (i = 0; i < wpa_s->num_bss; i++) { + list_next = temp_bss->list.next; + if (temp_bss->freq != shared_freq) { + temp_bss = dl_list_entry(list_next, struct wpa_bss, list); + continue; + } + *selected_ssid = wpa_scan_res_match(wpa_s, i, temp_bss, group, + only_first_ssid); + + if (!*selected_ssid) { + temp_bss = dl_list_entry(list_next, struct wpa_bss, list); + continue; + } + + wpa_printf(MSG_DEBUG, "on Freq %d, " + "found a BSS in previous scan res", shared_freq); + return temp_bss; + } + /* + * it is rarely that we aren't able to find this ssid in full scan result, + * unless this bss was removed just after + * framework select this bss and before send command to wpa_supplicant + */ + wpa_printf(MSG_ERROR, "didn't find BSS on freq %d, " + "try to find on other freqs", shared_freq); + } +#endif + for (i = 0; i < wpa_s->last_scan_res_used; i++) { struct wpa_bss *bss = wpa_s->last_scan_res[i]; @@ -1656,6 +1706,10 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s, wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_NOT_FOUND); +#ifdef MTK_HARDWARE + if (os_strncmp(wpa_s->ifname, "wlan", 4) == 0) + wpa_s->current_ssid = NULL; +#endif } } return 0; diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index acd3211c..03a8cc31 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1159,6 +1159,13 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec) } +#ifdef MTK_HARDWARE +int wpa_supplicant_pending_scan(struct wpa_supplicant *wpa_s) +{ + return eloop_is_timeout_registered(wpa_supplicant_scan, wpa_s, NULL); +} +#endif + /** * wpa_supplicant_delayed_sched_scan - Request a delayed scheduled scan * @wpa_s: Pointer to wpa_supplicant data diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index f93e0f6c..84a42b92 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2294,6 +2294,11 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) params.bssid = bss->bssid; params.freq.freq = bss->freq; } +#ifdef MTK_HARDWARE + else { + params.freq.freq = bss->freq; + } +#endif params.bssid_hint = bss->bssid; params.freq_hint = bss->freq; params.pbss = bss_is_pbss(bss); @@ -2683,6 +2688,9 @@ void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s, } } +#ifdef MTK_HARDWARE +extern int wpa_supplicant_pending_scan(struct wpa_supplicant *wpa_s); +#endif /** * wpa_supplicant_select_network - Attempt association with a network @@ -2751,10 +2759,27 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s, wpa_s->disconnected = 0; wpa_s->reassociate = 1; - +#ifdef MTK_HARDWARE + if (wpa_s->connect_without_scan || + wpa_supplicant_fast_associate(wpa_s) != 1) { + /* + * Can't connect to AP when WFD is connected. + */ + if (radio_work_pending(wpa_s, "scan") || + wpa_supplicant_pending_scan(wpa_s)) { + wpa_printf(MSG_INFO, "[channel conflict revise] there're pending" + " scan request, clear it"); + wpa_supplicant_cancel_scan(wpa_s); + /* radio_remove_works(wpa_s, "scan", 0); */ + wpa_s->scan_res_handler = NULL; + } + wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0); + } +#else if (wpa_s->connect_without_scan || wpa_supplicant_fast_associate(wpa_s) != 1) wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0); +#endif if (ssid) wpas_notify_network_selected(wpa_s, ssid); |
