Notify the bssid driver sent in assoc-reject.
Hidl sends the wpa_s->pending_bssid to framework in assoc-reject event.
Pending_bssid is the bssid supplicant suggested to driver to connect.
But driver has its own network selection logic to pick the bssid.
Driver sends the last bssid it tried to connect and failed in
assoc-reject event. Since hidl is sending the pending_bssid
to framework, framework is always blocklisting pending_bssid instead
of the actual bssid driver sends in assoc reject.
Fix is to fetch the rejected bssid from assoc-reject event and send
to hidl in wpas_notify_assoc_status() call.
Also removed assoc timed_out flag from struct wpa_supplicant and added
as a parameter in wpas_notify_assoc_status() call.
Bug: 162671127
Test: Manual - Basic wifi functional test.
Test: Manual - Triggered assoc-rejection event and confirmed from logs
that hidl is sending the bssid came from driver in
assoc-reject event.
Change-Id: I4173bce8277dc6c2511dc7384e4a6cc4bb56a3e3
Merged-In: I4173bce8277dc6c2511dc7384e4a6cc4bb56a3e3
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index e2cae4b..7b68ebe 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -4365,8 +4365,8 @@
data->assoc_reject.timeout_reason ?
data->assoc_reject.timeout_reason : "");
wpa_s->assoc_status_code = data->assoc_reject.status_code;
- wpa_s->assoc_timed_out = data->assoc_reject.timed_out;
- wpas_notify_assoc_status_code(wpa_s);
+ wpas_notify_assoc_status_code(wpa_s,
+ bssid, data->assoc_reject.timed_out);
#ifdef CONFIG_OWE
if (data->assoc_reject.status_code ==
diff --git a/wpa_supplicant/hidl/1.3/hidl.cpp b/wpa_supplicant/hidl/1.3/hidl.cpp
index 4c2d434..310e56c 100644
--- a/wpa_supplicant/hidl/1.3/hidl.cpp
+++ b/wpa_supplicant/hidl/1.3/hidl.cpp
@@ -282,7 +282,8 @@
hidl_manager->notifyDisconnectReason(wpa_s);
}
-void wpas_hidl_notify_assoc_reject(struct wpa_supplicant *wpa_s)
+void wpas_hidl_notify_assoc_reject(struct wpa_supplicant *wpa_s,
+ const u8 *bssid, u8 timed_out)
{
if (!wpa_s)
return;
@@ -295,7 +296,7 @@
if (!hidl_manager)
return;
- hidl_manager->notifyAssocReject(wpa_s);
+ hidl_manager->notifyAssocReject(wpa_s, bssid, timed_out);
}
void wpas_hidl_notify_auth_timeout(struct wpa_supplicant *wpa_s)
diff --git a/wpa_supplicant/hidl/1.3/hidl.h b/wpa_supplicant/hidl/1.3/hidl.h
index 304a4d6..bf03bf9 100644
--- a/wpa_supplicant/hidl/1.3/hidl.h
+++ b/wpa_supplicant/hidl/1.3/hidl.h
@@ -50,7 +50,8 @@
struct wpa_supplicant *wpa_s, u8 code, u16 reauth_delay,
const char *url);
void wpas_hidl_notify_disconnect_reason(struct wpa_supplicant *wpa_s);
- void wpas_hidl_notify_assoc_reject(struct wpa_supplicant *wpa_s);
+ void wpas_hidl_notify_assoc_reject(struct wpa_supplicant *wpa_s,
+ const u8 *bssid, u8 timed_out);
void wpas_hidl_notify_auth_timeout(struct wpa_supplicant *wpa_s);
void wpas_hidl_notify_bssid_changed(struct wpa_supplicant *wpa_s);
void wpas_hidl_notify_wps_event_fail(
@@ -164,7 +165,8 @@
struct wpa_supplicant *wpa_s, u8 code, u16 reauth_delay, const char *url)
{}
static void wpas_hidl_notify_disconnect_reason(struct wpa_supplicant *wpa_s) {}
-static void wpas_hidl_notify_assoc_reject(struct wpa_supplicant *wpa_s) {}
+static void wpas_hidl_notify_assoc_reject(struct wpa_supplicant *wpa_s,
+ const u8 *bssid, u8 timed_out) {}
static void wpas_hidl_notify_auth_timeout(struct wpa_supplicant *wpa_s) {}
static void wpas_hidl_notify_wps_event_fail(
struct wpa_supplicant *wpa_s, uint8_t *peer_macaddr, uint16_t config_error,
diff --git a/wpa_supplicant/hidl/1.3/hidl_manager.cpp b/wpa_supplicant/hidl/1.3/hidl_manager.cpp
index e15e9fd..2734e98 100644
--- a/wpa_supplicant/hidl/1.3/hidl_manager.cpp
+++ b/wpa_supplicant/hidl/1.3/hidl_manager.cpp
@@ -969,8 +969,12 @@
*
* @param wpa_s |wpa_supplicant| struct corresponding to the interface on which
* the network is present.
+ * @param bssid bssid of AP that rejected the association.
+ * @param timed_out flag to indicate failure is due to timeout
+ * (auth, assoc, ...) rather than explicit rejection response from the AP.
*/
-void HidlManager::notifyAssocReject(struct wpa_supplicant *wpa_s)
+void HidlManager::notifyAssocReject(struct wpa_supplicant *wpa_s,
+ const u8 *bssid, u8 timed_out)
{
if (!wpa_s)
return;
@@ -979,19 +983,13 @@
sta_iface_object_map_.end())
return;
- const u8 *bssid = wpa_s->bssid;
- if (is_zero_ether_addr(bssid)) {
- bssid = wpa_s->pending_bssid;
- }
-
callWithEachStaIfaceCallback(
wpa_s->ifname,
std::bind(
&ISupplicantStaIfaceCallback::onAssociationRejected,
std::placeholders::_1, bssid,
static_cast<ISupplicantStaIfaceCallback::StatusCode>(
- wpa_s->assoc_status_code),
- wpa_s->assoc_timed_out == 1));
+ wpa_s->assoc_status_code), timed_out == 1));
}
void HidlManager::notifyAuthTimeout(struct wpa_supplicant *wpa_s)
diff --git a/wpa_supplicant/hidl/1.3/hidl_manager.h b/wpa_supplicant/hidl/1.3/hidl_manager.h
index e49e28d..b40d303 100644
--- a/wpa_supplicant/hidl/1.3/hidl_manager.h
+++ b/wpa_supplicant/hidl/1.3/hidl_manager.h
@@ -83,7 +83,8 @@
struct wpa_supplicant *wpa_s, u8 code, u16 reauth_delay,
const char *url);
void notifyDisconnectReason(struct wpa_supplicant *wpa_s);
- void notifyAssocReject(struct wpa_supplicant *wpa_s);
+ void notifyAssocReject(struct wpa_supplicant *wpa_s,
+ const u8 *bssid, u8 timed_out);
void notifyAuthTimeout(struct wpa_supplicant *wpa_s);
void notifyBssidChanged(struct wpa_supplicant *wpa_s);
void notifyWpsEventFail(
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 56eb62a..16e747f 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -148,14 +148,15 @@
}
-void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s)
+void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
+ const u8 *bssid, u8 timed_out)
{
if (wpa_s->p2p_mgmt)
return;
wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
- wpas_hidl_notify_assoc_reject(wpa_s);
+ wpas_hidl_notify_assoc_reject(wpa_s, bssid, timed_out);
}
void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index e9e39ee..0e7991b 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -28,7 +28,8 @@
enum wpa_states old_state);
void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s);
void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s);
-void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s);
+void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
+ const u8 *bssid, u8 timed_out);
void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s);
void wpas_notify_roam_time(struct wpa_supplicant *wpa_s);
void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 9a9ed8d..98b317e 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1064,8 +1064,6 @@
/* WLAN_STATUS_* status codes from (Re)Association Response frame. */
u16 assoc_status_code;
- /* Indicates if the previous association request timed out. */
- u8 assoc_timed_out;
struct ext_password_data *ext_pw;