summaryrefslogtreecommitdiffstats
path: root/lib/parse.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-05-10 09:30:36 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-05-10 09:30:36 +0200
commit484efe6872e24727ff63fcb97047bf114524d743 (patch)
treef371b26d789076922c038244e22e99a1c67640fa /lib/parse.c
parent69019ebd47cb2329273571decda625f0a1cf74cb (diff)
Suppress false syntax error messages
If a create command fails at the kernel side, false syntax error was also reported due to the chicken and egg problem of the family option.
Diffstat (limited to 'lib/parse.c')
-rw-r--r--lib/parse.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/parse.c b/lib/parse.c
index 45937f0..afbbbf9 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -651,7 +651,8 @@ ipset_parse_family(struct ipset_session *session,
assert(str);
data = ipset_session_data(session);
- if (ipset_data_flags_test(data, IPSET_FLAG(IPSET_OPT_FAMILY)))
+ if (ipset_data_flags_test(data, IPSET_FLAG(IPSET_OPT_FAMILY))
+ && !ipset_data_test_ignored(data, IPSET_OPT_FAMILY))
syntax_err("protocol family may not be specified "
"multiple times");
@@ -1637,8 +1638,11 @@ ipset_call_parser(struct ipset_session *session,
const struct ipset_arg *arg,
const char *str)
{
- if (ipset_data_flags_test(ipset_session_data(session),
- IPSET_FLAG(arg->opt)))
+ struct ipset_data *data = ipset_session_data(session);
+
+ if (ipset_data_flags_test(data, IPSET_FLAG(arg->opt))
+ && !(arg->opt == IPSET_OPT_FAMILY
+ && ipset_data_test_ignored(data, IPSET_OPT_FAMILY)))
syntax_err("%s already specified", arg->name[0]);
return arg->parse(session, arg->opt, str);