diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2017-09-11 20:07:40 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2017-09-11 20:07:40 +0200 |
commit | 54802b2c28265769c2dc1b126419ac673316eb64 (patch) | |
tree | ff70d73320bf90e677172ef4f1b9121bd7410144 /lib | |
parent | 9ccbd1c6464cf62ad5531fd1a473703f4f472840 (diff) |
Report if the option is supported by a newer kernel release
Instead ot printing "Unknown argument: foo", if foo option is
supported by a newer kernel release, report that.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/types.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/types.c b/lib/types.c index f303ea6..0fe8a7c 100644 --- a/lib/types.c +++ b/lib/types.c @@ -416,6 +416,30 @@ ipset_type_get(struct ipset_session *session, enum ipset_cmd cmd) } /** + * ipset_type_higher_rev - find the next higher userspace revision + * @type: set type + * + * Find the next higher revision of the set type for the input + * set type. Higher revision numbers come first on typelist. + * + * Returns the found or original set type, cannot fail. + */ +const struct ipset_type * +ipset_type_higher_rev(const struct ipset_type *type) +{ + const struct ipset_type *t; + + /* Check all registered types in userspace */ + for (t = typelist; t != NULL; t = t->next) { + if (STREQ(type->name, t->name) + && type->family == t->family + && type == t->next) + return t; + } + return type; +} + +/** * ipset_type_check - check the set type received from kernel * @session: session structure * |