Patchwork [RFC] Try fallback drivers if global init for preferred drivers fails

login
register
mail settings
Submitter Dan Williams
Date Feb. 2, 2012, 9:48 p.m.
Message ID <1328219311.14368.29.camel@dcbw.foobar.com>
Download mbox | patch
Permalink /patch/139235/
State Accepted
Commit 0f4668ceac37e2c98ce6068bd255d0915974a706
Headers show

Comments

Dan Williams - Feb. 2, 2012, 9:48 p.m.
Driver global init was considered a hard failure.  Thus if, for
example, you used the Broadcom STA driver and didn't have nl80211
or cfg80211 loaded into the kernel, and specified a driver value
of "nl80211,wext", the nl80211 driver's global init would fail
with the following message:

nl80211: 'nl80211' generic netlink not found
Failed to initialize driver 'nl80211'

but since global init was a hard failure, creating the supplicant
interface would fail and the WEXT driver would not be tried.
Give other drivers a chance instead.

Signed-hostap: Dan Williams <dcbw@redhat.com>
---

* Only compile tested; does this look like the right thing to
do here?  Relevant bug is:

https://bugzilla.redhat.com/show_bug.cgi?id=783712


 wpa_supplicant/wpa_supplicant.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Jouni Malinen - Feb. 4, 2012, 6:11 p.m.
On Thu, Feb 02, 2012 at 03:48:31PM -0600, Dan Williams wrote:
> Driver global init was considered a hard failure.  Thus if, for
> example, you used the Broadcom STA driver and didn't have nl80211
> or cfg80211 loaded into the kernel, and specified a driver value
> of "nl80211,wext", the nl80211 driver's global init would fail
> with the following message:
> 
> nl80211: 'nl80211' generic netlink not found
> Failed to initialize driver 'nl80211'
> 
> but since global init was a hard failure, creating the supplicant
> interface would fail and the WEXT driver would not be tried.
> Give other drivers a chance instead.

Thanks! Applied.
Dan Williams - Feb. 6, 2012, 3:42 p.m.
On Sat, 2012-02-04 at 20:11 +0200, Jouni Malinen wrote:
> On Thu, Feb 02, 2012 at 03:48:31PM -0600, Dan Williams wrote:
> > Driver global init was considered a hard failure.  Thus if, for
> > example, you used the Broadcom STA driver and didn't have nl80211
> > or cfg80211 loaded into the kernel, and specified a driver value
> > of "nl80211,wext", the nl80211 driver's global init would fail
> > with the following message:
> > 
> > nl80211: 'nl80211' generic netlink not found
> > Failed to initialize driver 'nl80211'
> > 
> > but since global init was a hard failure, creating the supplicant
> > interface would fail and the WEXT driver would not be tried.
> > Give other drivers a chance instead.
> 
> Thanks! Applied.

Angie; also relevant for 1.0.

Thanks!
Dan

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index ee5ca8d..6320918 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1941,8 +1941,11 @@  static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
 		for (i = 0; wpa_drivers[i]; i++) {
 			if (os_strlen(wpa_drivers[i]->name) == len &&
 			    os_strncmp(driver, wpa_drivers[i]->name, len) ==
-			    0)
-				return select_driver(wpa_s, i);
+			    0) {
+				/* First driver that succeeds wins */
+				if (select_driver(wpa_s, i) == 0)
+					return 0;
+			}
 		}
 
 		driver = pos + 1;