Patchwork Make scan_freq field to be saved by save_config

login
register
mail settings
Submitter Masashi Honma
Date Sept. 12, 2013, 10:01 a.m.
Message ID <CAFk-A4mq7r4fMikmw_39qbLrU2W-xS6O1y4U2AUG2xQF=ykC6A@mail.gmail.com>
Download mbox | patch
Permalink /patch/274486/
State Accepted
Commit 1a9f24714e534c24b7a61961b1d567a0dce9be31
Headers show

Comments

Masashi Honma - Sept. 12, 2013, 10:01 a.m.
This patch makes scan_freq field to be saved by save_config.

And if set_freq field without any value exists in a network block,

set_freq=

it causes error from nl80211. So I made a check for this error also.

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>

     STR(identity);


Regards,
Masashi Honma.
Jouni Malinen - Sept. 23, 2013, 1:24 p.m.
On Thu, Sep 12, 2013 at 07:01:25PM +0900, Masashi Honma wrote:
> This patch makes scan_freq field to be saved by save_config.

Thanks, I applied this part.

> And if set_freq field without any value exists in a network block,
> 
> set_freq=
> 
> it causes error from nl80211. So I made a check for this error also.

I don't think that this should be specific to driver_nl80211.c. Instead,
I changed configuration parser to clear the current list on empty string
and as such, "scan_freq=" does not set the internal integer list to an
empty list anymore.

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6792e04..4d0206e 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4256,7 +4256,7 @@  nl80211_scan_common(struct
wpa_driver_nl80211_data *drv, u8 cmd,
             goto fail;
     }

-    if (params->freqs) {
+    if (params->freqs && params->freqs[0] > 0) {
         struct nlattr *freqs;
         freqs = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES);
         if (freqs == NULL)
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index a2791eb..0d2bd8c 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -653,6 +653,7 @@  static void wpa_config_write_network(FILE *f,
struct wpa_ssid *ssid)
     write_auth_alg(f, ssid);
     STR(bgscan);
     STR(autoscan);
+    STR(scan_freq);
 #ifdef IEEE8021X_EAPOL
     write_eap(f, ssid);