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/libip6t_icmp6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'extensions/libip6t_icmp6.c') diff --git a/extensions/libip6t_icmp6.c b/extensions/libip6t_icmp6.c index b87538f9..17567dfb 100644 --- a/extensions/libip6t_icmp6.c +++ b/extensions/libip6t_icmp6.c @@ -123,12 +123,12 @@ parse_icmpv6(const char *icmpv6type, u_int8_t *type, u_int8_t code[]) if (slash) *slash = '\0'; - if (string_to_number(buffer, 0, 255, &number) == -1) + if (string_to_number(buffer, 0, UINT8_MAX, &number) == -1) exit_error(PARAMETER_PROBLEM, "Invalid ICMPv6 type `%s'\n", buffer); *type = number; if (slash) { - if (string_to_number(slash+1, 0, 255, &number) == -1) + if (string_to_number(slash+1, 0, UINT8_MAX, &number) == -1) exit_error(PARAMETER_PROBLEM, "Invalid ICMPv6 code `%s'\n", slash+1); -- 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/libip6t_icmp6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'extensions/libip6t_icmp6.c') diff --git a/extensions/libip6t_icmp6.c b/extensions/libip6t_icmp6.c index 17567dfb..401c2780 100644 --- a/extensions/libip6t_icmp6.c +++ b/extensions/libip6t_icmp6.c @@ -123,12 +123,12 @@ parse_icmpv6(const char *icmpv6type, u_int8_t *type, u_int8_t code[]) if (slash) *slash = '\0'; - if (string_to_number(buffer, 0, UINT8_MAX, &number) == -1) + if (!xtables_strtoui(buffer, NULL, &number, 0, UINT8_MAX)) exit_error(PARAMETER_PROBLEM, "Invalid ICMPv6 type `%s'\n", buffer); *type = number; if (slash) { - if (string_to_number(slash+1, 0, UINT8_MAX, &number) == -1) + if (!xtables_strtoui(slash+1, NULL, &number, 0, UINT8_MAX)) exit_error(PARAMETER_PROBLEM, "Invalid ICMPv6 code `%s'\n", slash+1); -- 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/libip6t_icmp6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extensions/libip6t_icmp6.c') diff --git a/extensions/libip6t_icmp6.c b/extensions/libip6t_icmp6.c index 401c2780..5af9b02e 100644 --- a/extensions/libip6t_icmp6.c +++ b/extensions/libip6t_icmp6.c @@ -157,7 +157,7 @@ static int icmp6_parse(int c, char **argv, int invert, unsigned int *flags, if (*flags == 1) exit_error(PARAMETER_PROBLEM, "icmpv6 match: only use --icmpv6-type once!"); - check_inverse(optarg, &invert, &optind, 0); + xtables_check_inverse(optarg, &invert, &optind, 0); parse_icmpv6(argv[optind-1], &icmpv6info->type, icmpv6info->code); if (invert) -- cgit v1.2.3