From 3c7863f812d23fefa9987b29308006a29f1d6e9d Mon Sep 17 00:00:00 2001 From: Lior David Date: Wed, 13 Sep 2017 12:50:54 +0300 Subject: [PATCH] wpa_supplicant: Support dynamic update of wowlan_triggers Previously, wowlan_triggers were updated in kernel only during startup. Also update it whenever it is set from the control interface. Signed-off-by: Jouni Malinen --- wpa_supplicant/config.c | 2 +- wpa_supplicant/config.h | 1 + wpa_supplicant/wpa_supplicant.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 37489f716..7e6022d57 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -4550,7 +4550,7 @@ static const struct global_parse_data global_fields[] = { { INT(sched_scan_start_delay), 0 }, { INT(tdls_external_control), 0}, { STR(osu_dir), 0 }, - { STR(wowlan_triggers), 0 }, + { STR(wowlan_triggers), CFG_CHANGED_WOWLAN_TRIGGERS }, { INT(p2p_search_delay), 0}, { INT(mac_addr), 0 }, { INT(rand_addr_lifetime), 0 }, diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 6a2c8028d..90e7e4a4c 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -336,6 +336,7 @@ struct wpa_cred { #define CFG_CHANGED_NFC_PASSWORD_TOKEN BIT(15) #define CFG_CHANGED_P2P_PASSPHRASE_LEN BIT(16) #define CFG_CHANGED_SCHED_SCAN_PLANS BIT(17) +#define CFG_CHANGED_WOWLAN_TRIGGERS BIT(18) /** * struct wpa_config - wpa_supplicant configuration data diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index b8c1da44e..cdff003d8 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -6018,6 +6018,16 @@ void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s) if (wpa_s->conf->changed_parameters & CFG_CHANGED_SCHED_SCAN_PLANS) wpas_sched_scan_plans_set(wpa_s, wpa_s->conf->sched_scan_plans); + if (wpa_s->conf->changed_parameters & CFG_CHANGED_WOWLAN_TRIGGERS) { + struct wpa_driver_capa capa; + int res = wpa_drv_get_capa(wpa_s, &capa); + + if (res == 0 && wpas_set_wowlan_triggers(wpa_s, &capa) < 0) + wpa_printf(MSG_ERROR, + "Failed to update wowlan_triggers to '%s'", + wpa_s->conf->wowlan_triggers); + } + #ifdef CONFIG_WPS wpas_wps_update_config(wpa_s); #endif /* CONFIG_WPS */