projects
/
libeap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c35faef
)
driver_test: Learn scan result channel from DS Params IE
author
Jouni Malinen
<jouni.malinen@atheros.com>
Sat, 16 Jan 2010 10:26:03 +0000
(12:26 +0200)
committer
Jouni Malinen
<j@w1.fi>
Sat, 16 Jan 2010 10:26:03 +0000
(12:26 +0200)
src/drivers/driver_test.c
patch
|
blob
|
history
diff --git
a/src/drivers/driver_test.c
b/src/drivers/driver_test.c
index
fbf829a
..
92bd658
100644
(file)
--- a/
src/drivers/driver_test.c
+++ b/
src/drivers/driver_test.c
@@
-1692,6
+1692,25
@@
static int wpa_driver_test_disassociate(void *priv, const u8 *addr,
}
}
+static const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie)
+{
+ const u8 *end, *pos;
+
+ pos = (const u8 *) (res + 1);
+ end = pos + res->ie_len;
+
+ while (pos + 1 < end) {
+ if (pos + 2 + pos[1] > end)
+ break;
+ if (pos[0] == ie)
+ return pos;
+ pos += 2 + pos[1];
+ }
+
+ return NULL;
+}
+
+
static void wpa_driver_test_scanresp(struct wpa_driver_test_data *drv,
struct sockaddr *from,
socklen_t fromlen,
static void wpa_driver_test_scanresp(struct wpa_driver_test_data *drv,
struct sockaddr *from,
socklen_t fromlen,
@@
-1702,6
+1721,7
@@
static void wpa_driver_test_scanresp(struct wpa_driver_test_data *drv,
size_t len;
u8 *ie_pos, *ie_start, *ie_end;
#define MAX_IE_LEN 1000
size_t len;
u8 *ie_pos, *ie_start, *ie_end;
#define MAX_IE_LEN 1000
+ const u8 *ds_params;
wpa_printf(MSG_DEBUG, "test_driver: SCANRESP %s", data);
if (drv->num_scanres >= MAX_SCAN_RESULTS) {
wpa_printf(MSG_DEBUG, "test_driver: SCANRESP %s", data);
if (drv->num_scanres >= MAX_SCAN_RESULTS) {
@@
-1776,6
+1796,12
@@
static void wpa_driver_test_scanresp(struct wpa_driver_test_data *drv,
res->caps |= IEEE80211_CAP_IBSS;
}
res->caps |= IEEE80211_CAP_IBSS;
}
+ ds_params = wpa_scan_get_ie(res, WLAN_EID_DS_PARAMS);
+ if (ds_params && ds_params[1] > 0) {
+ if (ds_params[2] >= 1 && ds_params[2] <= 13)
+ res->freq = 2407 + ds_params[2] * 5;
+ }
+
os_free(drv->scanres[drv->num_scanres]);
drv->scanres[drv->num_scanres++] = res;
}
os_free(drv->scanres[drv->num_scanres]);
drv->scanres[drv->num_scanres++] = res;
}