Allow driver to be set in hostapd through global control interface
This extends the hostapd global control interface ADD command to allow driver wrapper to be specified ("ADD <ifname> <ctrl_iface> <driver>"). Previously, this case that did not use a configuration file allowed only the default driver wrapper to be used. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
faf7ce5d4f
commit
fab51186dc
1 changed files with 25 additions and 3 deletions
|
@ -2186,7 +2186,7 @@ hostapd_iface_alloc(struct hapd_interfaces *interfaces)
|
||||||
|
|
||||||
static struct hostapd_config *
|
static struct hostapd_config *
|
||||||
hostapd_config_alloc(struct hapd_interfaces *interfaces, const char *ifname,
|
hostapd_config_alloc(struct hapd_interfaces *interfaces, const char *ifname,
|
||||||
const char *ctrl_iface)
|
const char *ctrl_iface, const char *driver)
|
||||||
{
|
{
|
||||||
struct hostapd_bss_config *bss;
|
struct hostapd_bss_config *bss;
|
||||||
struct hostapd_config *conf;
|
struct hostapd_config *conf;
|
||||||
|
@ -2199,6 +2199,21 @@ hostapd_config_alloc(struct hapd_interfaces *interfaces, const char *ifname,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (driver) {
|
||||||
|
int j;
|
||||||
|
|
||||||
|
for (j = 0; wpa_drivers[j]; j++) {
|
||||||
|
if (os_strcmp(driver, wpa_drivers[j]->name) == 0) {
|
||||||
|
conf->driver = wpa_drivers[j];
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wpa_printf(MSG_ERROR,
|
||||||
|
"Invalid/unknown driver '%s' - registering the default driver",
|
||||||
|
driver);
|
||||||
|
}
|
||||||
|
|
||||||
conf->driver = wpa_drivers[0];
|
conf->driver = wpa_drivers[0];
|
||||||
if (conf->driver == NULL) {
|
if (conf->driver == NULL) {
|
||||||
wpa_printf(MSG_ERROR, "No driver wrappers registered!");
|
wpa_printf(MSG_ERROR, "No driver wrappers registered!");
|
||||||
|
@ -2206,6 +2221,7 @@ hostapd_config_alloc(struct hapd_interfaces *interfaces, const char *ifname,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip:
|
||||||
bss = conf->last_bss = conf->bss[0];
|
bss = conf->last_bss = conf->bss[0];
|
||||||
|
|
||||||
os_strlcpy(bss->iface, ifname, sizeof(bss->iface));
|
os_strlcpy(bss->iface, ifname, sizeof(bss->iface));
|
||||||
|
@ -2366,8 +2382,14 @@ int hostapd_add_iface(struct hapd_interfaces *interfaces, char *buf)
|
||||||
if (conf && conf->bss)
|
if (conf && conf->bss)
|
||||||
os_strlcpy(conf->bss[0]->iface, buf,
|
os_strlcpy(conf->bss[0]->iface, buf,
|
||||||
sizeof(conf->bss[0]->iface));
|
sizeof(conf->bss[0]->iface));
|
||||||
} else
|
} else {
|
||||||
conf = hostapd_config_alloc(interfaces, buf, ptr);
|
char *driver = os_strchr(ptr, ' ');
|
||||||
|
|
||||||
|
if (driver)
|
||||||
|
*driver++ = '\0';
|
||||||
|
conf = hostapd_config_alloc(interfaces, buf, ptr, driver);
|
||||||
|
}
|
||||||
|
|
||||||
if (conf == NULL || conf->bss == NULL) {
|
if (conf == NULL || conf->bss == NULL) {
|
||||||
wpa_printf(MSG_ERROR, "%s: Failed to allocate memory "
|
wpa_printf(MSG_ERROR, "%s: Failed to allocate memory "
|
||||||
"for configuration", __func__);
|
"for configuration", __func__);
|
||||||
|
|
Loading…
Add table
Reference in a new issue