diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2017-10-09 18:43:04 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2018-01-02 21:47:27 +0100 |
commit | d71dd93599b932693f045301424c2276cd25a87e (patch) | |
tree | d1779c04b8bb2a44915483751ac33e498b1a2ad9 /lib/types.c | |
parent | e2a84a4a7bb8cdebfe4c0990b79179e2fd717a48 (diff) |
Userspace revision handling is reworked
In order to make it simpler and more straightforward to express
the revisions of the set type, all keywords and their parsing
are separated from the individual set types.
All backward compatibility arguments are recognized and ignored
arguments are supported.
Recognized but ignored arguments will be removed in a later release.
Diffstat (limited to 'lib/types.c')
-rw-r--r-- | lib/types.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/types.c b/lib/types.c index 0fe8a7c..1adf640 100644 --- a/lib/types.c +++ b/lib/types.c @@ -497,12 +497,21 @@ int ipset_type_add(struct ipset_type *type) { struct ipset_type *t, *prev; + const struct ipset_arg *arg; + enum ipset_adt cmd; + int i; assert(type); if (strlen(type->name) > IPSET_MAXNAMELEN - 1) return -EINVAL; + for (cmd = IPSET_ADD; cmd < IPSET_CADT_MAX; cmd++) { + for (i = 0; type->cmd[cmd].args[i] != IPSET_ARG_NONE; i++) { + arg = ipset_keyword(type->cmd[cmd].args[i]); + type->cmd[cmd].full |= IPSET_FLAG(arg->opt); + } + } /* Add to the list: higher revision numbers first */ for (t = typelist, prev = NULL; t != NULL; t = t->next) { if (STREQ(t->name, type->name)) { |