Signed-off-by: Phil Sutter <phil@xxxxxx> --- extensions/libxt_limit.c | 50 ++-------------------------------------- 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/extensions/libxt_limit.c b/extensions/libxt_limit.c index e6ec67f302688..63f3289d82c22 100644 --- a/extensions/libxt_limit.c +++ b/extensions/libxt_limit.c @@ -7,7 +7,6 @@ #define _DEFAULT_SOURCE 1 #define _ISOC99_SOURCE 1 #include <errno.h> -#include <getopt.h> #include <math.h> #include <stdio.h> #include <string.h> @@ -202,44 +201,6 @@ static int limit_xlate_eb(struct xt_xlate *xl, return 1; } -#define FLAG_LIMIT 0x01 -#define FLAG_LIMIT_BURST 0x02 -#define ARG_LIMIT '1' -#define ARG_LIMIT_BURST '2' - -static int brlimit_parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, struct xt_entry_match **match) -{ - struct xt_rateinfo *r = (struct xt_rateinfo *)(*match)->data; - uintmax_t num; - - switch (c) { - case ARG_LIMIT: - EBT_CHECK_OPTION(flags, FLAG_LIMIT); - if (invert) - xtables_error(PARAMETER_PROBLEM, - "Unexpected `!' after --limit"); - if (!parse_rate(optarg, &r->avg)) - xtables_error(PARAMETER_PROBLEM, - "bad rate `%s'", optarg); - break; - case ARG_LIMIT_BURST: - EBT_CHECK_OPTION(flags, FLAG_LIMIT_BURST); - if (invert) - xtables_error(PARAMETER_PROBLEM, - "Unexpected `!' after --limit-burst"); - if (!xtables_strtoul(optarg, NULL, &num, 0, 10000)) - xtables_error(PARAMETER_PROBLEM, - "bad --limit-burst `%s'", optarg); - r->burst = num; - break; - default: - return 0; - } - - return 1; -} - static void brlimit_print(const void *ip, const struct xt_entry_match *match, int numeric) { @@ -250,13 +211,6 @@ static void brlimit_print(const void *ip, const struct xt_entry_match *match, printf(" --limit-burst %u ", r->burst); } -static const struct option brlimit_opts[] = -{ - { .name = "limit", .has_arg = true, .val = ARG_LIMIT }, - { .name = "limit-burst",.has_arg = true, .val = ARG_LIMIT_BURST }, - XT_GETOPT_TABLEEND, -}; - static struct xtables_match limit_match[] = { { .family = NFPROTO_UNSPEC, @@ -280,9 +234,9 @@ static struct xtables_match limit_match[] = { .userspacesize = offsetof(struct xt_rateinfo, prev), .help = limit_help, .init = limit_init, - .parse = brlimit_parse, + .x6_parse = limit_parse, .print = brlimit_print, - .extra_opts = brlimit_opts, + .x6_options = limit_opts, .xlate = limit_xlate_eb, }, }; -- 2.43.0