[PATCH v2] wpa_supplicant: Denitialize the driver if the last user went away

Jouni Malinen j
Sun Nov 23 11:55:24 PST 2014

On Tue, Nov 11, 2014 at 02:05:53PM +0100, Lubomir Rintel wrote:
> On Sat, 2014-11-01 at 17:08 +0200, Jouni Malinen wrote:
> > This is not the way the global_init/global_deinit was originally meant
> > to be used, i.e., the assumption was more like this getting initialized
> > once and then remain available even if no interfaces are enabled, e.g.,
> > for get_interfaces() call to work.
> I guess this is something specific to Windows NDIS drivers (only one
> that seems to implement get_interfaces).
> It seems to me that get_interfaces works whether the driver is
> initialized or not; maybe it shouldn't even be passwd the global_priv
> structure as it's unused anyway?

This is not really used currently, but that does not change the reasons
for the design. Global context was expected to be available and remain
available even if driver interfaces were not in use.

> I've run the test suite. It runs now for hours, but I noticed no crashes
> so far. However I see a lot of timeout and FAIL messages. I'm wondering
> if some tests are expected to fail in master tree, or I need to fix my
> setup:

All the test cases pass in my tests (or well, if running under heavy
load, couple of test cases may fail out of about 800 every now and

> [lkundrak at fedora20-2 hwsim]$ ./run-all.sh
> START offchannel_tx_roc_gas 1/764
> Exception: ANQP_GET command failed
> FAIL offchannel_tx_roc_gas 0.283542 2014-11-11 13:28:00.406416
> ...
> START p2p_device_group_remove 420/764
> Exception: [Errno 111] Connection refused
> FAIL p2p_device_group_remove 0.104766 2014-11-11 13:58:50.080920
> ...

That "Connection refused" is one of the most common indication of
hostapd or wpa_supplicant having crashed during the test..

> > As such, I cannot really
> > apply this until those issues have been found and fixed. Then again, I'm
> > not sure whether this is really the best way of handling the issue which
> > I'm assuming is the main reason for this patch, i.e., need to
> > re-initialize some socket for the case of cfg80211 getting reloaded.
> Correct. What would be the other possible fix? Address that in kernel?

It could be enough to just re-initialize the netlink sockets in global
context within driver_nl80211.c if they start showing errors that could
indicate that cfg80211 has been reloaded.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list