]> git.ipfire.org Git - thirdparty/iproute2.git/commit
lib: utils: Introduce parse_one_of_deprecated()
authorPetr Machata <petrm@nvidia.com>
Wed, 22 Nov 2023 15:23:31 +0000 (16:23 +0100)
committerDavid Ahern <dsahern@kernel.org>
Wed, 22 Nov 2023 19:32:09 +0000 (19:32 +0000)
commit2b8766663d3cbca96d07b87d74e9000b80c2a988
tree0dd6076f07d57de08e4414ac37ecbe419cae084a
parent5ba57152d27c6d968392d745e32d3f5b5c74bf05
lib: utils: Introduce parse_one_of_deprecated()

The function parse_one_of() currently uses matches() for string comparison
under the hood. Extending matches()-based parsers is tricky, because newly
added matches might change the way strings are parsed, if the newly-added
string shares a prefix with a string that is matched later in the code.

In this patch, introduce a new function, parse_one_of_deprecated(). This
will be currently synonymous with parse_one_of(), however the latter will
change behavior in the next patch.

Use the new function for parsing of the macsec "validate" option. The
reason is that the valid strings for that option are "disabled", "check"
and "strict". It is not hard to see how "disabled" could be misspelled as
"disable", and be baked in some script in this form.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
include/utils.h
ip/ipmacsec.c
lib/utils.c