]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_statistic: streamline and document possible placement of negation
authorJan Engelhardt <jengelh@medozas.de>
Mon, 2 May 2011 14:29:18 +0000 (16:29 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Sun, 8 May 2011 22:18:22 +0000 (00:18 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libxt_statistic.c
extensions/libxt_statistic.man

index b4171b1169cfffe56699c104bc94006c00162538..bce83fa959d5459f6b5f71101b77822cde67fed4 100644 (file)
@@ -15,9 +15,9 @@ static void statistic_help(void)
 "statistic match options:\n"
 " --mode mode                    Match mode (random, nth)\n"
 " random mode:\n"
-" --probability p               Probability\n"
+"[!] --probability p            Probability\n"
 " nth mode:\n"
-" --every n                     Match every nth packet\n"
+"[!] --every n                  Match every nth packet\n"
 " --packet p                    Initial counter value (0 <= p <= n-1, default 0)\n");
 }
 
@@ -125,16 +125,17 @@ static void statistic_check(unsigned int flags)
 
 static void print_match(const struct xt_statistic_info *info, char *prefix)
 {
-       if (info->flags & XT_STATISTIC_INVERT)
-               printf(" !");
-
        switch (info->mode) {
        case XT_STATISTIC_MODE_RANDOM:
-               printf( "%smode random %sprobability %f", prefix, prefix,
+               printf(" %smode random%s %sprobability %f", prefix,
+                      (info->flags & XT_STATISTIC_INVERT) ? " !" : "",
+                      prefix,
                       1.0 * info->u.random.probability / 0x80000000);
                break;
        case XT_STATISTIC_MODE_NTH:
-               printf(" %smode nth %severy %u", prefix, prefix,
+               printf(" %smode nth%s %severy %u", prefix,
+                      (info->flags & XT_STATISTIC_INVERT) ? " !" : "",
+                      prefix,
                       info->u.nth.every + 1);
                if (info->u.nth.packet)
                        printf(" %spacket %u", prefix, info->u.nth.packet);
index 8fc3b293e24c3b66918c692a6fd226eb2d9c090d..4947dafeb7af9ccc227ef2cfac4881a821388405 100644 (file)
@@ -11,13 +11,13 @@ Set the matching mode of the matching rule, supported modes are
 and
 .B nth. 
 .TP
-\fB\-\-probability\fP \fIp\fP
+[\fB!\fP] \fB\-\-probability\fP \fIp\fP
 Set the probability from 0 to 1 for a packet to be randomly
 matched. It works only with the
 .B random
 mode.
 .TP
-\fB\-\-every\fP \fIn\fP
+[\fB!\fP] \fB\-\-every\fP \fIn\fP
 Match one packet every nth packet. It works only with the
 .B nth
 mode (see also the