]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: xt_connbytes: handle negation correctly
authorFlorian Westphal <fw@strlen.de>
Fri, 16 Dec 2011 17:35:15 +0000 (18:35 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 23 Dec 2011 13:50:19 +0000 (14:50 +0100)
commita375f91e3933104aa8b6ea065b489bdeb5f8bc91
tree48a2b84c4298194cd51a55b89b7c9cb2714c0840
parenta6947a0741b60bdc35c14d8a0a44c531cdb5acca
netfilter: xt_connbytes: handle negation correctly

"! --connbytes 23:42" should match if the packet/byte count is not in range.

As there is no explict "invert match" toggle in the match structure,
userspace swaps the from and to arguments
(i.e., as if "--connbytes 42:23" were given).

However, "what <= 23 && what >= 42" will always be false.

Change things so we use "||" in case "from" is larger than "to".

This change may look like it breaks backwards compatibility when "to" is 0.
However, older iptables binaries will refuse "connbytes 42:0",
and current releases treat it to mean "! --connbytes 0:42",
so we should be fine.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_connbytes.c