summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-12-21 19:39:39 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2008-12-21 19:39:39 +0100
commit7b3f57d5007dd2cf4127c2c3a9a7cd0f64d5d6e9 (patch)
treeaf5056d1a50fc62e640508c735114c3c4157ab0e /src/main.c
parentb666e6ebbd0c0ae7967ff8167790166858544297 (diff)
downloadconntrack-tools-7b3f57d5007dd2cf4127c2c3a9a7cd0f64d5d6e9.tar.gz
conntrack-tools-7b3f57d5007dd2cf4127c2c3a9a7cd0f64d5d6e9.zip
src: add network statistics via `-s network'
This patch adds networks statistics that you can check via `conntrackd -s network'. This information is useful for trouble-shooting. This patch replaces several log messages that can be triggered in runtime. The idea behind this patch is to avoid log message flooding under errors. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index f811acf..022915d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -43,7 +43,7 @@ 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, dump statistics\n"
+ " -s [|network], 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)"
@@ -155,7 +155,23 @@ int main(int argc, char *argv[])
break;
case 's':
set_operation_mode(&type, REQUEST, argv);
- action = STATS;
+ /* we've got a parameter */
+ if (i+1 < argc && argv[i+1][0] != '-') {
+ if (strncmp(argv[i+1], "network",
+ strlen(argv[i+1])) == 0) {
+ action = STATS_NETWORK;
+ i++;
+ } else {
+ fprintf(stderr, "ERROR: unknown "
+ "parameter `%s' for "
+ "option `-s'\n",
+ argv[i+1]);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ /* default to general statistics */
+ action = STATS;
+ }
break;
case 'S':
fprintf(stderr, "WARNING: -S option is obsolete. "