On Wednesday 2016-03-02 13:10, Florian Westphal wrote:
>> case XT_STATISTIC_MODE_RANDOM:
>> if ((prandom_u32() & 0x7FFFFFFF) <
>> info->u.random.probability)
>>
>> --probability seems to check for "less than" the random value.
>
>Yes. [...]
>Other suggestions?
"--probability" is meant to represent saying "with a probability
of p=10%, ...". This does not mandate any particular operator.
The use of the LE operator seems more of an implementation detail for
use with discrete approaches (such as prandom_u32 and counting à la
Nth), and therefore should not be exposed by nft. Think of asking a
hypothetical hardware device which answers the probability question.
int mtinit(prob p) { setup_hw(p); }
bool match() { return hw_says(); }
Furthermore, it surprises me that iptables even supports
! --probability, because you can just express it as 1-p
instead.
"32% of people voted for Party 1, not 32% for Party 2"
Nobody does that. Instead,
"32% of people voted for Party 1, 68% (or: the rest) for Party 2"
which is probably also why I have never seen ! --p in the
wild, because anyone could just specify 1-p instead.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html