From 39d3aa36ea38668a2c343b5af42b2d8d3616a9de Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 2 May 2011 16:38:11 +0200 Subject: libxt_statistic: increase precision on create and dump Currently, libxt_statistic only dumps the probability with a granularity of 1/1000000. Assuming only stuffed packets with 1440 bytes payload, this would match approximately every 1.341 GB, which is pretty low for a high-volume router. Trying to match any larger interval than that (e.g. 2 GB) will cause libxt_statistic to output "--probability 0.000000", and when restored, will cause it to never match again. Bump the dump precision to what xt_statistic can really do, and adjust the manpage to include a word about it. Furthermore, employ explicit rounding when reading the argument from the command line, because the previous implicit conversion would use truncation, which is not very exact. Signed-off-by: Jan Engelhardt --- extensions/libxt_statistic.man | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'extensions/libxt_statistic.man') diff --git a/extensions/libxt_statistic.man b/extensions/libxt_statistic.man index 4947dafe..47182bfb 100644 --- a/extensions/libxt_statistic.man +++ b/extensions/libxt_statistic.man @@ -12,10 +12,9 @@ and .B nth. .TP [\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. +Set the probability for a packet to be randomly matched. It only works with the +\fBrandom\fP mode. \fIp\fP must be within 0.0 and 1.0. The supported +granularity is in 1/2147483648th increments. .TP [\fB!\fP] \fB\-\-every\fP \fIn\fP Match one packet every nth packet. It works only with the -- cgit v1.2.3