From 484efe6872e24727ff63fcb97047bf114524d743 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Thu, 10 May 2012 09:30:36 +0200 Subject: 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. --- lib/parse.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/parse.c') 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); -- cgit v1.2.3