]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow sched_scan_plans to be updated at runtime
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 30 Nov 2015 12:00:41 +0000 (14:00 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 30 Nov 2015 12:03:28 +0000 (14:03 +0200)
This allows the control interface SET command to be used to update the
sched_scan_plans parameter at runtime. In addition, an empty string can
be used to clear the previously configured plan.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/scan.c
wpa_supplicant/wpa_supplicant.c

index b8b19de895adbcebd0c9c9cd12fbf5360de59d38..f2ae4fd97a7803fee2b7785a7853c56ce0e1141b 100644 (file)
@@ -4260,7 +4260,7 @@ static const struct global_parse_data global_fields[] = {
        { INT_RANGE(fst_llt, 1, FST_MAX_LLT_MS), 0 },
 #endif /* CONFIG_FST */
        { INT_RANGE(wpa_rsc_relaxation, 0, 1), 0 },
-       { STR(sched_scan_plans), 0 },
+       { STR(sched_scan_plans), CFG_CHANGED_SCHED_SCAN_PLANS },
 };
 
 #undef FUNC
index e93a0a3f8e2147adf3286dcea9bc2bd1881a39a1..86f940d3500aa4733345ec5655bf62c112313d26 100644 (file)
@@ -332,6 +332,7 @@ struct wpa_cred {
 #define CFG_CHANGED_EXT_PW_BACKEND BIT(14)
 #define CFG_CHANGED_NFC_PASSWORD_TOKEN BIT(15)
 #define CFG_CHANGED_P2P_PASSPHRASE_LEN BIT(16)
+#define CFG_CHANGED_SCHED_SCAN_PLANS BIT(17)
 
 /**
  * struct wpa_config - wpa_supplicant configuration data
index fd01f4871e85f7b15243ff7ed3442b626ba84744..3c3f9e01d0c646db8119f1106ac0de1244190460 100644 (file)
@@ -2548,6 +2548,14 @@ int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd)
        if (!cmd)
                return -1;
 
+       if (!cmd[0]) {
+               wpa_printf(MSG_DEBUG, "Clear sched scan plans");
+               os_free(wpa_s->sched_scan_plans);
+               wpa_s->sched_scan_plans = NULL;
+               wpa_s->sched_scan_plans_num = 0;
+               return 0;
+       }
+
        while ((token = cstr_token(cmd, " ", &context))) {
                int ret;
                struct sched_scan_plan *scan_plan, *n;
index c9b78de1da0715b7dadb0cdaf629aedfb26c4741..7e5c07ade2a07b858ca2e9b06570fde1ea79cdc7 100644 (file)
@@ -5314,6 +5314,9 @@ void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s)
        if (wpa_s->conf->changed_parameters & CFG_CHANGED_EXT_PW_BACKEND)
                wpas_init_ext_pw(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);
+
 #ifdef CONFIG_WPS
        wpas_wps_update_config(wpa_s);
 #endif /* CONFIG_WPS */