From e917bca09924435f3fca23c01042543b1826c81e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 27 Jan 2009 18:14:21 +0100 Subject: extensions: use UINT_MAX constants over open-coded numbers (2/2) Use the handy constants for ranges. Signed-off-by: Jan Engelhardt --- extensions/libxt_hashlimit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'extensions/libxt_hashlimit.c') diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c index 1c506852..278e098e 100644 --- a/extensions/libxt_hashlimit.c +++ b/extensions/libxt_hashlimit.c @@ -240,7 +240,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", *flags & PARAM_SIZE); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, 0xffffffff, &num) == -1) + if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-size: `%s'", optarg); r->cfg.size = num; @@ -250,7 +250,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", *flags & PARAM_MAX); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, 0xffffffff, &num) == -1) + if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-max: `%s'", optarg); r->cfg.max = num; @@ -261,7 +261,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, "--hashlimit-htable-gcinterval", *flags & PARAM_GCINTERVAL); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, 0xffffffff, &num) == -1) + if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-gcinterval: `%s'", optarg); @@ -273,7 +273,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-expire", *flags & PARAM_EXPIRE); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, 0xffffffff, &num) == -1) + if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-expire: `%s'", optarg); /* FIXME: not HZ dependent */ @@ -351,7 +351,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case '&': /* --hashlimit-htable-size */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", *flags & PARAM_SIZE); - if (!strtonum(optarg, NULL, &num, 0, 0xffffffff)) + if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-size", optarg); info->cfg.size = num; @@ -361,7 +361,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case '*': /* --hashlimit-htable-max */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", *flags & PARAM_MAX); - if (!strtonum(optarg, NULL, &num, 0, 0xffffffff)) + if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-max", optarg); info->cfg.max = num; @@ -372,7 +372,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-gcinterval", *flags & PARAM_GCINTERVAL); - if (!strtonum(optarg, NULL, &num, 0, 0xffffffff)) + if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-gcinterval", optarg); /* FIXME: not HZ dependent!! */ @@ -383,7 +383,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case ')': /* --hashlimit-htable-expire */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-expire", *flags & PARAM_EXPIRE); - if (!strtonum(optarg, NULL, &num, 0, 0xffffffff)) + if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-expire", optarg); /* FIXME: not HZ dependent */ -- cgit v1.2.3 From 5f2922cfc0bbfbeb878f5c12e9fb3eb602ae5507 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 27 Jan 2009 18:43:01 +0100 Subject: libxtables: prefix/order - strtoui This commit also throws out the redundant string_to_number_*. Signed-off-by: Jan Engelhardt --- extensions/libxt_hashlimit.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'extensions/libxt_hashlimit.c') diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c index 278e098e..06d026a2 100644 --- a/extensions/libxt_hashlimit.c +++ b/extensions/libxt_hashlimit.c @@ -230,7 +230,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-burst", *flags & PARAM_BURST); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, 10000, &num) == -1) + if (!xtables_strtoui(optarg, NULL, &num, 0, 10000)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-burst `%s'", optarg); r->cfg.burst = num; @@ -240,7 +240,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", *flags & PARAM_SIZE); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-size: `%s'", optarg); r->cfg.size = num; @@ -250,7 +250,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", *flags & PARAM_MAX); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-max: `%s'", optarg); r->cfg.max = num; @@ -261,7 +261,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, "--hashlimit-htable-gcinterval", *flags & PARAM_GCINTERVAL); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-gcinterval: `%s'", optarg); @@ -273,7 +273,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-expire", *flags & PARAM_EXPIRE); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; - if (string_to_number(optarg, 0, UINT32_MAX, &num) == -1) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-expire: `%s'", optarg); /* FIXME: not HZ dependent */ @@ -341,7 +341,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case '$': /* --hashlimit-burst */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-burst", *flags & PARAM_BURST); - if (!strtonum(optarg, NULL, &num, 0, 10000)) + if (!xtables_strtoui(optarg, NULL, &num, 0, 10000)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-burst", optarg); info->cfg.burst = num; @@ -351,7 +351,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case '&': /* --hashlimit-htable-size */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", *flags & PARAM_SIZE); - if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-size", optarg); info->cfg.size = num; @@ -361,7 +361,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case '*': /* --hashlimit-htable-max */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", *flags & PARAM_MAX); - if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-max", optarg); info->cfg.max = num; @@ -372,7 +372,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-gcinterval", *flags & PARAM_GCINTERVAL); - if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-gcinterval", optarg); /* FIXME: not HZ dependent!! */ @@ -383,7 +383,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case ')': /* --hashlimit-htable-expire */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-expire", *flags & PARAM_EXPIRE); - if (!strtonum(optarg, NULL, &num, 0, UINT32_MAX)) + if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-htable-expire", optarg); /* FIXME: not HZ dependent */ @@ -413,7 +413,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case '<': /* --hashlimit-srcmask */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-srcmask", *flags & PARAM_SRCMASK); - if (!strtonum(optarg, NULL, &num, 0, maxmask)) + if (!xtables_strtoui(optarg, NULL, &num, 0, maxmask)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-srcmask", optarg); info->cfg.srcmask = num; @@ -423,7 +423,7 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, case '>': /* --hashlimit-dstmask */ param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-dstmask", *flags & PARAM_DSTMASK); - if (!strtonum(optarg, NULL, &num, 0, maxmask)) + if (!xtables_strtoui(optarg, NULL, &num, 0, maxmask)) param_act(P_BAD_VALUE, "hashlimit", "--hashlimit-dstmask", optarg); info->cfg.dstmask = num; -- cgit v1.2.3 From a41545ca7cde43e0ba53260ba74bd9bf74025a68 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 27 Jan 2009 21:27:19 +0100 Subject: libxtables: prefix/order - param_act Changes: exittype -> xtables_exittype P_* -> XTF_* flags Signed-off-by: Jan Engelhardt --- extensions/libxt_hashlimit.c | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'extensions/libxt_hashlimit.c') diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c index 06d026a2..f63db64e 100644 --- a/extensions/libxt_hashlimit.c +++ b/extensions/libxt_hashlimit.c @@ -217,7 +217,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, switch(c) { case '%': - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit", *flags & PARAM_LIMIT); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!parse_rate(optarg, &r->cfg.avg)) @@ -227,7 +227,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, break; case '$': - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-burst", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-burst", *flags & PARAM_BURST); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, 10000)) @@ -237,7 +237,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, *flags |= PARAM_BURST; break; case '&': - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", *flags & PARAM_SIZE); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) @@ -247,7 +247,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, *flags |= PARAM_SIZE; break; case '*': - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", *flags & PARAM_MAX); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) @@ -257,7 +257,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, *flags |= PARAM_MAX; break; case '(': - param_act(P_ONLY_ONCE, "hashlimit", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-gcinterval", *flags & PARAM_GCINTERVAL); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; @@ -270,7 +270,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, *flags |= PARAM_GCINTERVAL; break; case ')': - param_act(P_ONLY_ONCE, "hashlimit", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-expire", *flags & PARAM_EXPIRE); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) @@ -281,7 +281,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, *flags |= PARAM_EXPIRE; break; case '_': - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-mode", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-mode", *flags & PARAM_MODE); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (parse_mode(&r->cfg.mode, optarg) < 0) @@ -290,7 +290,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, *flags |= PARAM_MODE; break; case '"': - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-name", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-name", *flags & PARAM_NAME); if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (strlen(optarg) == 0) @@ -317,63 +317,63 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, switch(c) { case '%': /* --hashlimit / --hashlimit-below */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-upto", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-upto", *flags & PARAM_LIMIT); if (invert) info->cfg.mode |= XT_HASHLIMIT_INVERT; if (!parse_rate(optarg, &info->cfg.avg)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-upto", optarg); *flags |= PARAM_LIMIT; return true; case '^': /* --hashlimit-above == !--hashlimit-below */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-above", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-above", *flags & PARAM_LIMIT); if (!invert) info->cfg.mode |= XT_HASHLIMIT_INVERT; if (!parse_rate(optarg, &info->cfg.avg)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-above", optarg); *flags |= PARAM_LIMIT; return true; case '$': /* --hashlimit-burst */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-burst", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-burst", *flags & PARAM_BURST); if (!xtables_strtoui(optarg, NULL, &num, 0, 10000)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-burst", optarg); info->cfg.burst = num; *flags |= PARAM_BURST; return true; case '&': /* --hashlimit-htable-size */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", *flags & PARAM_SIZE); if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-htable-size", optarg); info->cfg.size = num; *flags |= PARAM_SIZE; return true; case '*': /* --hashlimit-htable-max */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", *flags & PARAM_MAX); if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-htable-max", optarg); info->cfg.max = num; *flags |= PARAM_MAX; return true; case '(': /* --hashlimit-htable-gcinterval */ - param_act(P_ONLY_ONCE, "hashlimit", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-gcinterval", *flags & PARAM_GCINTERVAL); if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-htable-gcinterval", optarg); /* FIXME: not HZ dependent!! */ info->cfg.gc_interval = num; @@ -381,10 +381,10 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, return true; case ')': /* --hashlimit-htable-expire */ - param_act(P_ONLY_ONCE, "hashlimit", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-expire", *flags & PARAM_EXPIRE); if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-htable-expire", optarg); /* FIXME: not HZ dependent */ info->cfg.expire = num; @@ -392,16 +392,16 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, return true; case '_': - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-mode", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-mode", *flags & PARAM_MODE); if (parse_mode(&info->cfg.mode, optarg) < 0) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-mode", optarg); *flags |= PARAM_MODE; return true; case '"': /* --hashlimit-name */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-name", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-name", *flags & PARAM_NAME); if (strlen(optarg) == 0) exit_error(PARAMETER_PROBLEM, "Zero-length name?"); @@ -411,20 +411,20 @@ hashlimit_mt_parse(struct xt_hashlimit_mtinfo1 *info, unsigned int *flags, return true; case '<': /* --hashlimit-srcmask */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-srcmask", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-srcmask", *flags & PARAM_SRCMASK); if (!xtables_strtoui(optarg, NULL, &num, 0, maxmask)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-srcmask", optarg); info->cfg.srcmask = num; *flags |= PARAM_SRCMASK; return true; case '>': /* --hashlimit-dstmask */ - param_act(P_ONLY_ONCE, "hashlimit", "--hashlimit-dstmask", + xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-dstmask", *flags & PARAM_DSTMASK); if (!xtables_strtoui(optarg, NULL, &num, 0, maxmask)) - param_act(P_BAD_VALUE, "hashlimit", + xtables_param_act(XTF_BAD_VALUE, "hashlimit", "--hashlimit-dstmask", optarg); info->cfg.dstmask = num; *flags |= PARAM_DSTMASK; -- cgit v1.2.3 From 0f16c725aadaac7e670d632ecbaea3661ff00827 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 30 Jan 2009 04:55:38 +0100 Subject: libxtables: prefix/order - move check_inverse to xtables.c This also adds a warning that intrapositional negation support is deprecated. Signed-off-by: Jan Engelhardt --- extensions/libxt_hashlimit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'extensions/libxt_hashlimit.c') diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c index f63db64e..b05e8c8c 100644 --- a/extensions/libxt_hashlimit.c +++ b/extensions/libxt_hashlimit.c @@ -219,7 +219,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, case '%': xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit", *flags & PARAM_LIMIT); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!parse_rate(optarg, &r->cfg.avg)) exit_error(PARAMETER_PROBLEM, "bad rate `%s'", optarg); @@ -229,7 +229,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, case '$': xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-burst", *flags & PARAM_BURST); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, 10000)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-burst `%s'", optarg); @@ -239,7 +239,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, case '&': xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-size", *flags & PARAM_SIZE); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-size: `%s'", optarg); @@ -249,7 +249,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, case '*': xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-max", *flags & PARAM_MAX); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-max: `%s'", optarg); @@ -260,7 +260,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-gcinterval", *flags & PARAM_GCINTERVAL); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-gcinterval: `%s'", @@ -272,7 +272,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, case ')': xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-htable-expire", *flags & PARAM_EXPIRE); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (!xtables_strtoui(optarg, NULL, &num, 0, UINT32_MAX)) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-htable-expire: `%s'", optarg); @@ -283,7 +283,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, case '_': xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-mode", *flags & PARAM_MODE); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (parse_mode(&r->cfg.mode, optarg) < 0) exit_error(PARAMETER_PROBLEM, "bad --hashlimit-mode: `%s'\n", optarg); @@ -292,7 +292,7 @@ hashlimit_parse(int c, char **argv, int invert, unsigned int *flags, case '"': xtables_param_act(XTF_ONLY_ONCE, "hashlimit", "--hashlimit-name", *flags & PARAM_NAME); - if (check_inverse(argv[optind-1], &invert, &optind, 0)) break; + if (xtables_check_inverse(argv[optind-1], &invert, &optind, 0)) break; if (strlen(optarg) == 0) exit_error(PARAMETER_PROBLEM, "Zero-length name?"); strncpy(r->name, optarg, sizeof(r->name)); -- cgit v1.2.3