summaryrefslogtreecommitdiff
path: root/tools/net/ynl/lib/ynl.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-10-19 00:39:21 +0300
committerDavid S. Miller <davem@davemloft.net>2023-10-20 13:43:35 +0300
commit7d4caf54d2e8df2ed52240fe339adb13372c6251 (patch)
tree7551ed1e2bbdcf071275ec67142a156190dfcd3f /tools/net/ynl/lib/ynl.c
parent374d345d9b5e13380c66d7042f9533a6ac6d1195 (diff)
downloadlinux-7d4caf54d2e8df2ed52240fe339adb13372c6251.tar.xz
netlink: specs: add support for auto-sized scalars
Support uint / sint types in specs and YNL. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
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 514e0d69e731..350ddc247450 100644
--- a/tools/net/ynl/lib/ynl.c
+++ b/tools/net/ynl/lib/ynl.c
@@ -352,6 +352,12 @@ int ynl_attr_validate(struct ynl_parse_arg *yarg, const struct nlattr *attr)
yerr(yarg->ys, YNL_ERROR_ATTR_INVALID,
"Invalid attribute (u64 %s)", policy->name);
return -1;
+ case YNL_PT_UINT:
+ if (len == sizeof(__u32) || len == sizeof(__u64))
+ break;
+ yerr(yarg->ys, YNL_ERROR_ATTR_INVALID,
+ "Invalid attribute (uint %s)", policy->name);
+ return -1;
case YNL_PT_FLAG:
/* Let flags grow into real attrs, why not.. */
break;