aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/uapi/linux/genetlink.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2020-04-30 22:13:12 +0200
committerDavid S. Miller <davem@davemloft.net>2020-04-30 17:51:42 -0700
commitd07dcf9aadd6b2842b439e8668ff7ea2873f28d7 (patch)
tree65bead82c5e5ff278acbe657226f91c93a58019f /include/uapi/linux/genetlink.h
parentnetlink: factor out policy range helpers (diff)
downloadwireguard-linux-d07dcf9aadd6b2842b439e8668ff7ea2873f28d7.tar.xz
wireguard-linux-d07dcf9aadd6b2842b439e8668ff7ea2873f28d7.zip
netlink: add infrastructure to expose policies to userspace
Add, and use in generic netlink, helpers to dump out a netlink policy to userspace, including all the range validation data, nested policies etc. This lets userspace discover what the kernel understands. For families/commands other than generic netlink, the helpers need to be used directly in an appropriate command, or we can add some infrastructure (a new netlink family) that those can register their policies with for introspection. I'm not that familiar with non-generic netlink, so that's left out for now. The data exposed to userspace also includes min and max length for binary/string data, I've done that instead of letting the userspace tools figure out whether min/max is intended based on the type so that we can extend this later in the kernel, we might want to just use the range data for example. Because of this, I opted to not directly expose the NLA_* values, even if some of them are already exposed via BPF, as with min/max length we don't need to have different types here for NLA_BINARY/NLA_MIN_LEN/NLA_EXACT_LEN, we just make them all NL_ATTR_TYPE_BINARY with min/max length optionally set. Similarly, we don't really need NLA_MSECS, and perhaps can remove it in the future - but not if we encode it into the userspace API now. It gets mapped to NL_ATTR_TYPE_U64 here. Note that the exposing here corresponds to the strict policy interpretation, and NLA_UNSPEC items are omitted entirely. To get those, change them to NLA_MIN_LEN which behaves in exactly the same way, but is exposed. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/genetlink.h')
-rw-r--r--include/uapi/linux/genetlink.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h
index 877f7fa95466..9c0636ec2286 100644
--- a/include/uapi/linux/genetlink.h
+++ b/include/uapi/linux/genetlink.h
@@ -48,6 +48,7 @@ enum {
CTRL_CMD_NEWMCAST_GRP,
CTRL_CMD_DELMCAST_GRP,
CTRL_CMD_GETMCAST_GRP, /* unused */
+ CTRL_CMD_GETPOLICY,
__CTRL_CMD_MAX,
};
@@ -62,6 +63,7 @@ enum {
CTRL_ATTR_MAXATTR,
CTRL_ATTR_OPS,
CTRL_ATTR_MCAST_GROUPS,
+ CTRL_ATTR_POLICY,
__CTRL_ATTR_MAX,
};