diff options
author | Jakub Kicinski <kuba@kernel.org> | 2020-10-06 01:07:38 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-10-06 16:25:55 +0300 |
commit | bdbb4e29df8b790db50cb73ce25d23543329f05f (patch) | |
tree | 78ff81363b9aec24e5199bf9082bcab104883209 /include/uapi/linux/netlink.h | |
parent | ddcf3b70c5ae8444e920d28e30e7ad4e866c8015 (diff) | |
download | linux-bdbb4e29df8b790db50cb73ce25d23543329f05f.tar.xz |
netlink: add mask validation
We don't have good validation policy for existing unsigned int attrs
which serve as flags (for new ones we could use NLA_BITFIELD32).
With increased use of policy dumping having the validation be
expressed as part of the policy is important. Add validation
policy in form of a mask of supported/valid bits.
Support u64 in the uAPI to be future-proof, but really for now
the embedded mask member can only hold 32 bits, so anything with
bit 32+ set will always fail validation.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/netlink.h')
-rw-r--r-- | include/uapi/linux/netlink.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index eac8a6a648ea..d02e472ba54c 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -331,6 +331,7 @@ enum netlink_attribute_type { * the index, if limited inside the nesting (U32) * @NL_POLICY_TYPE_ATTR_BITFIELD32_MASK: valid mask for the * bitfield32 type (U32) + * @NL_POLICY_TYPE_ATTR_MASK: mask of valid bits for unsigned integers (U64) * @NL_POLICY_TYPE_ATTR_PAD: pad attribute for 64-bit alignment */ enum netlink_policy_type_attr { @@ -346,6 +347,7 @@ enum netlink_policy_type_attr { NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE, NL_POLICY_TYPE_ATTR_BITFIELD32_MASK, NL_POLICY_TYPE_ATTR_PAD, + NL_POLICY_TYPE_ATTR_MASK, /* keep last */ __NL_POLICY_TYPE_ATTR_MAX, |