Merge branch 'wimax-2.6.35.y' of git://git.kernel.org/pub/scm/linux/kernel/git/inaky...
[linux-drm-fsl-dcu.git] / net / netfilter / xt_RATEEST.c
index d16d55df4f616444b3fb7368cf0c91a1a2021459..69c01e10f8afe00ebcdefd1becdec4875fa84a06 100644 (file)
@@ -73,7 +73,7 @@ void xt_rateest_put(struct xt_rateest *est)
 EXPORT_SYMBOL_GPL(xt_rateest_put);
 
 static unsigned int
-xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par)
+xt_rateest_tg(struct sk_buff *skb, const struct xt_action_param *par)
 {
        const struct xt_rateest_target_info *info = par->targinfo;
        struct gnet_stats_basic_packed *stats = &info->est->bstats;
@@ -86,7 +86,7 @@ xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par)
        return XT_CONTINUE;
 }
 
-static bool xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
+static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
 {
        struct xt_rateest_target_info *info = par->targinfo;
        struct xt_rateest *est;
@@ -94,6 +94,7 @@ static bool xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
                struct nlattr           opt;
                struct gnet_estimator   est;
        } cfg;
+       int ret;
 
        if (unlikely(!rnd_inited)) {
                get_random_bytes(&jhash_rnd, sizeof(jhash_rnd));
@@ -110,12 +111,13 @@ static bool xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
                    (info->interval != est->params.interval ||
                     info->ewma_log != est->params.ewma_log)) {
                        xt_rateest_put(est);
-                       return false;
+                       return -EINVAL;
                }
                info->est = est;
-               return true;
+               return 0;
        }
 
+       ret = -ENOMEM;
        est = kzalloc(sizeof(*est), GFP_KERNEL);
        if (!est)
                goto err1;
@@ -131,19 +133,19 @@ static bool xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
        cfg.est.interval        = info->interval;
        cfg.est.ewma_log        = info->ewma_log;
 
-       if (gen_new_estimator(&est->bstats, &est->rstats, &est->lock,
-                             &cfg.opt) < 0)
+       ret = gen_new_estimator(&est->bstats, &est->rstats,
+                               &est->lock, &cfg.opt);
+       if (ret < 0)
                goto err2;
 
        info->est = est;
        xt_rateest_hash_insert(est);
-
-       return true;
+       return 0;
 
 err2:
        kfree(est);
 err1:
-       return false;
+       return ret;
 }
 
 static void xt_rateest_tg_destroy(const struct xt_tgdtor_param *par)