aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/xt_policy.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-03-23 16:35:56 +0100
committerJan Engelhardt <jengelh@medozas.de>2010-03-25 16:55:24 +0100
commitbd414ee605ff3ac5fcd79f57269a897879ee4cde (patch)
tree3cff5d1f3fd43791341e9cde23dabb4dfbc94bd3 /net/netfilter/xt_policy.c
parent135367b8f6a18507af6b9a6910a14b5699415309 (diff)
downloadlinux-bd414ee605ff3ac5fcd79f57269a897879ee4cde.tar.gz
netfilter: xtables: change matches to return error code
The following semantic patch does part of the transformation: // <smpl> @ rule1 @ struct xt_match ops; identifier check; @@ ops.checkentry = check; @@ identifier rule1.check; @@ check(...) { <... -return true; +return 0; ...> } @@ identifier rule1.check; @@ check(...) { <... -return false; +return -EINVAL; ...> } // </smpl> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net/netfilter/xt_policy.c')
-rw-r--r--net/netfilter/xt_policy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/netfilter/xt_policy.c b/net/netfilter/xt_policy.c
index c9965b640b16ab..1fa239c1fb93c9 100644
--- a/net/netfilter/xt_policy.c
+++ b/net/netfilter/xt_policy.c
@@ -134,23 +134,23 @@ static int policy_mt_check(const struct xt_mtchk_param *par)
if (!(info->flags & (XT_POLICY_MATCH_IN|XT_POLICY_MATCH_OUT))) {
pr_info("neither incoming nor outgoing policy selected\n");
- return false;
+ return -EINVAL;
}
if (par->hook_mask & ((1 << NF_INET_PRE_ROUTING) |
(1 << NF_INET_LOCAL_IN)) && info->flags & XT_POLICY_MATCH_OUT) {
pr_info("output policy not valid in PREROUTING and INPUT\n");
- return false;
+ return -EINVAL;
}
if (par->hook_mask & ((1 << NF_INET_POST_ROUTING) |
(1 << NF_INET_LOCAL_OUT)) && info->flags & XT_POLICY_MATCH_IN) {
pr_info("input policy not valid in POSTROUTING and OUTPUT\n");
- return false;
+ return -EINVAL;
}
if (info->len > XT_POLICY_MAX_ELEM) {
pr_info("too many policy elements\n");
- return false;
+ return -EINVAL;
}
- return true;
+ return 0;
}
static struct xt_match policy_mt_reg[] __read_mostly = {