wlantest: Add support for log output into a file
This allows wlantest debug log output to be directed to a file so that RELOG command can be used to rotate files more easily than stdout. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
c99a721e5b
commit
d33fef57a4
3 changed files with 15 additions and 2 deletions
|
@ -11,6 +11,7 @@ include ../lib.rules
|
||||||
|
|
||||||
#CFLAGS += -DWPA_TRACE
|
#CFLAGS += -DWPA_TRACE
|
||||||
CFLAGS += -DCONFIG_IPV6
|
CFLAGS += -DCONFIG_IPV6
|
||||||
|
CFLAGS += -DCONFIG_DEBUG_FILE
|
||||||
|
|
||||||
LIB_OBJS= \
|
LIB_OBJS= \
|
||||||
base64.o \
|
base64.o \
|
||||||
|
|
|
@ -42,6 +42,7 @@ OBJS_lib += ../src/crypto/libcrypto.a
|
||||||
CFLAGS += -DCONFIG_PEERKEY
|
CFLAGS += -DCONFIG_PEERKEY
|
||||||
CFLAGS += -DCONFIG_IEEE80211W
|
CFLAGS += -DCONFIG_IEEE80211W
|
||||||
CFLAGS += -DCONFIG_IEEE80211R
|
CFLAGS += -DCONFIG_IEEE80211R
|
||||||
|
CFLAGS += -DCONFIG_DEBUG_FILE
|
||||||
|
|
||||||
OBJS += ../src/common/ieee802_11_common.o
|
OBJS += ../src/common/ieee802_11_common.o
|
||||||
OBJS += ../src/common/wpa_common.o
|
OBJS += ../src/common/wpa_common.o
|
||||||
|
|
|
@ -30,7 +30,8 @@ static void usage(void)
|
||||||
" [-I<wired ifname>] [-R<wired pcap file>] "
|
" [-I<wired ifname>] [-R<wired pcap file>] "
|
||||||
"[-P<RADIUS shared secret>]\n"
|
"[-P<RADIUS shared secret>]\n"
|
||||||
" [-n<write pcapng file>]\n"
|
" [-n<write pcapng file>]\n"
|
||||||
" [-w<write pcap file>] [-f<MSK/PMK file>]\n");
|
" [-w<write pcap file>] [-f<MSK/PMK file>]\n"
|
||||||
|
" [-L<log file>]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,6 +251,8 @@ int wlantest_relog(struct wlantest *wt)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
wpa_printf(MSG_INFO, "Re-open log/capture files");
|
wpa_printf(MSG_INFO, "Re-open log/capture files");
|
||||||
|
if (wpa_debug_reopen_file())
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
if (wt->write_file) {
|
if (wt->write_file) {
|
||||||
write_pcap_deinit(wt);
|
write_pcap_deinit(wt);
|
||||||
|
@ -274,6 +277,7 @@ int main(int argc, char *argv[])
|
||||||
const char *read_wired_file = NULL;
|
const char *read_wired_file = NULL;
|
||||||
const char *ifname = NULL;
|
const char *ifname = NULL;
|
||||||
const char *ifname_wired = NULL;
|
const char *ifname_wired = NULL;
|
||||||
|
const char *logfile = NULL;
|
||||||
struct wlantest wt;
|
struct wlantest wt;
|
||||||
int ctrl_iface = 0;
|
int ctrl_iface = 0;
|
||||||
|
|
||||||
|
@ -286,7 +290,7 @@ int main(int argc, char *argv[])
|
||||||
wlantest_init(&wt);
|
wlantest_init(&wt);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = getopt(argc, argv, "cdf:Fhi:I:n:p:P:qr:R:w:W:");
|
c = getopt(argc, argv, "cdf:Fhi:I:L:n:p:P:qr:R:w:W:");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -313,6 +317,9 @@ int main(int argc, char *argv[])
|
||||||
case 'I':
|
case 'I':
|
||||||
ifname_wired = optarg;
|
ifname_wired = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'L':
|
||||||
|
logfile = optarg;
|
||||||
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
wt.pcapng_file = optarg;
|
wt.pcapng_file = optarg;
|
||||||
break;
|
break;
|
||||||
|
@ -353,6 +360,9 @@ int main(int argc, char *argv[])
|
||||||
if (eloop_init())
|
if (eloop_init())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (logfile)
|
||||||
|
wpa_debug_open_file(logfile);
|
||||||
|
|
||||||
if (wt.write_file && write_pcap_init(&wt, wt.write_file) < 0)
|
if (wt.write_file && write_pcap_init(&wt, wt.write_file) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -384,6 +394,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
wlantest_deinit(&wt);
|
wlantest_deinit(&wt);
|
||||||
|
|
||||||
|
wpa_debug_close_file();
|
||||||
eloop_destroy();
|
eloop_destroy();
|
||||||
os_program_deinit();
|
os_program_deinit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue