From 4a96d2e2c9d8c43b58d9490cd1d2ae2d1b3e0bef Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 21 Jun 2011 09:54:31 +0200 Subject: libxt_rateest: abolish global variables Signed-off-by: Jan Engelhardt --- extensions/libxt_rateest.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/extensions/libxt_rateest.c b/extensions/libxt_rateest.c index 509b3e31..5f42a137 100644 --- a/extensions/libxt_rateest.c +++ b/extensions/libxt_rateest.c @@ -8,9 +8,6 @@ #include #include -/* 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, -- cgit v1.2.3