diff mbox

wpa_supplicant: send event to all interfaces

Message ID 1459450394-19120-1-git-send-email-janusz.dziedzic@tieto.com
State Deferred
Headers show

Commit Message

Janusz.Dziedzic@tieto.com March 31, 2016, 6:53 p.m. UTC
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@tieto.com>
---
Now, seems we pass test where we wait for REGDOM event
janusz@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(-)

Comments

Jouni Malinen April 2, 2016, 10:30 a.m. UTC | #1
On Thu, Mar 31, 2016 at 08:53:14PM +0200, Janusz Dziedzic wrote:
> 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.

Could you please clarify what exactly you mean with hwsim test cases
failing? I don't see such a failure in my testing.. Is this only
relevant for the remote test cases that you show in the example below?

> Now, seems we pass test where we wait for REGDOM event
> janusz@dell6430:/home/work/hostap/tests/remote$ ./run-tests.py -r hwsim0 -r hwsim1 -r hwsim2 -d hwsim3 -d hwsim4 -h ibss_5ghz

tests/remote does not exist in hostap.git, so it is a bit difficult to
understand this type of comments before either the changes have been
added for that or the commit message is clearer on what exactly is being
fixed if the same issue cannot be reproduced in the current hostap.git
snapshot.
Janusz Dziedzic April 2, 2016, 4:56 p.m. UTC | #2
=

2016-04-02 12:30 GMT+02:00 Jouni Malinen <j@w1.fi>:
> On Thu, Mar 31, 2016 at 08:53:14PM +0200, Janusz Dziedzic wrote:
>> 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.
>
> Could you please clarify what exactly you mean with hwsim test cases
> failing? I don't see such a failure in my testing.. Is this only
> relevant for the remote test cases that you show in the example below?
>
It should also failed in case your driver using p2p-dev. In such case you will
get only REGDOM-CHANGE on p2p-dev-wlan0 (only on first interface in iface
iterations), and never get such event on wlan0.
I think you can start mac80211_hwsim with support_p2p_device=1 and run
only ibss_5ghz to reproduce this problem.

For sure my patch fix this issue and each interface get REGODOM -CHANGE.
In my case p2p-dev-wlan0 and wlan0.
But I am not sure if this will not introduce some other issue. So
clarification is required here, how should we handle events when
ifidx==-1 and wdev_id is not set. If we should send such event to all
interfaces, then my patch do exactly that.

BR
Janusz
>> Now, seems we pass test where we wait for REGDOM event
>> janusz@dell6430:/home/work/hostap/tests/remote$ ./run-tests.py -r hwsim0 -r hwsim1 -r hwsim2 -d hwsim3 -d hwsim4 -h ibss_5ghz
>
> tests/remote does not exist in hostap.git, so it is a bit difficult to
> understand this type of comments before either the changes have been
> added for that or the commit message is clearer on what exactly is being
> fixed if the same issue cannot be reproduced in the current hostap.git
> snapshot.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
>
> _______________________________________________
> Hostap mailing list
> Hostap@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/hostap
diff mbox

Patch

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) {