[PATCH 06/16] tests: Modify test_auto_m2d waiting for WPS-M2D
Jouni Malinen
j
Fri Jun 19 00:58:13 PDT 2015
On Wed, Jun 17, 2015 at 04:24:52PM +0300, Ilan Peer wrote:
> In case a dedicated P2P Device interface is used,
> the test needs to wait on the group interface, but since
> a group is not formed, the wpasupplicant object does not
> have the group interface name so it waits on the wrong
> interface for the event.
>
> Fix this by explicitly waiting on the right interface,
> based on the driver capabilities.
This looks pretty suspicious..
> diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py
> @@ -186,7 +186,16 @@ def test_autogo_m2d(dev):
> ev = dev[2].wait_global_event(["WPS-M2D"], timeout=10)
> if ev is None:
> raise Exception("No global M2D event (2)")
> - ev = dev[2].wait_event(["WPS-M2D"], timeout=10)
I don't think it would be a good idea to get rid of that design in
non-P2P Device interface case (i.e., the default behavior for the hwsim
tests).
> + ifaces = dev[2].request("INTERFACES").splitlines()
> + res = dev[2].get_driver_status()
> + if (int(res['capa.flags'], 0) & 0x20000000):
> + iface = ifaces[0] if "p2p-wlan" in ifaces[0] else ifaces[1]
> + else:
> + iface = ifaces[0]
> +
> + wpas = WpaSupplicant(ifname=iface)
> + ev = wpas.wait_event(["WPS-M2D"], timeout=10)
And this opening of a new WpaSupplicant instance would not work properly
since it would not have queued the WPS-M2D event that would have already
happened by this code is run. The wpa_supplicant control interface
monitor needs to be already running at the time the command that
generates an event is issued. You might be able to catch the second
WPS-M2D event later, but that would add more latency here unnecessarily.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list