From d71dd93599b932693f045301424c2276cd25a87e Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Mon, 9 Oct 2017 18:43:04 +0200 Subject: 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. --- lib/types.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/types.c') 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)) { -- cgit v1.2.3