aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/wlantest.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-06 15:11:12 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-07 21:29:00 (GMT)
commitd84d38935127dc6f64ed1c1b8aa986e85d99c9b6 (patch)
treef6369f0a3d8f6da1c2e8453e320f7224d898f720 /wlantest/wlantest.c
parenta149fcc77d3322bf23d1f53c2cd9fc84a1097c31 (diff)
downloadhostap-d84d38935127dc6f64ed1c1b8aa986e85d99c9b6.zip
hostap-d84d38935127dc6f64ed1c1b8aa986e85d99c9b6.tar.gz
hostap-d84d38935127dc6f64ed1c1b8aa986e85d99c9b6.tar.bz2
wlantest: Maintain table of BSS information
Whenever a Beacon or Probe Response frame is observed, add or update a BSS entry to maintain current information about the active BSSes.
Diffstat (limited to 'wlantest/wlantest.c')
-rw-r--r--wlantest/wlantest.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/wlantest/wlantest.c b/wlantest/wlantest.c
index 9a2f70d..9856368 100644
--- a/wlantest/wlantest.c
+++ b/wlantest/wlantest.c
@@ -34,6 +34,24 @@ static void usage(void)
}
+static void wlantest_init(struct wlantest *wt)
+{
+ os_memset(wt, 0, sizeof(*wt));
+ wt->monitor_sock = -1;
+ dl_list_init(&wt->bss);
+}
+
+
+static void wlantest_deinit(struct wlantest *wt)
+{
+ struct wlantest_bss *bss, *n;
+ if (wt->monitor_sock >= 0)
+ monitor_deinit(wt);
+ dl_list_for_each_safe(bss, n, &wt->bss, struct wlantest_bss, list)
+ bss_deinit(bss);
+}
+
+
int main(int argc, char *argv[])
{
int c;
@@ -46,8 +64,7 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
- os_memset(&wt, 0, sizeof(wt));
- wt.monitor_sock = -1;
+ wlantest_init(&wt);
for (;;) {
c = getopt(argc, argv, "dhi:r:q");
@@ -98,8 +115,7 @@ int main(int argc, char *argv[])
"fcs_error=%u",
wt.rx_mgmt, wt.rx_ctrl, wt.rx_data, wt.fcs_error);
- if (ifname)
- monitor_deinit(&wt);
+ wlantest_deinit(&wt);
eloop_destroy();
os_program_deinit();