|
|
268297 |
From 536adfb31d821ad19fd823e56dec5e384ed5588c Mon Sep 17 00:00:00 2001
|
|
|
268297 |
From: Michal Kubecek <mkubecek@suse.cz>
|
|
|
268297 |
Date: Mon, 19 Oct 2020 23:32:46 +0200
|
|
|
268297 |
Subject: [PATCH 36/37] netlink: add descriptions for genetlink policy dumps
|
|
|
268297 |
|
|
|
268297 |
Add GENL_ID_CTRL message descriptions for messages and attributes used
|
|
|
268297 |
for policy dumps.
|
|
|
268297 |
|
|
|
268297 |
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
|
|
|
268297 |
(cherry picked from commit e88f3127a007e07d81cc30c2ac9a3e752d66c0af)
|
|
|
268297 |
---
|
|
|
268297 |
netlink/desc-genlctrl.c | 57 +++++++++++++++++++++++++++++++++++++++++
|
|
|
268297 |
1 file changed, 57 insertions(+)
|
|
|
268297 |
|
|
|
268297 |
diff --git a/netlink/desc-genlctrl.c b/netlink/desc-genlctrl.c
|
|
|
268297 |
index 9840179b0a1a..43b41ab395b8 100644
|
|
|
268297 |
--- a/netlink/desc-genlctrl.c
|
|
|
268297 |
+++ b/netlink/desc-genlctrl.c
|
|
|
268297 |
@@ -29,6 +29,59 @@ static const struct pretty_nla_desc __mcgrps_desc[] = {
|
|
|
268297 |
NLATTR_DESC_NESTED(0, mcgrp),
|
|
|
268297 |
};
|
|
|
268297 |
|
|
|
268297 |
+static const char *__policy_attr_type_names[] = {
|
|
|
268297 |
+ [NL_ATTR_TYPE_INVALID] = "NL_ATTR_TYPE_INVALID",
|
|
|
268297 |
+ [NL_ATTR_TYPE_FLAG] = "NL_ATTR_TYPE_FLAG",
|
|
|
268297 |
+ [NL_ATTR_TYPE_U8] = "NL_ATTR_TYPE_U8",
|
|
|
268297 |
+ [NL_ATTR_TYPE_U16] = "NL_ATTR_TYPE_U16",
|
|
|
268297 |
+ [NL_ATTR_TYPE_U32] = "NL_ATTR_TYPE_U32",
|
|
|
268297 |
+ [NL_ATTR_TYPE_U64] = "NL_ATTR_TYPE_U64",
|
|
|
268297 |
+ [NL_ATTR_TYPE_S8] = "NL_ATTR_TYPE_S8",
|
|
|
268297 |
+ [NL_ATTR_TYPE_S16] = "NL_ATTR_TYPE_S16",
|
|
|
268297 |
+ [NL_ATTR_TYPE_S32] = "NL_ATTR_TYPE_S32",
|
|
|
268297 |
+ [NL_ATTR_TYPE_S64] = "NL_ATTR_TYPE_S64",
|
|
|
268297 |
+ [NL_ATTR_TYPE_BINARY] = "NL_ATTR_TYPE_BINARY",
|
|
|
268297 |
+ [NL_ATTR_TYPE_STRING] = "NL_ATTR_TYPE_STRING",
|
|
|
268297 |
+ [NL_ATTR_TYPE_NUL_STRING] = "NL_ATTR_TYPE_NUL_STRING",
|
|
|
268297 |
+ [NL_ATTR_TYPE_NESTED] = "NL_ATTR_TYPE_NESTED",
|
|
|
268297 |
+ [NL_ATTR_TYPE_NESTED_ARRAY] = "NL_ATTR_TYPE_NESTED_ARRAY",
|
|
|
268297 |
+ [NL_ATTR_TYPE_BITFIELD32] = "NL_ATTR_TYPE_BITFIELD32",
|
|
|
268297 |
+};
|
|
|
268297 |
+
|
|
|
268297 |
+static const struct pretty_nla_desc __policy_attr_desc[] = {
|
|
|
268297 |
+ NLATTR_DESC_INVALID(NL_POLICY_TYPE_ATTR_UNSPEC),
|
|
|
268297 |
+ NLATTR_DESC_U32_ENUM(NL_POLICY_TYPE_ATTR_TYPE, policy_attr_type),
|
|
|
268297 |
+ NLATTR_DESC_S64(NL_POLICY_TYPE_ATTR_MIN_VALUE_S),
|
|
|
268297 |
+ NLATTR_DESC_S64(NL_POLICY_TYPE_ATTR_MAX_VALUE_S),
|
|
|
268297 |
+ NLATTR_DESC_U64(NL_POLICY_TYPE_ATTR_MIN_VALUE_U),
|
|
|
268297 |
+ NLATTR_DESC_U64(NL_POLICY_TYPE_ATTR_MAX_VALUE_U),
|
|
|
268297 |
+ NLATTR_DESC_U32(NL_POLICY_TYPE_ATTR_MIN_LENGTH),
|
|
|
268297 |
+ NLATTR_DESC_U32(NL_POLICY_TYPE_ATTR_MAX_LENGTH),
|
|
|
268297 |
+ NLATTR_DESC_U32(NL_POLICY_TYPE_ATTR_POLICY_IDX),
|
|
|
268297 |
+ NLATTR_DESC_U32(NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE),
|
|
|
268297 |
+ NLATTR_DESC_X32(NL_POLICY_TYPE_ATTR_BITFIELD32_MASK),
|
|
|
268297 |
+ NLATTR_DESC_X64(NL_POLICY_TYPE_ATTR_PAD),
|
|
|
268297 |
+ NLATTR_DESC_BINARY(NL_POLICY_TYPE_ATTR_MASK),
|
|
|
268297 |
+};
|
|
|
268297 |
+
|
|
|
268297 |
+static const struct pretty_nla_desc __policy_attrs_desc[] = {
|
|
|
268297 |
+ NLATTR_DESC_NESTED(0, policy_attr),
|
|
|
268297 |
+};
|
|
|
268297 |
+
|
|
|
268297 |
+static const struct pretty_nla_desc __policies_desc[] = {
|
|
|
268297 |
+ NLATTR_DESC_ARRAY(0, policy_attrs),
|
|
|
268297 |
+};
|
|
|
268297 |
+
|
|
|
268297 |
+static const struct pretty_nla_desc __op_policy_desc[] = {
|
|
|
268297 |
+ NLATTR_DESC_INVALID(CTRL_ATTR_POLICY_UNSPEC),
|
|
|
268297 |
+ NLATTR_DESC_U32(CTRL_ATTR_POLICY_DO),
|
|
|
268297 |
+ NLATTR_DESC_U32(CTRL_ATTR_POLICY_DUMP),
|
|
|
268297 |
+};
|
|
|
268297 |
+
|
|
|
268297 |
+static const struct pretty_nla_desc __op_policies_desc[] = {
|
|
|
268297 |
+ NLATTR_DESC_NESTED(0, op_policy),
|
|
|
268297 |
+};
|
|
|
268297 |
+
|
|
|
268297 |
static const struct pretty_nla_desc __attr_desc[] = {
|
|
|
268297 |
NLATTR_DESC_INVALID(CTRL_ATTR_UNSPEC),
|
|
|
268297 |
NLATTR_DESC_U16(CTRL_ATTR_FAMILY_ID),
|
|
|
268297 |
@@ -38,6 +91,9 @@ static const struct pretty_nla_desc __attr_desc[] = {
|
|
|
268297 |
NLATTR_DESC_U32(CTRL_ATTR_MAXATTR),
|
|
|
268297 |
NLATTR_DESC_ARRAY(CTRL_ATTR_OPS, attrops),
|
|
|
268297 |
NLATTR_DESC_ARRAY(CTRL_ATTR_MCAST_GROUPS, mcgrps),
|
|
|
268297 |
+ NLATTR_DESC_ARRAY(CTRL_ATTR_POLICY, policies),
|
|
|
268297 |
+ NLATTR_DESC_ARRAY(CTRL_ATTR_OP_POLICY, op_policies),
|
|
|
268297 |
+ NLATTR_DESC_U32(CTRL_ATTR_OP),
|
|
|
268297 |
};
|
|
|
268297 |
|
|
|
268297 |
const struct pretty_nlmsg_desc genlctrl_msg_desc[] = {
|
|
|
268297 |
@@ -51,6 +107,7 @@ const struct pretty_nlmsg_desc genlctrl_msg_desc[] = {
|
|
|
268297 |
NLMSG_DESC(CTRL_CMD_NEWMCAST_GRP, attr),
|
|
|
268297 |
NLMSG_DESC(CTRL_CMD_DELMCAST_GRP, attr),
|
|
|
268297 |
NLMSG_DESC(CTRL_CMD_GETMCAST_GRP, attr),
|
|
|
268297 |
+ NLMSG_DESC(CTRL_CMD_GETPOLICY, attr),
|
|
|
268297 |
};
|
|
|
268297 |
|
|
|
268297 |
const unsigned int genlctrl_msg_n_desc = ARRAY_SIZE(genlctrl_msg_desc);
|
|
|
268297 |
--
|
|
|
268297 |
2.26.2
|
|
|
268297 |
|