]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
netfilter: arpt_mangle: fix return values of checkentry
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 1 Feb 2011 15:03:46 +0000 (16:03 +0100)
committerAK <andi@firstfloor.org>
Thu, 31 Mar 2011 18:58:52 +0000 (11:58 -0700)
In 135367b "netfilter: xtables: change xt_target.checkentry return type",
the type returned by checkentry was changed from boolean to int, but the
return values where not adjusted.

arptables: Input/output error

This broke arptables with the mangle target since it returns true
under success, which is interpreted by xtables as >0, thus
returning EIO.

The following Linux kernels are affected:
* 2.6.35.9
* 2.6.36.4
* 2.6.37.3

Cc: stable@kernel.org
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
(cherry picked from commit 9d0db8b6b1da9e3d4c696ef29449700c58d589db)

net/ipv4/netfilter/arpt_mangle.c

index e1be7dd1171b368eb4a0e1593abc9b8b2294838a..1dcf5d247bd71151b6a91ccdfc07e075e12b0f0f 100644 (file)
@@ -60,12 +60,12 @@ static int checkentry(const struct xt_tgchk_param *par)
 
        if (mangle->flags & ~ARPT_MANGLE_MASK ||
            !(mangle->flags & ARPT_MANGLE_MASK))
-               return false;
+               return -EINVAL;
 
        if (mangle->target != NF_DROP && mangle->target != NF_ACCEPT &&
           mangle->target != ARPT_CONTINUE)
-               return false;
-       return true;
+               return -EINVAL;
+       return 0;
 }
 
 static struct xt_target arpt_mangle_reg __read_mostly = {