Revert "[wpa_supplicant] cumilative patch from commit 4b755c967"

Revert submission 26533062-Supplicant_merge_June24

Reason for revert: https://b.corp.google.com/issues/349780869

Reverted changes: /q/submissionid:26533062-Supplicant_merge_June24

Change-Id: I6c9b7a4323fa7edde47617da6c1e0d8f6e6d5101
diff --git a/hostapd/main.c b/hostapd/main.c
index 3a14381..0fe2d74 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -177,15 +177,9 @@
 			continue;
 		}
 
-		if (!hconf->mld_ap) {
+		if (!hconf->mld_ap || hconf->mld_id != conf->mld_id) {
 			wpa_printf(MSG_DEBUG,
-				   "MLD: Skip non-MLD");
-			continue;
-		}
-
-		if (!hostapd_is_ml_partner(hapd, h_hapd)) {
-			wpa_printf(MSG_DEBUG,
-				   "MLD: Skip non matching MLD vif name");
+				   "MLD: Skip non matching mld_id");
 			continue;
 		}
 
@@ -197,7 +191,6 @@
 		}
 
 		hapd->drv_priv = h_hapd->drv_priv;
-		hapd->interface_added = h_hapd->interface_added;
 
 		/*
 		 * All interfaces participating in the AP MLD would have
@@ -207,15 +200,20 @@
 		 * is not configured, and otherwise it would be the
 		 * configured BSSID.
 		 */
+		os_memcpy(hapd->mld_addr, h_hapd->mld_addr, ETH_ALEN);
 		if (is_zero_ether_addr(b)) {
-			os_memcpy(hapd->own_addr, h_hapd->mld->mld_addr,
-				  ETH_ALEN);
+			os_memcpy(hapd->own_addr, h_hapd->mld_addr, ETH_ALEN);
 			random_mac_addr_keep_oui(hapd->own_addr);
 		} else {
 			os_memcpy(hapd->own_addr, b, ETH_ALEN);
 		}
 
-		hostapd_mld_add_link(hapd);
+		/*
+		 * Mark the interface as a secondary interface, as this
+		 * is needed for the de-initialization flow
+		 */
+		hapd->mld_first_bss = h_hapd;
+		hapd->mld_link_id = hapd->mld_first_bss->mld_next_link_id++;
 
 		goto setup_mld;
 	}
@@ -292,14 +290,13 @@
 	 * configured, and otherwise it would be the configured BSSID.
 	 */
 	if (hapd->conf->mld_ap) {
-		os_memcpy(hapd->mld->mld_addr, hapd->own_addr, ETH_ALEN);
-
+		os_memcpy(hapd->mld_addr, hapd->own_addr, ETH_ALEN);
+		hapd->mld_next_link_id = 0;
+		hapd->mld_link_id = hapd->mld_next_link_id++;
 		if (!b)
 			random_mac_addr_keep_oui(hapd->own_addr);
 		else
 			os_memcpy(hapd->own_addr, b, ETH_ALEN);
-
-		hostapd_mld_add_link(hapd);
 	}
 
 setup_mld:
@@ -311,7 +308,6 @@
 
 		iface->drv_flags = capa.flags;
 		iface->drv_flags2 = capa.flags2;
-		iface->drv_rrm_flags = capa.rrm_flags;
 		iface->probe_resp_offloads = capa.probe_resp_offloads;
 		/*
 		 * Use default extended capa values from per-radio information
@@ -354,7 +350,7 @@
 		wpa_printf(MSG_DEBUG,
 			   "MLD: Set link_id=%u, mld_addr=" MACSTR
 			   ", own_addr=" MACSTR,
-			   hapd->mld_link_id, MAC2STR(hapd->mld->mld_addr),
+			   hapd->mld_link_id, MAC2STR(hapd->mld_addr),
 			   MAC2STR(hapd->own_addr));
 
 		hostapd_drv_link_add(hapd, hapd->mld_link_id,
@@ -762,29 +758,6 @@
 }
 
 
-static void hostapd_global_cleanup_mld(struct hapd_interfaces *interfaces)
-{
-#ifdef CONFIG_IEEE80211BE
-	size_t i;
-
-	if (!interfaces || !interfaces->mld)
-		return;
-
-	for (i = 0; i < interfaces->mld_count; i++) {
-		if (!interfaces->mld[i])
-			continue;
-
-		os_free(interfaces->mld[i]);
-		interfaces->mld[i] = NULL;
-	}
-
-	os_free(interfaces->mld);
-	interfaces->mld = NULL;
-	interfaces->mld_count = 0;
-#endif /* CONFIG_IEEE80211BE */
-}
-
-
 int main(int argc, char *argv[])
 {
 	struct hapd_interfaces interfaces;
@@ -1070,8 +1043,6 @@
 	interfaces.iface = NULL;
 	interfaces.count = 0;
 
-	hostapd_global_cleanup_mld(&interfaces);
-
 #ifdef CONFIG_DPP
 	dpp_global_deinit(interfaces.dpp);
 #endif /* CONFIG_DPP */