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/session.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/session.c')
-rw-r--r-- | lib/session.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/session.c b/lib/session.c index 4cd6d30..b1c5f5e 100644 --- a/lib/session.c +++ b/lib/session.c @@ -817,8 +817,9 @@ list_adt(struct ipset_session *session, struct nlattr *nla[]) if (session->mode == IPSET_LIST_XML) safe_snprintf(session, "</elem>"); - for (arg = type->args[IPSET_ADD]; arg != NULL && arg->opt; arg++) { - D("print arg opt %u %s", arg->opt, + for (i = 0; type->cmd[IPSET_ADD].args[i] != IPSET_ARG_NONE; i++) { + arg = ipset_keyword(type->cmd[IPSET_ADD].args[i]); + D("print arg opt %u (%s) %s", arg->opt, arg->name[0], ipset_data_test(data, arg->opt) ? "(yes)" : "(missing)"); if (!(arg->print && ipset_data_test(data, arg->opt))) continue; @@ -905,7 +906,12 @@ list_create(struct ipset_session *session, struct nlattr *nla[]) break; } - for (arg = type->args[IPSET_CREATE]; arg != NULL && arg->opt; arg++) { + D("type %s, rev %u", type->name, type->revision); + for (i = 0; type->cmd[IPSET_CREATE].args[i] != IPSET_ARG_NONE; i++) { + arg = ipset_keyword(type->cmd[IPSET_CREATE].args[i]); + D("create print arg opt %u (%s) %s", arg->opt, + arg->name[0] ? arg->name[0] : "", + ipset_data_test(data, arg->opt) ? "(yes)" : "(missing)"); if (!arg->print || !ipset_data_test(data, arg->opt) || (arg->opt == IPSET_OPT_FAMILY && |