diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-01-17 20:33:30 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-01-17 20:33:30 +0100 |
commit | d05f05e21be0cca59ca67ac19ef2b73c467b8250 (patch) | |
tree | 910880ccc795d15c9a59e07aad00ac40b64eb12f /src/main.c | |
parent | a63f5181807803ffdd879edca9fd4d73c4be35f3 (diff) | |
download | conntrack-tools-d05f05e21be0cca59ca67ac19ef2b73c467b8250.tar.gz conntrack-tools-d05f05e21be0cca59ca67ac19ef2b73c467b8250.zip |
src: add `-s queue' and change `-v' behaviour
This patch moves the existing `-v' behaviour to `-s queue' where it
really belongs. The `-v' option is now left to display the version
which is the common use of it.
# conntrackd -v
Connection tracking userspace daemon v0.9.9. Licensed under GPLv2.
(C) 2006-2009 Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -43,12 +43,12 @@ static const char usage_client_commands[] = " -i, display content of the internal cache\n" " -e, display the content of the external cache\n" " -k, kill conntrack daemon\n" - " -s [|network|cache|runtime|multicast], dump statistics\n" + " -s [|network|cache|runtime|multicast|queue], dump statistics\n" " -R, resync with kernel conntrack table\n" " -n, request resync with other node (only FT-FW and NOTRACK modes)\n" " -x, dump cache in XML format (requires -i or -e)\n" " -t, reset the kernel timeout (see PurgeTimeout clause)\n" - " -v, show internal debugging information (if any)\n"; + " -v, display conntrackd version\n"; static const char usage_options[] = "Options:\n" @@ -65,6 +65,15 @@ show_usage(char *progname) } static void +show_version(void) +{ + fprintf(stdout, "Connection tracking userspace daemon v%s. ", VERSION); + fprintf(stdout, "Licensed under GPLv2.\n"); + fprintf(stdout, "(C) 2006-2009 Pablo Neira Ayuso "); + fprintf(stdout, "<pablo@netfilter.org>\n"); +} + +static void set_operation_mode(int *current, int want, char *argv[]) { if (*current == NOT_SET) { @@ -173,6 +182,10 @@ int main(int argc, char *argv[]) strlen(argv[i+1])) == 0) { action = STATS_MULTICAST; i++; + } else if (strncmp(argv[i+1], "queue", + strlen(argv[i+1])) == 0) { + action = STATS_QUEUE; + i++; } else { fprintf(stderr, "ERROR: unknown " "parameter `%s' for " @@ -206,9 +219,8 @@ int main(int argc, char *argv[]) } break; case 'v': - set_operation_mode(&type, REQUEST, argv); - action = DEBUG_INFO; - break; + show_version(); + exit(EXIT_SUCCESS); default: show_usage(argv[0]); fprintf(stderr, "Unknown option: %s\n", argv[i]); |