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/data.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lib/data.c') diff --git a/lib/data.c b/lib/data.c index 3bbb75b..d74be4d 100644 --- a/lib/data.c +++ b/lib/data.c @@ -166,7 +166,7 @@ do { \ * @data: data blob * @flags: the option flag to be ignored * - * Returns true if the option was not already ignored. + * Returns true if the option was already ignored. */ bool ipset_data_ignored(struct ipset_data *data, enum ipset_opt opt) @@ -180,6 +180,21 @@ ipset_data_ignored(struct ipset_data *data, enum ipset_opt opt) return ignored; } +/** + * ipset_data_test_ignored - test ignored bits in the data blob + * @data: data blob + * @flags: the option flag to be tested + * + * Returns true if the option is ignored. + */ +bool +ipset_data_test_ignored(struct ipset_data *data, enum ipset_opt opt) +{ + assert(data); + + return data->ignored & IPSET_FLAG(opt); +} + /** * ipset_data_set - put data into the data blob * @data: data blob @@ -208,6 +223,7 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value) break; case IPSET_OPT_FAMILY: data->family = *(const uint8_t *) value; + data->ignored &= ~IPSET_FLAG(IPSET_OPT_FAMILY); D("family set to %u", data->family); break; /* CADT options */ -- cgit v1.2.3