[PATCH] wpa_supplicant: send event to all interfaces

Janusz Dziedzic janusz.dziedzic at tieto.com
Thu Mar 31 11:53:14 PDT 2016


In case we don't have ifidx and wdev_id pass
such event to all interfaces and bss.
Before we send event only to first interface and
in case we are using p2p-dev we send event only
to this one iface:

p2p-dev-wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD

Because of that we fail hwsim test cases eg. ibss_5ghz,
while we never get CTRL-EVENT-REGDOM-CHANGE on wlan0.

I also remove for_each() from wpa_supplicant_update_channel_list()
while this function will be called now for each interface.
So, seems this for_each() was a workaround for a real issue.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
Now, seems we pass test where we wait for REGDOM event
janusz at dell6430:/home/work/hostap/tests/remote$ ./run-tests.py -r hwsim0 -r hwsim1 -r hwsim2 -d hwsim3 -d hwsim4 -h ibss_5ghz
DUT: hwsim3
DUT: hwsim4
REF: hwsim0
REF: hwsim1
REF: hwsim2
RUN check_devices
PASS
START - ibss_5ghz (1/1)
PASS () - 21.613292s

 src/drivers/driver_nl80211_event.c | 10 ++++++++--
 wpa_supplicant/events.c            | 15 +++++----------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index bd16edb..5220fc2 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -2240,9 +2240,15 @@ int process_global_event(struct nl_msg *msg, void *arg)
 
 	dl_list_for_each_safe(drv, tmp, &global->interfaces,
 			      struct wpa_driver_nl80211_data, list) {
+		/* Send to all interfaces and bss */
+		if ((ifidx == -1 && !wdev_id_set)) {
+			for (bss = drv->first_bss; bss; bss = bss->next)
+				do_process_drv_event(bss, gnlh->cmd, tb);
+			continue;
+		}
+		/* Send to one bss */
 		for (bss = drv->first_bss; bss; bss = bss->next) {
-			if ((ifidx == -1 && !wdev_id_set) ||
-			    ifidx == bss->ifindex ||
+			if (ifidx == bss->ifindex ||
 			    (wdev_id_set && bss->wdev_id_set &&
 			     wdev_id == bss->wdev_id)) {
 				do_process_drv_event(bss, gnlh->cmd, tb);
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 3c3f626..2399520 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3159,8 +3159,6 @@ static const char * reg_type_str(enum reg_type type)
 static void wpa_supplicant_update_channel_list(
 	struct wpa_supplicant *wpa_s, struct channel_list_changed *info)
 {
-	struct wpa_supplicant *ifs;
-
 	wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_REGDOM_CHANGE "init=%s type=%s%s%s",
 		reg_init_str(info->initiator), reg_type_str(info->type),
 		info->alpha2[0] ? " alpha2=" : "",
@@ -3169,14 +3167,11 @@ static void wpa_supplicant_update_channel_list(
 	if (wpa_s->drv_priv == NULL)
 		return; /* Ignore event during drv initialization */
 
-	dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
-			 radio_list) {
-		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",
+		   wpa_s->ifname);
+	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);
 
 	/* Restart sched_scan with updated channel list */
 	if (wpa_s->sched_scanning) {
-- 
1.9.1




More information about the Hostap mailing list