aboutsummaryrefslogtreecommitdiff
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorGravatar Johannes Berg <johannes.berg@intel.com> 2020-10-08 12:45:17 +0200
committerGravatar Jakub Kicinski <kuba@kernel.org> 2020-10-09 20:22:32 -0700
commit44f3625bc61653ea3bde9960298faf2f5518fda5 (patch)
treee36d5d8e5795a8992618cc2f756c5bc38d977434 /include/uapi/linux
parentnetlink: policy: refactor per-attr policy writing (diff)
downloadlinux-44f3625bc61653ea3bde9960298faf2f5518fda5.tar.gz
linux-44f3625bc61653ea3bde9960298faf2f5518fda5.tar.bz2
linux-44f3625bc61653ea3bde9960298faf2f5518fda5.zip
netlink: export policy in extended ACK
Add a new attribute NLMSGERR_ATTR_POLICY to the extended ACK to advertise the policy, e.g. if an attribute was out of range, you'll know the range that's permissible. Add new NL_SET_ERR_MSG_ATTR_POL() and NL_SET_ERR_MSG_ATTR_POL() macros to set this, since realistically it's only useful to do this when the bad attribute (offset) is also returned. Use it in lib/nlattr.c which practically does all the policy validation. v2: - add and use netlink_policy_dump_attr_size_estimate() v3: - remove redundant break v4: - really remove redundant break ... sorry Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/netlink.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index d02e472ba54c..c3816ff7bfc3 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -129,6 +129,7 @@ struct nlmsgerr {
* @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to
* be used - in the success case - to identify a created
* object or operation or similar (binary)
+ * @NLMSGERR_ATTR_POLICY: policy for a rejected attribute
* @__NLMSGERR_ATTR_MAX: number of attributes
* @NLMSGERR_ATTR_MAX: highest attribute number
*/
@@ -137,6 +138,7 @@ enum nlmsgerr_attrs {
NLMSGERR_ATTR_MSG,
NLMSGERR_ATTR_OFFS,
NLMSGERR_ATTR_COOKIE,
+ NLMSGERR_ATTR_POLICY,
__NLMSGERR_ATTR_MAX,
NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1