]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/netfilter/xt_limit.c
netfilter: xtables: substitute temporary defines by final name
[net-next-2.6.git] / net / netfilter / xt_limit.c
index 5ff0580ce87880bc66f7d3d5a23449bf7f29067f..7dcfe8602c839457efd82b93e2e351b276cb03ec 100644 (file)
@@ -6,6 +6,8 @@
  * published by the Free Software Foundation.
  */
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
@@ -63,7 +65,7 @@ static DEFINE_SPINLOCK(limit_lock);
 #define CREDITS_PER_JIFFY POW2_BELOW32(MAX_CPJ)
 
 static bool
-limit_mt(const struct sk_buff *skb, const struct xt_match_param *par)
+limit_mt(const struct sk_buff *skb, const struct xt_action_param *par)
 {
        const struct xt_rateinfo *r = par->matchinfo;
        struct xt_limit_priv *priv = r->master;
@@ -107,12 +109,12 @@ static int limit_mt_check(const struct xt_mtchk_param *par)
            || user2credits(r->avg * r->burst) < user2credits(r->avg)) {
                pr_info("Overflow, try lower: %u/%u\n",
                        r->avg, r->burst);
-               return -EINVAL;
+               return -ERANGE;
        }
 
        priv = kmalloc(sizeof(*priv), GFP_KERNEL);
        if (priv == NULL)
-               return -EINVAL;
+               return -ENOMEM;
 
        /* For SMP, we only want to use one set of state. */
        r->master = priv;