aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-07-21 21:13:23 +0300
committerArik Nemtsov <arik@wizery.com>2012-08-02 13:04:01 +0300
commit9c0341977f2021f38ba98f8335adcbf0a1d86499 (patch)
treeda93cf16beb870b34596e7aaf0aa7c97a1bdd8f4
parentaf943c964ead5eb6552013fbc1cbd56e6bb8d551 (diff)
downloadexternal_wpa_supplicant_8_ti-9c0341977f2021f38ba98f8335adcbf0a1d86499.zip
external_wpa_supplicant_8_ti-9c0341977f2021f38ba98f8335adcbf0a1d86499.tar.gz
external_wpa_supplicant_8_ti-9c0341977f2021f38ba98f8335adcbf0a1d86499.tar.bz2
P2P: fix freq conflict resolution in case of P2P and STA
The conflict resolution code doesn't run in case wpa_s SME is used so moved it up wpa_supplicant_associate. wpas_p2p_handle_frequency_conflicts assumes use of a different interface created for p2p group (p2p_group_interface != 0) but that's not necessarily the case with all drivers. Switch to detect if an iface is used for P2P_GO by looking at current_ssid->mode. [Arik - fix the separate interface case, was broken by the original patch] Signed-off-by: Eyal Shapira <eyal@wizery.com> Signed-off-by: Arik Nemtsov <arik@wizery.com>
-rw-r--r--wpa_supplicant/p2p_supplicant.c13
-rw-r--r--wpa_supplicant/wpa_supplicant.c43
2 files changed, 31 insertions, 25 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 1d7f28d..3adca69 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4908,10 +4908,15 @@ int wpas_p2p_handle_frequency_conflicts(struct wpa_supplicant *wpa_s, int freq)
struct p2p_data *p2p = wpa_s->global->p2p;
for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
- if((iface->p2p_group_interface) && (iface->current_ssid) &&
- (iface->current_ssid->frequency != freq)) {
-
- if (iface->p2p_group_interface == P2P_GROUP_INTERFACE_GO) {
+ if((iface->current_ssid) &&
+ /* same interface */
+ (iface->current_ssid->mode == WPAS_MODE_P2P_GO ||
+ iface->current_ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION ||
+ /* different interface */
+ iface->p2p_group_interface) &&
+ (iface->current_ssid->frequency != freq)) {
+
+ if (iface->current_ssid->mode == WPAS_MODE_P2P_GO) {
/* Try to see whether we can move the GO. If it
* is not possible, remove the GO interface
*/
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 6494097..e36ada0 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1189,6 +1189,28 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
bss->ie_len);
#endif /* CONFIG_TDLS */
+#ifdef ANDROID_P2P
+ /* If multichannel concurrency is not supported, check for any frequency
+ * conflict and take appropriate action.
+ */
+ if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) &&
+ bss && ((freq = wpa_drv_shared_freq(wpa_s)) > 0) &&
+ (freq != bss->freq)) {
+ wpa_printf(MSG_DEBUG,
+ "Shared interface with conflicting frequency found (%d != %d)",
+ freq, bss->freq);
+ if (wpas_p2p_handle_frequency_conflicts(wpa_s, bss->freq) < 0) {
+ /* Handling conflicts failed. Disable the current connect req and
+ * notify the userspace to take appropriate action */
+ wpa_printf(MSG_DEBUG, "proiritize is not set. Notifying user space to handle the case");
+ wpa_supplicant_disable_network(wpa_s, ssid);
+ wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_FREQ_CONFLICT
+ " id=%d", ssid->id);
+ os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
+ return;
+ }
+ }
+#endif
if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) &&
ssid->mode == IEEE80211_MODE_INFRA) {
/* TODO: move set_priority to a different place */
@@ -1493,27 +1515,6 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_supplicant_apply_ht_overrides(wpa_s, ssid, &params);
#endif /* CONFIG_HT_OVERRIDES */
-#ifdef ANDROID_P2P
- /* If multichannel concurrency is not supported, check for any frequency
- * conflict and take appropriate action.
- */
- if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) &&
- ((freq = wpa_drv_shared_freq(wpa_s)) > 0) && (freq != params.freq)) {
- wpa_printf(MSG_DEBUG,
- "Shared interface with conflicting frequency found (%d != %d)",
- freq, params.freq);
- if (wpas_p2p_handle_frequency_conflicts(wpa_s, params.freq) < 0) {
- /* Handling conflicts failed. Disable the current connect req and
- * notify the userspace to take appropriate action */
- wpa_printf(MSG_DEBUG, "proiritize is not set. Notifying user space to handle the case");
- wpa_supplicant_disable_network(wpa_s, ssid);
- wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_FREQ_CONFLICT
- " id=%d", ssid->id);
- os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
- return;
- }
- }
-#endif
ret = wpa_drv_associate(wpa_s, &params);
if (ret < 0) {
wpa_msg(wpa_s, MSG_INFO, "Association request to the driver "