[PATCH 06/16] tests: Modify test_auto_m2d waiting for WPS-M2D

Peer, Ilan ilan.peer at intel.com
Sun Jun 21 09:54:28 EDT 2015



> -----Original Message-----
> From: Jouni Malinen [mailto:j at w1.fi]
> Sent: Friday, June 19, 2015 10:58
> To: Peer, Ilan
> Cc: hostap at lists.shmoo.com
> Subject: Re: [PATCH 06/16] tests: Modify test_auto_m2d waiting for WPS-
> M2D
> 
> 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).
> 

I can handle this based on driver capabilities as below. 

> > +    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.
> 

The delay is 1, as in the case of dev[1] (I only copied the same design used for it) so I considered it as ok. 

I can skip this test for case of the P2P Device interface ... it's the previous patch I'm more interested with :)

Regards,

Ilan.


More information about the HostAP mailing list