wpa_supplicant: Try all drivers by default

Some distros carry patches to specify driver fallback, but only in
specific conditions (e.g. the systemd service definition[1]). This leaves
other wpa_supplicant instances needing to define fallback themselves,
which leads to places where wpa_supplicant thinks it can't find a
driver[2]. Instead, when -D is not specified, have wpa_supplicant try
all the drivers it was built with in an attempt to find a working one
instead of just giving up if the first doesn't work.

[1] https://salsa.debian.org/debian/wpa/-/blob/debian/unstable/debian/patches/networkd-driver-fallback.patch
[2] https://bugs.launchpad.net/netplan/+bug/1814012

Signed-off-by: Kees Cook <kees@ubuntu.com>
This commit is contained in:
Kees Cook 2021-10-12 11:28:31 -07:00 committed by Jouni Malinen
parent 4775a5f827
commit f332f69513

View file

@ -4812,8 +4812,13 @@ static int wpa_supplicant_set_driver(struct wpa_supplicant *wpa_s,
}
if (name == NULL) {
/* default to first driver in the list */
return select_driver(wpa_s, 0);
/* Default to first successful driver in the list */
for (i = 0; wpa_drivers[i]; i++) {
if (select_driver(wpa_s, i) == 0)
return 0;
}
/* Drivers have each reported failure, so no wpa_msg() here. */
return -1;
}
do {