aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/wlantest.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-11-17 19:11:35 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-17 19:39:22 (GMT)
commitc99a721e5b803bc6710aac0583121ef80df38d1a (patch)
tree44617b9d9f20c8af559db87f8adde7fc20448bd1 /wlantest/wlantest.c
parent0e91337d543ce6d1d26e1fc4590e758ef102bfd3 (diff)
downloadhostap-c99a721e5b803bc6710aac0583121ef80df38d1a.zip
hostap-c99a721e5b803bc6710aac0583121ef80df38d1a.tar.gz
hostap-c99a721e5b803bc6710aac0583121ef80df38d1a.tar.bz2
wlantest: Add RELOG command to reopen log/capture files
This can be used similarly to the wpa_supplicant RELOG command to rotate log and capture files. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wlantest/wlantest.c')
-rw-r--r--wlantest/wlantest.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/wlantest/wlantest.c b/wlantest/wlantest.c
index 5b691fa..2966458 100644
--- a/wlantest/wlantest.c
+++ b/wlantest/wlantest.c
@@ -1,6 +1,6 @@
/*
* wlantest - IEEE 802.11 protocol monitoring and testing tool
- * Copyright (c) 2010-2011, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2010-2013, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -245,15 +245,35 @@ size_t notes_len(struct wlantest *wt, size_t hdrlen)
}
+int wlantest_relog(struct wlantest *wt)
+{
+ int ret = 0;
+
+ wpa_printf(MSG_INFO, "Re-open log/capture files");
+
+ if (wt->write_file) {
+ write_pcap_deinit(wt);
+ if (write_pcap_init(wt, wt->write_file) < 0)
+ ret = -1;
+ }
+
+ if (wt->pcapng_file) {
+ write_pcapng_deinit(wt);
+ if (write_pcapng_init(wt, wt->pcapng_file) < 0)
+ ret = -1;
+ }
+
+ return ret;
+}
+
+
int main(int argc, char *argv[])
{
int c;
const char *read_file = NULL;
const char *read_wired_file = NULL;
- const char *write_file = NULL;
const char *ifname = NULL;
const char *ifname_wired = NULL;
- const char *pcapng_file = NULL;
struct wlantest wt;
int ctrl_iface = 0;
@@ -294,7 +314,7 @@ int main(int argc, char *argv[])
ifname_wired = optarg;
break;
case 'n':
- pcapng_file = optarg;
+ wt.pcapng_file = optarg;
break;
case 'p':
add_passphrase(&wt, optarg);
@@ -312,7 +332,7 @@ int main(int argc, char *argv[])
read_wired_file = optarg;
break;
case 'w':
- write_file = optarg;
+ wt.write_file = optarg;
break;
case 'W':
if (add_wep(&wt, optarg) < 0)
@@ -333,10 +353,10 @@ int main(int argc, char *argv[])
if (eloop_init())
return -1;
- if (write_file && write_pcap_init(&wt, write_file) < 0)
+ if (wt.write_file && write_pcap_init(&wt, wt.write_file) < 0)
return -1;
- if (pcapng_file && write_pcapng_init(&wt, pcapng_file) < 0)
+ if (wt.pcapng_file && write_pcapng_init(&wt, wt.pcapng_file) < 0)
return -1;
if (read_wired_file && read_wired_cap_file(&wt, read_wired_file) < 0)