X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=extensions%2Flibip6t_HL.c;h=206282807468e114c5b27bcf89d378465f9fd40c;hb=6afea0b41dfbc3824956d11d960ad80097218feb;hp=7c249152c9303f10a3ba91dc6e42cdc754fda8b8;hpb=f7b70cf9e00324b89b02de213bcd0dde7044d035;p=iptables.git diff --git a/extensions/libip6t_HL.c b/extensions/libip6t_HL.c index 7c24915..2062828 100644 --- a/extensions/libip6t_HL.c +++ b/extensions/libip6t_HL.c @@ -24,9 +24,9 @@ static void help(void) { printf( "HL target v%s options\n" -" --hl-set value Set HL to \n" -" --hl-dec value Decrement HL by \n" -" --hl-inc value Increment HL by \n" +" --hl-set value Set HL to \n" +" --hl-dec value Decrement HL by \n" +" --hl-inc value Increment HL by \n" , IPTABLES_VERSION); } @@ -35,7 +35,7 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, struct ip6t_entry_target **target) { struct ip6t_HL_info *info = (struct ip6t_HL_info *) (*target)->data; - u_int8_t value; + unsigned int value; if (*flags & IP6T_HL_USED) { exit_error(PARAMETER_PROBLEM, @@ -50,7 +50,9 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "HL: unexpected `!'"); - value = atoi(optarg); + if (string_to_number(optarg, 0, 255, &value) == -1) + exit_error(PARAMETER_PROBLEM, + "HL: Expected value between 0 and 255"); switch (c) { @@ -145,17 +147,17 @@ static struct option opts[] = { static struct ip6tables_target HL = { NULL, - "HL", - IPTABLES_VERSION, - IP6T_ALIGN(sizeof(struct ip6t_HL_info)), - IP6T_ALIGN(sizeof(struct ip6t_HL_info)), - &help, - &init, - &parse, - &final_check, - &print, - &save, - opts + .name = "HL", + .version = IPTABLES_VERSION, + .size = IP6T_ALIGN(sizeof(struct ip6t_HL_info)), + .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_HL_info)), + .help = &help, + .init = &init, + .parse = &parse, + .final_check = &final_check, + .print = &print, + .save = &save, + .extra_opts = opts }; void _init(void)