Revert "Revert "[wpa_supplicant] cumilative patch from commit 4b..."
Revert submission 28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Fixed the regression issue (ag/28389573)
Bug: 329004037
Reverted changes: /q/submissionid:28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Test: Turn ON/OFF SoftAp
Change-Id: Ie7ea1ee7f8b1311fce280907d37a2e321542f547
diff --git a/src/rsn_supp/pmksa_cache.c b/src/rsn_supp/pmksa_cache.c
index e243756..a402cb6 100644
--- a/src/rsn_supp/pmksa_cache.c
+++ b/src/rsn_supp/pmksa_cache.c
@@ -857,4 +857,99 @@
}
}
+#else /* IEEE8021X_EAPOL */
+
+struct rsn_pmksa_cache *
+pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
+ void *ctx, enum pmksa_free_reason reason),
+ bool (*is_current_cb)(struct rsn_pmksa_cache_entry *entry,
+ void *ctx),
+ void (*notify_cb)(struct rsn_pmksa_cache_entry *entry,
+ void *ctx),
+ void *ctx, struct wpa_sm *sm)
+{
+ return (void *) -1;
+}
+
+
+void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
+{
+}
+
+
+struct rsn_pmksa_cache_entry *
+pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *spa,
+ const u8 *pmkid, const void *network_ctx, int akmp)
+{
+ return NULL;
+}
+
+
+struct rsn_pmksa_cache_entry *
+pmksa_cache_get_current(struct wpa_sm *sm)
+{
+ return NULL;
+}
+
+
+int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len)
+{
+ return -1;
+}
+
+
+struct rsn_pmksa_cache_entry *
+pmksa_cache_head(struct rsn_pmksa_cache *pmksa)
+{
+ return NULL;
+}
+
+
+struct rsn_pmksa_cache_entry *
+pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
+ struct rsn_pmksa_cache_entry *entry)
+{
+ return NULL;
+}
+
+
+struct rsn_pmksa_cache_entry *
+pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
+ const u8 *pmkid, const u8 *kck, size_t kck_len,
+ const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
+ const u8 *cache_id)
+{
+ return NULL;
+}
+
+
+void pmksa_cache_clear_current(struct wpa_sm *sm)
+{
+}
+
+
+int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid, const u8 *bssid,
+ void *network_ctx, int try_opportunistic,
+ const u8 *fils_cache_id, int akmp, bool associated)
+{
+ return -1;
+}
+
+
+void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx,
+ const u8 *pmk, size_t pmk_len, bool external_only)
+{
+}
+
+
+void pmksa_cache_remove(struct rsn_pmksa_cache *pmksa,
+ struct rsn_pmksa_cache_entry *entry)
+{
+}
+
+
+void pmksa_cache_reconfig(struct rsn_pmksa_cache *pmksa)
+{
+}
+
#endif /* IEEE8021X_EAPOL */
diff --git a/src/rsn_supp/pmksa_cache.h b/src/rsn_supp/pmksa_cache.h
index 6ba48f7..b1203ad 100644
--- a/src/rsn_supp/pmksa_cache.h
+++ b/src/rsn_supp/pmksa_cache.h
@@ -64,8 +64,6 @@
PMKSA_EXPIRE,
};
-#if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA)
-
struct rsn_pmksa_cache *
pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
void *ctx, enum pmksa_free_reason reason),
@@ -105,95 +103,4 @@
struct rsn_pmksa_cache_entry *entry);
void pmksa_cache_reconfig(struct rsn_pmksa_cache *pmksa);
-#else /* IEEE8021X_EAPOL */
-
-static inline struct rsn_pmksa_cache *
-pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
- void *ctx, enum pmksa_free_reason reason),
- bool (*is_current_cb)(struct rsn_pmksa_cache_entry *entry,
- void *ctx),
- void (*notify_cb)(struct rsn_pmksa_cache_entry *entry,
- void *ctx),
- void *ctx, struct wpa_sm *sm)
-{
- return (void *) -1;
-}
-
-static inline void pmksa_cache_deinit(struct rsn_pmksa_cache *pmksa)
-{
-}
-
-static inline struct rsn_pmksa_cache_entry *
-pmksa_cache_get(struct rsn_pmksa_cache *pmksa, const u8 *aa, const u8 *spa,
- const u8 *pmkid, const void *network_ctx, int akmp)
-{
- return NULL;
-}
-
-static inline struct rsn_pmksa_cache_entry *
-pmksa_cache_get_current(struct wpa_sm *sm)
-{
- return NULL;
-}
-
-static inline int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf,
- size_t len)
-{
- return -1;
-}
-
-static inline struct rsn_pmksa_cache_entry *
-pmksa_cache_head(struct rsn_pmksa_cache *pmksa)
-{
- return NULL;
-}
-
-static inline struct rsn_pmksa_cache_entry *
-pmksa_cache_add_entry(struct rsn_pmksa_cache *pmksa,
- struct rsn_pmksa_cache_entry *entry)
-{
- return NULL;
-}
-
-static inline struct rsn_pmksa_cache_entry *
-pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
- const u8 *pmkid, const u8 *kck, size_t kck_len,
- const u8 *aa, const u8 *spa, void *network_ctx, int akmp,
- const u8 *cache_id)
-{
- return NULL;
-}
-
-static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
-{
-}
-
-static inline int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
- const u8 *bssid,
- void *network_ctx,
- int try_opportunistic,
- const u8 *fils_cache_id,
- int akmp, bool associated)
-{
- return -1;
-}
-
-static inline void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa,
- void *network_ctx,
- const u8 *pmk, size_t pmk_len,
- bool external_only)
-{
-}
-
-static inline void pmksa_cache_remove(struct rsn_pmksa_cache *pmksa,
- struct rsn_pmksa_cache_entry *entry)
-{
-}
-
-static inline void pmksa_cache_reconfig(struct rsn_pmksa_cache *pmksa)
-{
-}
-
-#endif /* IEEE8021X_EAPOL */
-
#endif /* PMKSA_CACHE_H */
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 8a75091..65960b7 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -161,6 +161,8 @@
int chan_switch_enabled;
int mld_link_id;
+ bool disc_resp_rcvd;
+ bool setup_req_rcvd;
};
@@ -1569,9 +1571,8 @@
} else {
int i;
- for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
- if ((sm->mlo.valid_links & BIT(i)) &&
- ether_addr_equal(lnkid->bssid,
+ for_each_link(sm->mlo.valid_links, i) {
+ if (ether_addr_equal(lnkid->bssid,
sm->mlo.links[i].bssid)) {
*link_id = i;
break;
@@ -2868,6 +2869,12 @@
return 0;
}
+ if (sm->mlo.valid_links && !peer->disc_resp_rcvd) {
+ wpa_printf(MSG_DEBUG,
+ "TDLS: MLO STA connection - defer the setup request since Discovery Resp not yet received");
+ peer->setup_req_rcvd = true;
+ return 0;
+ }
peer->initiator = 1;
/* add the peer to the driver as a "setup in progress" peer */
@@ -3236,6 +3243,13 @@
wpa_printf(MSG_DEBUG, "TDLS: Link identifier BSS: " MACSTR
" , link id: %u", MAC2STR(lnkid->bssid), link_id);
+ peer->disc_resp_rcvd = true;
+ if (peer->setup_req_rcvd) {
+ peer->setup_req_rcvd = false;
+ wpa_printf(MSG_DEBUG, "TDLS: Process the deferred TDLS start");
+ return wpa_tdls_start(sm, addr);
+ }
+
return 0;
}
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 3eaa015..f5e24f2 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -801,8 +801,8 @@
int i;
unsigned int num_links = 0;
- for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
- if (sm->mlo.assoc_link_id != i && (sm->mlo.req_links & BIT(i)))
+ for_each_link(sm->mlo.req_links, i) {
+ if (sm->mlo.assoc_link_id != i)
num_links++;
}
@@ -815,8 +815,8 @@
int i;
u8 hdr[1 + ETH_ALEN];
- for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
- if (sm->mlo.assoc_link_id == i || !(sm->mlo.req_links & BIT(i)))
+ for_each_link(sm->mlo.req_links, i) {
+ if (sm->mlo.assoc_link_id == i)
continue;
wpa_printf(MSG_DEBUG,
@@ -1551,10 +1551,7 @@
{
u8 i;
- for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
- if (!(sm->mlo.valid_links & BIT(i)))
- continue;
-
+ for_each_link(sm->mlo.valid_links, i) {
if (!ie->mlo_gtk[i]) {
wpa_msg(sm->ctx->msg_ctx, MSG_ERROR,
"MLO RSN: GTK not found for link ID %u", i);
@@ -1903,10 +1900,7 @@
sm->mgmt_group_cipher == WPA_CIPHER_GTK_NOT_USED)
return 0;
- for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
- if (!(sm->mlo.valid_links & BIT(i)))
- continue;
-
+ for_each_link(sm->mlo.valid_links, i) {
if (_mlo_ieee80211w_set_keys(sm, i, ie))
return -1;
}
@@ -2932,10 +2926,7 @@
wpa_msg(sm->ctx->msg_ctx, MSG_INFO,
"MLO RSN: Failed to configure MLO IGTK");
- for (i = 0; i < MAX_NUM_MLO_LINKS; i++) {
- if (!(sm->mlo.valid_links & BIT(i)))
- continue;
-
+ for_each_link(sm->mlo.valid_links, i) {
/*
* AP may send group keys for subset of the all links during
* rekey