Revert "Cumulative patch from commit 4ec1fd8e42bad9390f14a58225b6e5f6fb691950"

This reverts commit 78a5dac804c22aa6e4ec8226a864d3b0d6ccddbb.

Test: None
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 17f057a..6f8fc81 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1047,16 +1047,6 @@
 			continue;
 		}
 
-#ifndef CONFIG_IBSS_RSN
-		if (ssid->mode == WPAS_MODE_IBSS &&
-		    !(ssid->key_mgmt & (WPA_KEY_MGMT_NONE |
-					WPA_KEY_MGMT_WPA_NONE))) {
-			wpa_dbg(wpa_s, MSG_DEBUG,
-				"   skip - IBSS RSN not supported in the build");
-			continue;
-		}
-#endif /* !CONFIG_IBSS_RSN */
-
 #ifdef CONFIG_P2P
 		if (ssid->p2p_group &&
 		    !wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) &&
@@ -1342,17 +1332,6 @@
 		{
 			if (wpas_network_disabled(wpa_s, ssid))
 				continue;
-#ifndef CONFIG_IBSS_RSN
-			if (ssid->mode == WPAS_MODE_IBSS &&
-			    !(ssid->key_mgmt & (WPA_KEY_MGMT_NONE |
-						WPA_KEY_MGMT_WPA_NONE))) {
-				wpa_msg(wpa_s, MSG_INFO,
-					"IBSS RSN not supported in the build - cannot use the profile for SSID '%s'",
-					wpa_ssid_txt(ssid->ssid,
-						     ssid->ssid_len));
-				continue;
-			}
-#endif /* !CONFIG_IBSS_RSN */
 			if (ssid->mode == IEEE80211_MODE_IBSS ||
 			    ssid->mode == IEEE80211_MODE_AP ||
 			    ssid->mode == IEEE80211_MODE_MESH)
@@ -1495,18 +1474,11 @@
 }
 
 
-/*
- * Return a negative value if no scan results could be fetched or if scan
- * results should not be shared with other virtual interfaces.
- * Return 0 if scan results were fetched and may be shared with other
- * interfaces.
- * Return 1 if scan results may be shared with other virtual interfaces but may
- * not trigger any operations.
- * Return 2 if the interface was removed and cannot be used.
- */
+/* Return != 0 if no scan results could be fetched or if scan results should not
+ * be shared with other virtual interfaces. */
 static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 					      union wpa_event_data *data,
-					      int own_request, int update_only)
+					      int own_request)
 {
 	struct wpa_scan_results *scan_res = NULL;
 	int ret = 0;
@@ -1556,11 +1528,6 @@
 	}
 #endif /* CONFIG_NO_RANDOM_POOL */
 
-	if (update_only) {
-		ret = 1;
-		goto scan_work_done;
-	}
-
 	if (own_request && wpa_s->scan_res_handler &&
 	    !(data && data->scan_info.external_scan)) {
 		void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
@@ -1569,7 +1536,7 @@
 		scan_res_handler = wpa_s->scan_res_handler;
 		wpa_s->scan_res_handler = NULL;
 		scan_res_handler(wpa_s, scan_res);
-		ret = 1;
+		ret = -2;
 		goto scan_work_done;
 	}
 
