Reconcile with jb-mr1-factory-release jb-mr1-release - do not merge
Change-Id: I99d44c2e57eba3b98e5d217591968559fa3d1fe3
diff --git a/wpa_supplicant/blacklist.c b/wpa_supplicant/blacklist.c
index fa8014c..2e01e7f 100644
--- a/wpa_supplicant/blacklist.c
+++ b/wpa_supplicant/blacklist.c
@@ -23,6 +23,9 @@
{
struct wpa_blacklist *e;
+ if (wpa_s == NULL || bssid == NULL)
+ return NULL;
+
e = wpa_s->blacklist;
while (e) {
if (os_memcmp(e->bssid, bssid, ETH_ALEN) == 0)
@@ -54,6 +57,9 @@
{
struct wpa_blacklist *e;
+ if (wpa_s == NULL || bssid == NULL)
+ return -1;
+
e = wpa_blacklist_get(wpa_s, bssid);
if (e) {
e->count++;
@@ -87,6 +93,9 @@
{
struct wpa_blacklist *e, *prev = NULL;
+ if (wpa_s == NULL || bssid == NULL)
+ return -1;
+
e = wpa_s->blacklist;
while (e) {
if (os_memcmp(e->bssid, bssid, ETH_ALEN) == 0) {
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 6e9d7ba..4b1d992 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2532,7 +2532,7 @@
sme_event_assoc_reject(wpa_s, data);
#ifdef ANDROID_P2P
#ifdef CONFIG_P2P
- else if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
+ else {
if(!wpa_s->current_ssid) {
wpa_printf(MSG_ERROR, "current_ssid == NULL");
break;
@@ -2541,9 +2541,10 @@
* waiting for the authentication timeout. Cancel the
* authentication timeout and retry the assoc.
*/
- if(wpa_s->current_ssid->assoc_retry++ < 5) {
+ if(wpa_s->current_ssid->assoc_retry++ < 10) {
wpa_printf(MSG_ERROR, "Retrying assoc: %d ",
wpa_s->current_ssid->assoc_retry);
+
wpa_supplicant_cancel_auth_timeout(wpa_s);
/* Clear the states */
@@ -2551,8 +2552,16 @@
wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
wpa_s->reassociate = 1;
- wpa_supplicant_req_scan(wpa_s, 1, 0);
- } else {
+ if (wpa_s->p2p_group_interface == NOT_P2P_GROUP_INTERFACE) {
+ const u8 *bl_bssid = data->assoc_reject.bssid;
+ if (!bl_bssid || is_zero_ether_addr(bl_bssid))
+ bl_bssid = wpa_s->pending_bssid;
+ wpa_blacklist_add(wpa_s, bl_bssid);
+ wpa_supplicant_req_scan(wpa_s, 0, 0);
+ } else {
+ wpa_supplicant_req_scan(wpa_s, 1, 0);
+ }
+ } else if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
/* If we ASSOC_REJECT's hits threshold, disable the
* network
*/
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index cd3aa56..e6b0128 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -2399,9 +2399,15 @@
* the persistent group so that we will remain on the current channel to
* acknowledge any possible retransmission from the peer.
*/
+#ifndef ANDROID_P2P
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: 50 ms wait on current channel before "
"starting persistent group");
os_sleep(0, 50000);
+#else
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: 100 ms wait on current channel before "
+ "starting persistent group");
+ os_sleep(0, 100000);
+#endif
wpas_p2p_group_add_persistent(wpa_s, ssid,
ssid->mode == WPAS_MODE_P2P_GO,
@@ -5438,32 +5444,35 @@
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->current_ssid) &&
+ (iface->current_ssid->frequency != freq) &&
+ ((iface->p2p_group_interface) ||
+ (iface->current_ssid->p2p_group))) {
- if (iface->p2p_group_interface == P2P_GROUP_INTERFACE_GO) {
- /* Try to see whether we can move the GO. If it
- * is not possible, remove the GO interface
- */
- if(wpa_drv_switch_channel(iface, freq) == 0) {
- wpa_printf(MSG_ERROR, "P2P: GO Moved to freq(%d)", freq);
- iface->current_ssid->frequency = freq;
- continue;
- }
+ if ((iface->p2p_group_interface == P2P_GROUP_INTERFACE_GO) ||
+ (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
+ */
+ if (wpa_drv_switch_channel(iface, freq) == 0) {
+ wpa_printf(MSG_ERROR, "P2P: GO Moved to freq(%d)", freq);
+ iface->current_ssid->frequency = freq;
+ continue;
+ }
}
/* If GO cannot be moved or if the conflicting interface is a
* P2P Client, remove the interface depending up on the connection
* priority */
- if(!wpas_is_p2p_prioritized(wpa_s)) {
+ if (!wpas_is_p2p_prioritized(wpa_s)) {
/* STA connection has priority over existing
* P2P connection. So remove the interface */
- wpa_printf(MSG_DEBUG, "P2P: Removing P2P connection due to Single channel"
+ wpa_printf(MSG_DEBUG, "P2P: Removing P2P connection due to Single channel "
"concurrent mode frequency conflict");
wpas_p2p_group_delete(iface, P2P_GROUP_REMOVAL_FREQ_CONFLICT);
} else {
/* Existing connection has the priority. Disable the newly
- * selected network and let the application know about it.
+ * selected network and let the application know about it.
*/
return -1;
}