]> Pileus Git - ~andy/linux/blobdiff - net/netfilter/xt_policy.c
Merge branch 'linus' into release
[~andy/linux] / net / netfilter / xt_policy.c
index 4cbfebda8fa11795af6887e33761a374b50857ce..f23e97bb42d7c0f860cdf15258e530a11bb54bef 100644 (file)
@@ -6,7 +6,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
@@ -110,15 +110,15 @@ match_policy_out(const struct sk_buff *skb, const struct xt_policy_info *info,
 }
 
 static bool
-policy_mt(const struct sk_buff *skb, const struct xt_match_param *par)
+policy_mt(const struct sk_buff *skb, struct xt_action_param *par)
 {
        const struct xt_policy_info *info = par->matchinfo;
        int ret;
 
        if (info->flags & XT_POLICY_MATCH_IN)
-               ret = match_policy_in(skb, info, par->match->family);
+               ret = match_policy_in(skb, info, par->family);
        else
-               ret = match_policy_out(skb, info, par->match->family);
+               ret = match_policy_out(skb, info, par->family);
 
        if (ret < 0)
                ret = info->flags & XT_POLICY_MATCH_NONE ? true : false;
@@ -128,32 +128,29 @@ policy_mt(const struct sk_buff *skb, const struct xt_match_param *par)
        return ret;
 }
 
-static bool policy_mt_check(const struct xt_mtchk_param *par)
+static int policy_mt_check(const struct xt_mtchk_param *par)
 {
        const struct xt_policy_info *info = par->matchinfo;
 
        if (!(info->flags & (XT_POLICY_MATCH_IN|XT_POLICY_MATCH_OUT))) {
-               printk(KERN_ERR "xt_policy: neither incoming nor "
-                               "outgoing policy selected\n");
-               return false;
+               pr_info("neither incoming nor outgoing policy selected\n");
+               return -EINVAL;
        }
        if (par->hook_mask & ((1 << NF_INET_PRE_ROUTING) |
            (1 << NF_INET_LOCAL_IN)) && info->flags & XT_POLICY_MATCH_OUT) {
-               printk(KERN_ERR "xt_policy: output policy not valid in "
-                               "PRE_ROUTING and INPUT\n");
-               return false;
+               pr_info("output policy not valid in PREROUTING and INPUT\n");
+               return -EINVAL;
        }
        if (par->hook_mask & ((1 << NF_INET_POST_ROUTING) |
            (1 << NF_INET_LOCAL_OUT)) && info->flags & XT_POLICY_MATCH_IN) {
-               printk(KERN_ERR "xt_policy: input policy not valid in "
-                               "POST_ROUTING and OUTPUT\n");
-               return false;
+               pr_info("input policy not valid in POSTROUTING and OUTPUT\n");
+               return -EINVAL;
        }
        if (info->len > XT_POLICY_MAX_ELEM) {
-               printk(KERN_ERR "xt_policy: too many policy elements\n");
-               return false;
+               pr_info("too many policy elements\n");
+               return -EINVAL;
        }
-       return true;
+       return 0;
 }
 
 static struct xt_match policy_mt_reg[] __read_mostly = {