/*
* wlantest control interface
- * Copyright (c) 2010, 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.
}
+static void ctrl_relog(struct wlantest *wt, int sock)
+{
+ int res = wlantest_relog(wt);
+ ctrl_send_simple(wt, sock, res ? WLANTEST_CTRL_FAILURE :
+ WLANTEST_CTRL_SUCCESS);
+}
+
+
static void ctrl_read(int sock, void *eloop_ctx, void *sock_ctx)
{
struct wlantest *wt = eloop_ctx;
case WLANTEST_CTRL_SEND:
ctrl_send_(wt, sock, buf + 4, len - 4);
break;
+ case WLANTEST_CTRL_RELOG:
+ ctrl_relog(wt, sock);
+ break;
default:
ctrl_send_simple(wt, sock, WLANTEST_CTRL_UNKNOWN_CMD);
break;
/*
* 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.
}
+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;
ifname_wired = optarg;
break;
case 'n':
- pcapng_file = optarg;
+ wt.pcapng_file = optarg;
break;
case 'p':
add_passphrase(&wt, optarg);
read_wired_file = optarg;
break;
case 'w':
- write_file = optarg;
+ wt.write_file = optarg;
break;
case 'W':
if (add_wep(&wt, optarg) < 0)
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)
/*
* wlantest - IEEE 802.11 protocol monitoring and testing tool
- * Copyright (c) 2010, 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.
char *notes[MAX_NOTES];
size_t num_notes;
+
+ const char *write_file;
+ const char *pcapng_file;
};
void add_note(struct wlantest *wt, int level, const char *fmt, ...)
struct wlantest_sta *sta, u8 *frame, size_t len,
enum wlantest_inject_protection prot);
+int wlantest_relog(struct wlantest *wt);
+
#endif /* WLANTEST_H */
}
+static int cmd_relog(int s, int argc, char *argv[])
+{
+ return cmd_simple(s, WLANTEST_CTRL_RELOG);
+}
+
+
struct tdls_counters {
const char *name;
enum wlantest_tdls_counter num;
{ "get_bss_counter", cmd_get_bss_counter,
"<counter> <BSSID> = get BSS counter value",
complete_get_bss_counter },
+ { "relog", cmd_relog, "= re-open log-file (allow rolling logs)", NULL },
{ NULL, NULL, NULL, NULL }
};
/*
* wlantest control interface
- * Copyright (c) 2010, 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.
WLANTEST_CTRL_SEND,
WLANTEST_CTRL_CLEAR_TDLS_COUNTERS,
WLANTEST_CTRL_GET_TDLS_COUNTER,
+ WLANTEST_CTRL_RELOG,
};
enum wlantest_ctrl_attr {