wpa_supplicant does not work properly with some USB adapters on WinXP

Adrian Nistor anistor
Tue Aug 22 07:55:40 PDT 2006


Hi,
Yes, WMI is very weird in some aspects that should normally be really really
simple.

The suggestion to ignore the #Number suffix is not very nice because this
will make it impossible to have two identical adapters connected to a
computer. As I said previously, this is exactly my case :-).

 A Win32_PnPEntity instance exists for every adapter, even for those that
are not removable, even for legacy devices.

There is no need for very complex handling of the cases when the adapter is
added/removed.
Here is how I implemented it:

1. Find the Index of the adapter, knowing only the ifname (GUID)
         SELECT Index FROM Win32_NetworkAdapterConfiguration WHERE
SettingID='{bla bla bla}'
    This will always work, no fallback based on adapter description is
needed.

2. Register for async events on MSNdis_StatusMediaConnect,
MSNdis_StatusMediaDisconnect, ... WITHOUT using a filter. The event will be
filtered later when it is received.

3. When the event is received, look for the Win32_PnPEntity with the Name
equal to the InstanceName of the event, get its PNPDeviceId, get the
Win32_NetworkAdapter which has this PNPDeviceId. Compare the Index attribute
of the found Win32_NetworkAdapter with the index obtained in step 1. If they
match, the event is for the right adapter, otherwise drop it.
This works because the Index of an adapter is assigned to it when its driver
is first installed on the system and it never changes, even if the device is
unplugged/plugged or disabled/enabled.

So this solution works even in the case when the adapter is removed/added
but it is not as efficient as the one you implemented ;-).

Anyway, I hope you will choose an approach that will support the 'two
identical usb adapters scenario'.

Thank you!

On 8/22/06, Jouni Malinen <jkmaline at cc.hut.fi> wrote:
>
> On Tue, Aug 22, 2006 at 10:57:41AM +0300, Adrian Nistor wrote:
> > The idea to do the SELECTs in the opposite order and keep an
> > InstanceName-to-GUID mapping is great. It will decrease the number of
> WMI
> > calls per event and save a lot of time as WMI is notably slow.
>
> I think I'll keep it, but..
>
> > I could not find any relevant documentation regarding the source of the
> > InstanceName from WMI. I did some investigation and found the weird
> > behaviour regarding USB adapters I described in the previous mail (it
> can be
> > seen also in the log file I sent). In the process, I also found that the
> > InstanceName matches the Name from the Win32_PNPEntity instead.
>
> That's getting somewhat complex. Well, I can easily add the use on
> Win32_PnPEntity, but it sounds like that is not enough. There needs to
> be code for re-doing this whenever the adapter addition notification is
> received. Since ndis_events.exe can be made to receive this, it should
> be possible to take care of all this complexity there. Though, the
> current model of filtering all notifications based on a fixed interface
> name is not going to work..
>
> If the only thing changing is a number in the end of string, that can be
> handled relatively easily by using LIKE 'prefix%' type matching. In
> addition, I don't know whether Win32_PnPEntity is guaranteed to include
> all network adapters, so it might be good to default to using Name from
> Win32_NetworkAdapter and only replace it if a better candidate is found
> from Win32_PnPEntity. I really love WMI.. This has almost convinced me
> to write an own protocol driver for getting these events in a sane way..
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP at shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20060822/6651a312/attachment.htm 



More information about the Hostap mailing list