From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 4/4] monitor: add --pcap-size,--pcap-count
Date: Wed, 27 Nov 2024 09:33:28 -0800 [thread overview]
Message-ID: <20241127173328.158354-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20241127173328.158354-1-prestwoj@gmail.com>
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.
---
monitor/main.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/monitor/main.c b/monitor/main.c
index fe40e301..11077cee 100644
--- 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;
@@ -798,6 +802,24 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+ 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);
--
2.34.1
prev parent reply other threads:[~2024-11-27 17:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 17:33 [PATCH 1/4] monitor: add --time-format,-t option James Prestwood
2024-11-27 17:33 ` [PATCH 2/4] monitor: track current PCAP size James Prestwood
2024-11-27 17:33 ` [PATCH 3/4] monitor: add support for limiting PCAP size/count James Prestwood
2024-11-27 17:33 ` James Prestwood [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241127173328.158354-4-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox