aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2023-09-22 07:58:45 +0200
committerFelix Fietkau <nbd@nbd.name>2023-09-22 08:11:04 +0200
commitfe1028e89c7d112c97037a829d07195c4efaa5b8 (patch)
tree55eae572ef620e59541ef78b08518da4501b5e54
parent43e9cded0672a857ec7df278e1de04a5c085e599 (diff)
downloadupstream-fe1028e89c7d112c97037a829d07195c4efaa5b8.tar.gz
upstream-fe1028e89c7d112c97037a829d07195c4efaa5b8.tar.bz2
upstream-fe1028e89c7d112c97037a829d07195c4efaa5b8.zip
hostapd: fix wpa_supplicant bringup with non-nl80211 drivers
Needed for wired 802.1x Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit fd6d7aafb2c3d335a3d192c308ffdace8d292e9f)
-rw-r--r--package/network/services/hostapd/src/wpa_supplicant/ucode.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c
index 55d22584ff..6cba73dcd5 100644
--- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c
+++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c
@@ -136,6 +136,7 @@ static uc_value_t *
uc_wpas_add_iface(uc_vm_t *vm, size_t nargs)
{
uc_value_t *info = uc_fn_arg(0);
+ uc_value_t *driver = ucv_object_get(info, "driver", NULL);
uc_value_t *ifname = ucv_object_get(info, "iface", NULL);
uc_value_t *bridge = ucv_object_get(info, "bridge", NULL);
uc_value_t *config = ucv_object_get(info, "config", NULL);
@@ -154,6 +155,22 @@ uc_wpas_add_iface(uc_vm_t *vm, size_t nargs)
.ctrl_interface = ucv_string_get(ctrl),
};
+ if (driver) {
+ const char *drvname;
+ if (ucv_type(driver) != UC_STRING)
+ goto out;
+
+ iface.driver = NULL;
+ drvname = ucv_string_get(driver);
+ for (int i = 0; wpa_drivers[i]; i++) {
+ if (!strcmp(drvname, wpa_drivers[i]->name))
+ iface.driver = wpa_drivers[i]->name;
+ }
+
+ if (!iface.driver)
+ goto out;
+ }
+
if (!iface.ifname || !iface.confname)
goto out;