[PATCH] bgscan_learn: Load BSS entries from current SSID only
Piotr.Nakraszewicz at tieto.com
Piotr.Nakraszewicz
Mon Apr 23 00:14:41 PDT 2012
Hi,
Adding description:
bgscan_learn wrongly loads BSS entries from data file even if we changed ESS we are connected to.
To prevent that add SSID parameter to data file and compare it with current SSID before loading the entries.
Pozdrawiam / Best regards,
Piotr
-----Original Message-----
From: hostap-bounces at lists.shmoo.com [mailto:hostap-bounces at lists.shmoo.com] On Behalf Of Piotr.Nakraszewicz at tieto.com
Sent: 19 kwietnia 2012 16:33
To: hostap at lists.shmoo.com
Subject: [PATCH] bgscan_learn: Load BSS entries from current SSID only
Hi,
Signed-hostap: Piotr Nakraszewicz <piotr.nakraszewicz at tieto.com>
---
wpa_supplicant/bgscan_learn.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/wpa_supplicant/bgscan_learn.c b/wpa_supplicant/bgscan_learn.c index ed4d879..6de1b24 100644
--- a/wpa_supplicant/bgscan_learn.c
+++ b/wpa_supplicant/bgscan_learn.c
@@ -151,6 +151,17 @@ static int bgscan_learn_load(struct bgscan_learn_data *data)
bgscan_learn_add_neighbor(bss, addr);
}
+
+ if (os_strncmp(buf, "SSID ", 5) == 0) {
+ if (os_strncmp(buf + 5, (char *)data->ssid->ssid,
+ data->ssid->ssid_len)) {
+ wpa_printf(MSG_INFO, "bgscan learn: "
+ "Different ssid in data file, "
+ "omitting BSS entries");
+ fclose(f);
+ return 0;
+ }
+ }
}
fclose(f);
@@ -162,6 +173,8 @@ static void bgscan_learn_save(struct bgscan_learn_data *data) {
FILE *f;
struct bgscan_learn_bss *bss;
+ char buf[MAX_SSID_LEN + 6];
+ char *pos;
if (data->fname == NULL)
return;
@@ -174,6 +187,15 @@ static void bgscan_learn_save(struct bgscan_learn_data *data)
return;
fprintf(f, "wpa_supplicant-bgscan-learn\n");
+ pos = buf;
+ os_memcpy(pos, "SSID ", 5);
+ pos += 5;
+ os_memcpy(pos, data->ssid->ssid, data->ssid->ssid_len);
+ pos += data->ssid->ssid_len;
+ os_memcpy(pos, "\n", 1);
+ pos += 1;
+ fwrite(buf, 1, pos-buf, f);
+
dl_list_for_each(bss, &data->bss, struct bgscan_learn_bss, list) {
fprintf(f, "BSS " MACSTR " %d\n",
MAC2STR(bss->bssid), bss->freq);
--
1.7.0.4
Pozdrawiam / Best regards,
Piotr
_______________________________________________
HostAP mailing list
HostAP at lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap
More information about the Hostap
mailing list