aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorAndrew Dodd <atd7@cornell.edu>2012-12-13 00:37:26 -0500
committerAndrew Dodd <atd7@cornell.edu>2012-12-15 01:20:58 -0500
commit261a70c1fedbfe818956f78aae9c677f4e0fbe7b (patch)
tree1fae8263cd5017277e87a588c865d16bb877a3e4 /wpa_supplicant
parent279731e733c27fd8dfb24d740c05f9ba1b4f8db0 (diff)
downloadexternal_wpa_supplicant_8-261a70c1fedbfe818956f78aae9c677f4e0fbe7b.zip
external_wpa_supplicant_8-261a70c1fedbfe818956f78aae9c677f4e0fbe7b.tar.gz
external_wpa_supplicant_8-261a70c1fedbfe818956f78aae9c677f4e0fbe7b.tar.bz2
Use legacy NL80211 STA events for older drivers
This allows tethering on devices with older bcmdhd drivers to be fixed. It conditionally reverts b638fe75d3cb9d21c67386173f10afe65053cc4d "nl80211: Use native cfg80211 sta events" for these boards. Use BOARD_LEGACY_NL80211_STA_EVENTS to enable this conditional revert. Forward-port to JB MR1, squashed in Steve Kondik's commit to handle additional changes. Change-Id: I4e436c57819944515455725cfd7ac7eeb31552ca
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/Android.mk4
-rw-r--r--wpa_supplicant/config_ssid.h2
-rw-r--r--wpa_supplicant/events.c20
-rw-r--r--wpa_supplicant/wpa_supplicant.c5
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h4
5 files changed, 32 insertions, 3 deletions
diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 4f58a92..6d94cb2 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -38,6 +38,10 @@ L_CFLAGS += -DANDROID_QCOM_WCN
L_CFLAGS += -DANDROID_P2P
endif
+ifeq ($(BOARD_LEGACY_NL80211_STA_EVENTS),true)
+L_CFLAGS += -DLEGACY_STA_EVENTS
+endif
+
# Use Android specific directory for control interface sockets
L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/wpa_supplicant\"
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index ff97379..3c4f3ef 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -458,7 +458,7 @@ struct wpa_ssid {
*/
int export_keys;
-#ifdef ANDROID_P2P
+#if defined(ANDROID_P2P) && !defined(LEGACY_STA_EVENTS)
/**
* assoc_retry - Number of times association should be retried.
*/
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 4b1d992..40aee44 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2531,7 +2531,25 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)
sme_event_assoc_reject(wpa_s, data);
#ifdef ANDROID_P2P
-#ifdef CONFIG_P2P
+#if defined(LEGACY_STA_EVENTS)
+ /* If assoc reject is reported by the driver, then avoid
+ * waiting for the authentication timeout. Cancel the
+ * authentication timeout and retry the assoc.
+ */
+ if(wpa_s->assoc_retries++ < 5) {
+ wpa_printf(MSG_ERROR, "Retrying assoc "
+ "Iteration:%d", wpa_s->assoc_retries);
+ wpa_supplicant_cancel_auth_timeout(wpa_s);
+
+ /* Clear the states */
+ wpa_sm_notify_disassoc(wpa_s->wpa);
+ wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+
+ wpa_s->reassociate = 1;
+ wpa_supplicant_req_scan(wpa_s, 1, 0);
+ } else
+ wpa_s->assoc_retries = 0;
+#else if defined(CONFIG_P2P)
else {
if(!wpa_s->current_ssid) {
wpa_printf(MSG_ERROR, "current_ssid == NULL");
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index d8f3c44..a54239f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -647,9 +647,14 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
wpa_supplicant_state_txt(state));
#ifdef ANDROID_P2P
+#ifdef LEGACY_STA_EVENTS
+ if(state == WPA_ASSOCIATED || (state <= WPA_INACTIVE))
+ wpa_s->assoc_retries = 0;
+#else
if(state == WPA_ASSOCIATED && wpa_s->current_ssid) {
wpa_s->current_ssid->assoc_retry = 0;
}
+#endif
#endif /* ANDROID_P2P */
if (state != WPA_SCANNING)
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 55f3d88..aa97684 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -309,7 +309,9 @@ struct wpa_supplicant {
struct wpa_bss *current_bss;
int ap_ies_from_associnfo;
unsigned int assoc_freq;
-
+#ifdef LEGACY_STA_EVENTS
+ unsigned int assoc_retries;
+#endif
/* Selected configuration (based on Beacon/ProbeResp WPA IE) */
int pairwise_cipher;
int group_cipher;