]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_rateest: abolish global variables
authorJan Engelhardt <jengelh@medozas.de>
Tue, 21 Jun 2011 07:54:31 +0000 (09:54 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Tue, 21 Jun 2011 15:05:11 +0000 (17:05 +0200)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
extensions/libxt_rateest.c

index 509b3e319d7998eea1b8ba9b54110106890dcc96..5f42a13717c761723dd5224c7b15c104de1fcea8 100644 (file)
@@ -8,9 +8,6 @@
 #include <xtables.h>
 #include <linux/netfilter/xt_rateest.h>
 
-/* Ugly hack to pass info to final_check function. We should fix the API */
-static struct xt_rateest_match_info *rateest_info;
-
 static void rateest_help(void)
 {
        printf(
@@ -115,8 +112,6 @@ rateest_parse(int c, char **argv, int invert, unsigned int *flags,
        struct xt_rateest_match_info *info = (void *)(*match)->data;
        unsigned int val;
 
-       rateest_info = info;
-
        switch (c) {
        case OPT_RATEEST1:
                xtables_check_inverse(optarg, &invert, &optind, 0, argv);
@@ -302,10 +297,9 @@ rateest_parse(int c, char **argv, int invert, unsigned int *flags,
        return 1;
 }
 
-static void
-rateest_final_check(unsigned int flags)
+static void rateest_final_check(struct xt_fcheck_call *cb)
 {
-       struct xt_rateest_match_info *info = rateest_info;
+       struct xt_rateest_match_info *info = cb->data;
 
        if (info == NULL)
                xtables_error(PARAMETER_PROBLEM, "rateest match: "
@@ -439,7 +433,7 @@ static struct xtables_match rateest_mt_reg = {
        .userspacesize  = XT_ALIGN(offsetof(struct xt_rateest_match_info, est1)),
        .help           = rateest_help,
        .parse          = rateest_parse,
-       .final_check    = rateest_final_check,
+       .x6_fcheck      = rateest_final_check,
        .print          = rateest_print,
        .save           = rateest_save,
        .extra_opts     = rateest_opts,