mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 10:18:21 -05:00
Allow ctrl_iface SET command to change global config parameters
This commit is contained in:
parent
1d47214aa9
commit
611aea7d41
@ -82,8 +82,12 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
|
||||
ret = -1;
|
||||
} else if (os_strcasecmp(cmd, "wps_fragment_size") == 0) {
|
||||
wpa_s->wps_fragment_size = atoi(value);
|
||||
} else
|
||||
ret = -1;
|
||||
} else {
|
||||
value[-1] = '=';
|
||||
ret = wpa_config_process_global(wpa_s->conf, cmd, -1);
|
||||
if (ret == 0)
|
||||
wpa_supplicant_update_config(wpa_s);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -628,6 +628,7 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)
|
||||
"file '%s' - exiting", wpa_s->confname);
|
||||
return -1;
|
||||
}
|
||||
conf->changed_parameters = (unsigned int) -1;
|
||||
|
||||
reconf_ctrl = !!conf->ctrl_interface != !!wpa_s->conf->ctrl_interface
|
||||
|| (conf->ctrl_interface && wpa_s->conf->ctrl_interface &&
|
||||
@ -670,6 +671,8 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)
|
||||
if (reconf_ctrl)
|
||||
wpa_s->ctrl_iface = wpa_supplicant_ctrl_iface_init(wpa_s);
|
||||
|
||||
wpa_supplicant_update_config(wpa_s);
|
||||
|
||||
wpa_supplicant_clear_status(wpa_s);
|
||||
wpa_s->reassociate = 1;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
@ -2415,3 +2418,13 @@ void wpa_supplicant_deinit(struct wpa_global *global)
|
||||
wpa_debug_close_syslog();
|
||||
wpa_debug_close_file();
|
||||
}
|
||||
|
||||
|
||||
void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
#ifdef CONFIG_WPS
|
||||
wpas_wps_update_config(wpa_s);
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
wpa_s->conf->changed_parameters = 0;
|
||||
}
|
||||
|
@ -500,6 +500,7 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
|
||||
const u8 *buf, size_t len);
|
||||
enum wpa_key_mgmt key_mgmt2driver(int key_mgmt);
|
||||
enum wpa_cipher cipher_suite2driver(int cipher);
|
||||
void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
|
||||
|
||||
/* events.c */
|
||||
void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
|
||||
|
@ -1322,3 +1322,44 @@ int wpas_wps_in_progress(struct wpa_supplicant *wpa_s)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void wpas_wps_update_config(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
struct wps_context *wps = wpa_s->wps;
|
||||
|
||||
if (wps == NULL)
|
||||
return;
|
||||
|
||||
if (wpa_s->conf->changed_parameters & CFG_CHANGED_CONFIG_METHODS) {
|
||||
wps->config_methods = wps_config_methods_str2bin(
|
||||
wpa_s->conf->config_methods);
|
||||
if ((wps->config_methods &
|
||||
(WPS_CONFIG_DISPLAY | WPS_CONFIG_LABEL)) ==
|
||||
(WPS_CONFIG_DISPLAY | WPS_CONFIG_LABEL)) {
|
||||
wpa_printf(MSG_ERROR, "WPS: Both Label and Display "
|
||||
"config methods are not allowed at the "
|
||||
"same time");
|
||||
wps->config_methods &= ~WPS_CONFIG_LABEL;
|
||||
}
|
||||
}
|
||||
|
||||
if (wpa_s->conf->changed_parameters & CFG_CHANGED_DEVICE_TYPE) {
|
||||
if (wpa_s->conf->device_type &&
|
||||
wps_dev_type_str2bin(wpa_s->conf->device_type,
|
||||
wps->dev.pri_dev_type) < 0)
|
||||
wpa_printf(MSG_ERROR, "WPS: Invalid device_type");
|
||||
}
|
||||
|
||||
if (wpa_s->conf->changed_parameters & CFG_CHANGED_OS_VERSION)
|
||||
wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);
|
||||
|
||||
if (wpa_s->conf->changed_parameters & CFG_CHANGED_UUID) {
|
||||
if (is_nil_uuid(wpa_s->conf->uuid)) {
|
||||
uuid_gen_mac_addr(wpa_s->own_addr, wps->uuid);
|
||||
wpa_hexdump(MSG_DEBUG, "WPS: UUID based on MAC "
|
||||
"address", wps->uuid, WPS_UUID_LEN);
|
||||
} else
|
||||
os_memcpy(wps->uuid, wpa_s->conf->uuid, WPS_UUID_LEN);
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
|
||||
const char *pin, struct wps_new_ap_settings *settings);
|
||||
int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s);
|
||||
int wpas_wps_in_progress(struct wpa_supplicant *wpa_s);
|
||||
void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
|
||||
|
||||
#else /* CONFIG_WPS */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user