wpa_cli_cmd_interface_remove: Works! but...

Adrian Nistor anistor
Tue Sep 5 01:03:20 PDT 2006


Hi all,
I've seen that problem too.

The issue is with the CoInitializeSecurity() call in ndis_events.c. It is
done too many times during the lifetime of the wpa_supplicant process. MSDN
says this call should be done only once during the lifetime of a process. A
second call will fail with the error RPC_E_TOO_LATE. This is also visible in
the log you supplied, look for the line:

             1157393449.796875: CoInitializeSecurity() failed - returned
0x80010119       <----- aka RPC_E_TOO_LATE

In ndis_events.c the static variable wmi_refcnt is used in order to avoid
doing initializations of COM and WMI code too many times. Still this is not
enough to ensure correctness, because after you remove all interfaces the
counter drops to 0 again and a subsequent add_interface will re-do all the
said initializations and call CoInitializeSecurity() again, which is wrong.
It is ok to do the COM and WMI thing again, but not ok to re-do
CoInitializeSecurity.

I suggest to add a new flag to indicate if CoInitializeSecurity() was
called, apart from the already existing wmi_refcnt variable.
This small patch fixed the problem.

Jouni, could you add this to the dev branch? Thank you!
Bye.


On 9/4/06, George S. Lockwood <gslockwood at gmail.com> wrote:
>
> Hello,
>
> wpa_cli_cmd_interface_add will successfully add interfaces to the sup
> / service from a cli style app.  However a continuously running sup /
> ser will accumulate these additions as subsequent cli app runs add
> them. (the reason it always adds is that at startup, the cli-style app
> will query the install nics and test for wifi scan ability to always
> use a valid nic (after user has possibly changed nics).
>
> So I implemented calls to wpa_cli_cmd_interface_remove to remove every
> interface defined in the sup / svc.  Then I add the specified one.
> This would insure that the sup's internal list is managed to just
> those I wish for it at cli startup.
>
> The log below shows that with the first run of the cli app, it (tries)
> to remove 1 interface (there are none yet), then adds one, then uses
> it to do a couple of things - the last being a scan_results.  Then the
> app shuts down and exits.
>
> Then I rerun the app.  this time it really does remove the interfaces,
> but the add fails.  the following line is the start of this
> remove/add.
> 1157393449.671875: Removing interface
> {50DC6661-5E1E-4D6A-A3AD-52FBA51C2D6E}
>
> you'll notice also, that though the card appears to pass some tests,
> the following is presented:
>
> 1157393449.796875: Failed to initialize driver interface
> 1157393449.796875: Failed to add interface
> \Device\NPF_{50DC6661-5E1E-4D6A-A3AD-52FBA51C2D6E}
>
>
> Any idea why? Is there a prefered method to accomplish what I describe
> above? I simply want to re-init the sup / service to have no defined
> nic interfaces everytime my cli-style app starts.
>
> here's the log:
>
>
> C:\WPA_Supplicant
> Suite\test_Supplicant-0.5-2006-08-28\vs2005\release>ppc_supplicant -dd
> -t -glo
> 1157393431.453125: CTRL: Open pipe 00B825D8
> 1157393431.453125: CTRL: ConnectNamedPipe: connection in progress
> 1157393441.656250: CTRL: wpa_supplicant_global_iface_receive
> 1157393441.656250: CTRL: GetOverlappedResult: New client connected


 --- log trimmed ---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20060905/a74bd78f/attachment.htm 



More information about the Hostap mailing list