wpa_supplicant: Test all compiled drivers before failing
wpa_supplicant_set_driver() is returning an error if the first driver in the driver list is not built in. It should continue through the driver list until it finds one that's built in.
This commit is contained in:
parent
f5798bf36a
commit
74b1c84a0b
1 changed files with 20 additions and 14 deletions
|
@ -1702,7 +1702,7 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *pos;
|
const char *pos, *driver = name;
|
||||||
|
|
||||||
if (wpa_s == NULL)
|
if (wpa_s == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1720,21 +1720,27 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = os_strchr(name, ',');
|
do {
|
||||||
|
pos = os_strchr(driver, ',');
|
||||||
if (pos)
|
if (pos)
|
||||||
len = pos - name;
|
len = pos - driver;
|
||||||
else
|
else
|
||||||
len = os_strlen(name);
|
len = os_strlen(driver);
|
||||||
|
|
||||||
for (i = 0; wpa_drivers[i]; i++) {
|
for (i = 0; wpa_drivers[i]; i++) {
|
||||||
if (os_strlen(wpa_drivers[i]->name) == len &&
|
if (os_strlen(wpa_drivers[i]->name) == len &&
|
||||||
os_strncmp(name, wpa_drivers[i]->name, len) ==
|
os_strncmp(driver, wpa_drivers[i]->name, len) ==
|
||||||
0) {
|
0) {
|
||||||
wpa_s->driver = wpa_drivers[i];
|
wpa_s->driver = wpa_drivers[i];
|
||||||
wpa_s->global_drv_priv = wpa_s->global->drv_priv[i];
|
wpa_s->global_drv_priv =
|
||||||
|
wpa_s->global->drv_priv[i];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
driver = pos + 1;
|
||||||
|
} while (pos);
|
||||||
|
|
||||||
wpa_printf(MSG_ERROR, "Unsupported driver '%s'.", name);
|
wpa_printf(MSG_ERROR, "Unsupported driver '%s'.", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue