diff options
Diffstat (limited to 'lib/types.c')
-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 * |