summaryrefslogtreecommitdiff
path: root/tools/net/ynl/lib/ynl.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2023-10-21 13:27:03 +0200
committerJakub Kicinski <kuba@kernel.org>2023-10-23 16:12:46 -0700
commit4e2846fd6684227c8f8129ec184fbf090279216d (patch)
treeaa708e34b4209be534c0aa885a5b93480f7a22aa /tools/net/ynl/lib/ynl.c
parentf862ed2d0bf0cf51c28c1a69e3c2a1558d5a2978 (diff)
tools: ynl-gen: introduce support for bitfield32 attribute type
Introduce support for attribute type bitfield32. Note that since the generated code works with struct nla_bitfield32, the generator adds netlink.h to the list of includes for userspace headers in case any bitfield32 is present. Note that this is added only to genetlink-legacy scheme as requested by Jakub Kicinski. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://lore.kernel.org/r/20231021112711.660606-3-jiri@resnulli.us Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net/ynl/lib/ynl.c')
-rw-r--r--tools/net/ynl/lib/ynl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c
index 350ddc247450..830d25097009 100644
--- a/tools/net/ynl/lib/ynl.c
+++ b/tools/net/ynl/lib/ynl.c
@@ -379,6 +379,12 @@ int ynl_attr_validate(struct ynl_parse_arg *yarg, const struct nlattr *attr)
yerr(yarg->ys, YNL_ERROR_ATTR_INVALID,
"Invalid attribute (string %s)", policy->name);
return -1;
+ case YNL_PT_BITFIELD32:
+ if (len == sizeof(struct nla_bitfield32))
+ break;
+ yerr(yarg->ys, YNL_ERROR_ATTR_INVALID,
+ "Invalid attribute (bitfield32 %s)", policy->name);
+ return -1;
default:
yerr(yarg->ys, YNL_ERROR_ATTR_INVALID,
"Invalid attribute (unknown %s)", policy->name);