From 54802b2c28265769c2dc1b126419ac673316eb64 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Mon, 11 Sep 2017 20:07:40 +0200 Subject: 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. --- lib/types.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib') diff --git a/lib/types.c b/lib/types.c index f303ea6..0fe8a7c 100644 --- a/lib/types.c +++ b/lib/types.c @@ -415,6 +415,30 @@ ipset_type_get(struct ipset_session *session, enum ipset_cmd cmd) return NULL; } +/** + * 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 -- cgit v1.2.3