netfilter: xtables: change targets to return error code
[deliverable/linux.git] / net / netfilter / xt_limit.c
index a0ca5339af41523a174f117a7307e46833711c42..5ff0580ce87880bc66f7d3d5a23449bf7f29067f 100644 (file)
@@ -5,7 +5,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/module.h>
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
@@ -97,7 +97,7 @@ user2credits(u_int32_t user)
        return (user * HZ * CREDITS_PER_JIFFY) / XT_LIMIT_SCALE;
 }
 
-static bool limit_mt_check(const struct xt_mtchk_param *par)
+static int limit_mt_check(const struct xt_mtchk_param *par)
 {
        struct xt_rateinfo *r = par->matchinfo;
        struct xt_limit_priv *priv;
@@ -105,14 +105,14 @@ static bool limit_mt_check(const struct xt_mtchk_param *par)
        /* Check for overflow. */
        if (r->burst == 0
            || user2credits(r->avg * r->burst) < user2credits(r->avg)) {
-               printk("Overflow in xt_limit, try lower: %u/%u\n",
-                      r->avg, r->burst);
-               return false;
+               pr_info("Overflow, try lower: %u/%u\n",
+                       r->avg, r->burst);
+               return -EINVAL;
        }
 
        priv = kmalloc(sizeof(*priv), GFP_KERNEL);
        if (priv == NULL)
-               return false;
+               return -EINVAL;
 
        /* For SMP, we only want to use one set of state. */
        r->master = priv;
@@ -124,7 +124,7 @@ static bool limit_mt_check(const struct xt_mtchk_param *par)
                r->credit_cap = user2credits(r->avg * r->burst); /* Credits full. */
                r->cost = user2credits(r->avg);
        }
-       return true;
+       return 0;
 }
 
 static void limit_mt_destroy(const struct xt_mtdtor_param *par)
This page took 0.042778 seconds and 5 git commands to generate.