Patchwork [22/23] wpa_supplicant: refactor channel list update event

login
register
mail settings
Submitter Ilan Peer
Date July 7, 2014, 11:21 a.m.
Message ID <1404732076-32252-23-git-send-email-ilan.peer@intel.com>
Download mbox | patch
Permalink /patch/367525/
State New
Headers show

Comments

Ilan Peer - July 7, 2014, 11:21 a.m.
From: Arik Nemtsov <arik@wizery.com>

Update HW features for all interfaces inside the loop, don't treat wpa_s
specially. Perform the P2P channel list updates after the HW features
are updated. This will prevent P2P from relying on stale information.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
---
 wpa_supplicant/events.c |   26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

Patch

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index bfc9d4d..5d9bf56 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2763,26 +2763,18 @@  static void wpa_supplicant_update_channel_list(
 	if (wpa_s->drv_priv == NULL)
 		return; /* Ignore event during drv initialization */
 
-	free_hw_features(wpa_s);
-	wpa_s->hw.modes = wpa_drv_get_hw_feature_data(
-		wpa_s, &wpa_s->hw.num_modes, &wpa_s->hw.flags);
-
-	wpas_p2p_update_channel_list(wpa_s);
-
-	/*
-	 * Check other interfaces to see if they share the same radio. If
-	 * so, they get updated with this same hw mode info.
-	 */
 	dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
 			 radio_list) {
-		if (ifs != wpa_s) {
-			wpa_printf(MSG_DEBUG, "%s: Updating hw mode",
-				   ifs->ifname);
-			free_hw_features(ifs);
-			ifs->hw.modes = wpa_drv_get_hw_feature_data(
-				ifs, &ifs->hw.num_modes, &ifs->hw.flags);
-		}
+		wpa_printf(MSG_DEBUG, "%s: Updating hw mode",
+			   ifs->ifname);
+		free_hw_features(ifs);
+		ifs->hw.modes = wpa_drv_get_hw_feature_data(
+			ifs, &ifs->hw.num_modes, &ifs->hw.flags);
 	}
+
+ #ifdef CONFIG_P2P
+	wpas_p2p_update_channel_list(wpa_s);
+ #endif /* CONFIG_P2P */
 }