diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2013-09-30 17:44:19 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2013-09-30 20:42:28 +0200 |
commit | bd83dd9c975aeb9fc09c09ef4dd408e6b618c4af (patch) | |
tree | 9619e96a2c22f3e6fdcb6b16ba64f326146d7a6b | |
parent | 408e36cf6e12d34d67bf2c1694428533060f9b14 (diff) |
netsniff-ng: Display pcap I/O method in verbose mode
If a user accidentially specifies more than one of --mm/--sg/--clrw, the
option specified last will be used - as expected from standard command
line tools. In order to still prevent users from being confused by this,
explicitely display the pcap I/O method used in verbose mode.
In order for the output to be more user-friendly, actually write out the
method names in const char *pcap_ops_group_to_str, which isn't used
anywhere else anyway.
Suggested-by: Jon Schipp <jonschipp@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | netsniff-ng.c | 3 | ||||
-rw-r--r-- | pcap_io.h | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c index 42a56b5..8a4f7e6 100644 --- a/netsniff-ng.c +++ b/netsniff-ng.c @@ -1421,6 +1421,9 @@ int main(int argc, char **argv) if (!ctx.enforce) xlockme(); + if (ctx.verbose) + printf("pcap file I/O method: %s\n", pcap_ops_group_to_str[ctx.pcap]); + main_loop(&ctx); if (!ctx.enforce) @@ -605,9 +605,9 @@ static inline void pcap_dump_type_features(void) } static const char *pcap_ops_group_to_str[] __maybe_unused = { - [PCAP_OPS_RW] = "rw", - [PCAP_OPS_SG] = "sg", - [PCAP_OPS_MM] = "mm", + [PCAP_OPS_RW] = "read/write", + [PCAP_OPS_SG] = "scatter-gather", + [PCAP_OPS_MM] = "mmap", }; static const struct pcap_file_ops *pcap_ops[] __maybe_unused = { |