diff options
author | Phil Sutter <phil@nwl.cc> | 2019-10-21 18:51:14 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2019-10-21 22:36:31 +0200 |
commit | 9fc71bc6b602c8706d1214e0100bcd7638c257e3 (patch) | |
tree | 202156a0aa736d8d31f313d324602b67b9d5ec49 /src/main.c | |
parent | e33b971f35cbfc3634dba9690537bbfb8baeac87 (diff) |
main: Fix for misleading error with negative chain priority
getopt_long() would try to parse the negative priority as an option and
return -1 as it is not known:
| # nft add chain x y { type filter hook input priority -30\; }
| nft: invalid option -- '3'
Fix this by prefixing optstring with a plus character. This instructs
getopt_long() to not collate arguments but just stop after the first
non-option, leaving the rest for manual handling. In fact, this is just
what nft desires: mixing options with nft syntax leads to confusive
command lines anyway.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -45,7 +45,7 @@ enum opt_vals { OPT_NUMERIC_TIME = 't', OPT_INVALID = '?', }; -#define OPTSTRING "hvcf:iI:jvnsNaeSupypt" +#define OPTSTRING "+hvcf:iI:jvnsNaeSupypt" static const struct option options[] = { { |