diff options
author | Phil Oester <kernel@linuxace.com> | 2004-08-23 20:45:17 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2004-08-23 20:45:17 +0000 |
commit | 7defa34947c015cf8f8ea40dd29be5cedc9e73cd (patch) | |
tree | a5c5a49ef03fb195939d07240214ece67ea7d1fc /extensions | |
parent | 811b040b4d9fbf98e6206e8200caa6825210d3a9 (diff) |
Cleanup ttl-match option parsing, fixes bugzilla #183 (Phil Oester)
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/libipt_ttl.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/extensions/libipt_ttl.c b/extensions/libipt_ttl.c index 799cc561..523c8550 100644 --- a/extensions/libipt_ttl.c +++ b/extensions/libipt_ttl.c @@ -1,7 +1,7 @@ /* Shared library add-on to iptables to add TTL matching support * (C) 2000 by Harald Welte <laforge@gnumonks.org> * - * $Id: libipt_ttl.c,v 1.5 2002/03/14 11:35:58 laforge Exp $ + * $Id: libipt_ttl.c,v 1.6 2002/05/29 13:08:16 laforge Exp $ * * This program is released under the terms of GNU GPL */ @@ -40,10 +40,6 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, check_inverse(optarg, &invert, &optind, 0); value = atoi(argv[optind-1]); - if (*flags) - exit_error(PARAMETER_PROBLEM, - "Can't specify TTL option twice"); - if (!optarg) exit_error(PARAMETER_PROBLEM, "ttl: You must specify a value"); @@ -56,8 +52,6 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, /* is 0 allowed? */ info->ttl = value; - *flags = 1; - break; case '3': if (invert) @@ -66,8 +60,6 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, info->mode = IPT_TTL_LT; info->ttl = value; - *flags = 1; - break; case '4': if (invert) @@ -76,14 +68,17 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, info->mode = IPT_TTL_GT; info->ttl = value; - *flags = 1; - break; default: return 0; } + if (*flags) + exit_error(PARAMETER_PROBLEM, + "Can't specify TTL option twice"); + *flags = 1; + return 1; } |