diff options
author | Jouni Malinen <j@w1.fi> | 2016-12-27 09:33:35 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2016-12-27 09:33:35 (GMT) |
commit | 8628555f9b50d409fca44593c00470888c4eb286 (patch) | |
tree | c224c8d6c2f7ece0331bd59e9eaa21633a31ec8a /hostapd | |
parent | eb89361bdeede9082887d9ce200343cb9a219621 (diff) | |
download | hostap-8628555f9b50d409fca44593c00470888c4eb286.zip hostap-8628555f9b50d409fca44593c00470888c4eb286.tar.gz hostap-8628555f9b50d409fca44593c00470888c4eb286.tar.bz2 |
hostapd: Check driver parameter before replacing previous value
This leaves the previously configured value in place if "SET driver ..."
command fails.
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd')
-rw-r--r-- | hostapd/config_file.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 32ae688..ada6601 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2055,20 +2055,21 @@ static int hostapd_config_fill(struct hostapd_config *conf, os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); } else if (os_strcmp(buf, "driver") == 0) { int j; - /* clear to get error below if setting is invalid */ - conf->driver = NULL; + const struct wpa_driver_ops *driver = NULL; + for (j = 0; wpa_drivers[j]; j++) { if (os_strcmp(pos, wpa_drivers[j]->name) == 0) { - conf->driver = wpa_drivers[j]; + driver = wpa_drivers[j]; break; } } - if (conf->driver == NULL) { + if (!driver) { wpa_printf(MSG_ERROR, "Line %d: invalid/unknown driver '%s'", line, pos); return 1; } + conf->driver = driver; } else if (os_strcmp(buf, "driver_params") == 0) { os_free(conf->driver_params); conf->driver_params = os_strdup(pos); |