summaryrefslogtreecommitdiffstats
path: root/lib/data.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/data.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/data.c')
-rw-r--r--lib/data.c18
1 files changed, 17 insertions, 1 deletions
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)
@@ -181,6 +181,21 @@ ipset_data_ignored(struct ipset_data *data, enum ipset_opt opt)
}
/**
+ * 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
* @opt: the option kind of the data
@@ -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 */