@@ -1705,9 +1672,8 @@
 		if (new_scan)
 			wpa_supplicant_rsn_preauth_scan_results(wpa_s);
 		/*
-		 * Do not allow other virtual radios to trigger operations based
-		 * on these scan results since we do not want them to start
-		 * other associations at the same time.
+		 * Do not notify other virtual radios of scan results since we do not
+		 * want them to start other associations at the same time.
 		 */
 		return 1;
 	} else {
@@ -1791,7 +1757,7 @@
 	struct wpa_supplicant *ifs;
 	int res;
 
-	res = _wpa_supplicant_event_scan_results(wpa_s, data, 1, 0);
+	res = _wpa_supplicant_event_scan_results(wpa_s, data, 1);
 	if (res == 2) {
 		/*
 		 * Interface may have been removed, so must not dereference
@@ -1799,8 +1765,7 @@
 		 */
 		return 1;
 	}
-
-	if (res < 0) {
+	if (res != 0) {
 		/*
 		 * If no scan results could be fetched, then no need to
 		 * notify those interfaces that did not actually request
@@ -1820,10 +1785,7 @@
 		if (ifs != wpa_s) {
 			wpa_printf(MSG_DEBUG, "%s: Updating scan results from "
 				   "sibling", ifs->ifname);
-			res = _wpa_supplicant_event_scan_results(ifs, data, 0,
-								 res > 0);
-			if (res < 0)
-				return 0;
+			_wpa_supplicant_event_scan_results(ifs, data, 0);
 		}
 	}
 
@@ -2079,19 +2041,6 @@
 	if (!found && data->assoc_info.req_ies)
 		wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
 
-#ifdef CONFIG_FILS
-#ifdef CONFIG_SME
-	if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FILS &&
-	    (!data->assoc_info.resp_frame ||
-	     fils_process_assoc_resp(wpa_s->wpa,
-				     data->assoc_info.resp_frame,
-				     data->assoc_info.resp_frame_len) < 0)) {
-		wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_UNSPECIFIED);
-		return -1;
-	}
-#endif /* CONFIG_SME */
-#endif /* CONFIG_FILS */
-
 #ifdef CONFIG_IEEE80211R
 #ifdef CONFIG_SME
 	if (wpa_s->sme.auth_alg == WPA_AUTH_ALG_FT) {
@@ -2313,13 +2262,6 @@
 	ft_completed = wpa_ft_is_completed(wpa_s->wpa);
 	if (data && wpa_supplicant_event_associnfo(wpa_s, data) < 0)
 		return;
-	/*
-	 * FILS authentication can share the same mechanism to mark the
-	 * connection fully authenticated, so set ft_completed also based on
-	 * FILS result.
-	 */
-	if (!ft_completed)
-		ft_completed = wpa_fils_is_completed(wpa_s->wpa);
 
 	if (wpa_drv_get_bssid(wpa_s, bssid) < 0) {
 		wpa_dbg(wpa_s, MSG_ERROR, "Failed to get BSSID");
@@ -2576,7 +2518,6 @@
 	struct wpa_bss *fast_reconnect = NULL;
 	struct wpa_ssid *fast_reconnect_ssid = NULL;
 	struct wpa_ssid *last_ssid;
-	struct wpa_bss *curr = NULL;
 
 	authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING;
 	os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN);
@@ -2592,19 +2533,6 @@
 		return;
 	}
 
-	if (!wpa_s->disconnected && wpa_s->wpa_state >= WPA_AUTHENTICATING &&
-	    reason_code == WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY &&
-	    locally_generated)
-		/*
-		 * Remove the inactive AP (which is probably out of range) from
-		 * the BSS list after marking disassociation. In particular
-		 * mac80211-based drivers use the
-		 * WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY reason code in
-		 * locally generated disconnection events for cases where the
-		 * AP does not reply anymore.
-		 */
-		curr = wpa_s->current_bss;
-
 	if (could_be_psk_mismatch(wpa_s, reason_code, locally_generated)) {
 		wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
 			"pre-shared key may be incorrect");
@@ -2666,9 +2594,6 @@
 	last_ssid = wpa_s->current_ssid;
 	wpa_supplicant_mark_disassoc(wpa_s);
 
-	if (curr)
-		wpa_bss_remove(wpa_s, curr, "Connection to AP lost");
-
 	if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) {
 		sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid);
 		wpa_s->current_ssid = last_ssid;
@@ -3294,16 +3219,14 @@
 		free_hw_features(ifs);
 		ifs->hw.modes = wpa_drv_get_hw_feature_data(
 			ifs, &ifs->hw.num_modes, &ifs->hw.flags);
+	}
 
-		/* Restart PNO/sched_scan with updated channel list */
-		if (ifs->pno) {
-			wpas_stop_pno(ifs);
-			wpas_start_pno(ifs);
-		} else if (ifs->sched_scanning && !ifs->pno_sched_pending) {
-			wpa_dbg(ifs, MSG_DEBUG,
-				"Channel list changed - restart sched_scan");
-			wpas_scan_restart_sched_scan(ifs);
-		}
+	/* Restart sched_scan with updated channel list */
+	if (wpa_s->sched_scanning) {
+		wpa_dbg(wpa_s, MSG_DEBUG,
+			"Channel list changed restart sched scan.");
+		wpa_supplicant_cancel_sched_scan(wpa_s);
+		wpa_supplicant_req_scan(wpa_s, 0, 0);
 	}
 
 	wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DRIVER);
@@ -4124,20 +4047,6 @@
 			break;
 
 		/*
-		 * If the driver stopped scanning without being requested to,
-		 * request a new scan to continue scanning for networks.
-		 */
-		if (!wpa_s->sched_scan_stop_req &&
-		    wpa_s->wpa_state == WPA_SCANNING) {
-			wpa_dbg(wpa_s, MSG_DEBUG,
-				"Restart scanning after unexpected sched_scan stop event");
-			wpa_supplicant_req_scan(wpa_s, 1, 0);
-			break;
-		}
-
-		wpa_s->sched_scan_stop_req = 0;
-
-		/*
 		 * Start a new sched scan to continue searching for more SSIDs
 		 * either if timed out or PNO schedule scan is pending.
 		 */