commit 64b872f363caacc723900ba4973b63e31792104a
parent 83a2457550e75a29645ea62f112a32bc3a7dbee3
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 2 Dec 2024 06:54:38 -0800
monitor: add --pcap-size,--pcap-count
The user can now limit the size and count of PCAP files iwmon will
create. This allows iwmon to run for long periods of time without
filling up disk space.
Diffstat:
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/monitor/main.c b/monitor/main.c
@@ -728,6 +728,8 @@ static void usage(void)
"\t-e, --noies Don't show IEs except SSID\n"
"\t-t, --time-format <format> Time format to display. Either\n"
"\t\t\t\t 'delta' or 'utc'.\n"
+ "\t-W,--pcap-count Maximum number of PCAP files\n"
+ "\t-C,--pcap-size Maximum size (MB) of PCAP files\n"
"\t-h, --help Show help options\n");
}
@@ -742,6 +744,8 @@ static const struct option main_options[] = {
{ "noscan", no_argument, NULL, 's' },
{ "noies", no_argument, NULL, 'e' },
{ "time-format", required_argument, NULL, 't' },
+ { "pcap-count", required_argument, NULL, 'W' },
+ { "pcap-size", required_argument, NULL, 'C' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ }
@@ -757,7 +761,7 @@ int main(int argc, char *argv[])
for (;;) {
int opt;
- opt = getopt_long(argc, argv, "r:w:a:i:t:nvhyse",
+ opt = getopt_long(argc, argv, "r:w:a:i:t:W:C:nvhyse",
main_options, NULL);
if (opt < 0)
break;
@@ -799,6 +803,24 @@ int main(int argc, char *argv[])
}
break;
+ case 'W':
+ if (l_safe_atou32(optarg,
+ &config.pcap_file_count) < 0 ||
+ config.pcap_file_count == 0) {
+ printf("Invalid file count '%s'\n", optarg);
+ return EXIT_FAILURE;
+ }
+
+ break;
+ case 'C':
+ if (l_safe_atou32(optarg,
+ &config.pcap_file_size) < 0 ||
+ config.pcap_file_size == 0) {
+ printf("Invalid file size '%s'\n", optarg);
+ return EXIT_FAILURE;
+ }
+
+ break;
case 'v':
printf("%s\n", VERSION);
return EXIT_SUCCESS;