wlantest: Support multiple input files
Allow the -r<file> command line argument to be used multiple times to read more than a single capture file for processing. This reduces need for external tools to be used first to merge capture files for wlantest. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
c3f465c56c
commit
605034240e
1 changed files with 25 additions and 6 deletions
|
@ -372,7 +372,9 @@ int wlantest_relog(struct wlantest *wt)
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c, ret = 0;
|
int c, ret = 0;
|
||||||
const char *read_file = NULL;
|
const unsigned int MAX_READ_FILE = 20;
|
||||||
|
const char *read_file[MAX_READ_FILE];
|
||||||
|
unsigned int rf, num_read_file = 0;
|
||||||
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;
|
||||||
|
@ -442,7 +444,13 @@ int main(int argc, char *argv[])
|
||||||
wpa_debug_level++;
|
wpa_debug_level++;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
read_file = optarg;
|
if (num_read_file == MAX_READ_FILE) {
|
||||||
|
wpa_printf(MSG_INFO,
|
||||||
|
"Too many read files (-r) - ignored %s",
|
||||||
|
optarg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
read_file[num_read_file++] = optarg;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
read_wired_file = optarg;
|
read_wired_file = optarg;
|
||||||
|
@ -473,7 +481,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifname == NULL && ifname_wired == NULL &&
|
if (ifname == NULL && ifname_wired == NULL &&
|
||||||
read_file == NULL && read_wired_file == NULL) {
|
num_read_file == 0 && read_wired_file == NULL) {
|
||||||
usage();
|
usage();
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto deinit;
|
goto deinit;
|
||||||
|
@ -491,9 +499,20 @@ int main(int argc, char *argv[])
|
||||||
if ((wt.write_file && write_pcap_init(&wt, wt.write_file) < 0) ||
|
if ((wt.write_file && write_pcap_init(&wt, wt.write_file) < 0) ||
|
||||||
(wt.pcapng_file && write_pcapng_init(&wt, wt.pcapng_file) < 0) ||
|
(wt.pcapng_file && write_pcapng_init(&wt, wt.pcapng_file) < 0) ||
|
||||||
(read_wired_file &&
|
(read_wired_file &&
|
||||||
read_wired_cap_file(&wt, read_wired_file) < 0) ||
|
read_wired_cap_file(&wt, read_wired_file) < 0))
|
||||||
(read_file && read_cap_file(&wt, read_file) < 0) ||
|
{
|
||||||
(ifname && monitor_init(&wt, ifname) < 0) ||
|
ret = -1;
|
||||||
|
goto deinit;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (rf = 0; rf < num_read_file; rf++) {
|
||||||
|
if (read_cap_file(&wt, read_file[rf]) < 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto deinit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ifname && monitor_init(&wt, ifname) < 0) ||
|
||||||
(ifname_wired && monitor_init_wired(&wt, ifname_wired) < 0) ||
|
(ifname_wired && monitor_init_wired(&wt, ifname_wired) < 0) ||
|
||||||
(ctrl_iface && ctrl_init(&wt) < 0)) {
|
(ctrl_iface && ctrl_init(&wt) < 0)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
Loading…
Reference in a new issue