[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190321220504.7642-3-johannes@sipsolutions.net>
Date: Thu, 21 Mar 2019 23:05:00 +0100
From: Johannes Berg <johannes@...solutions.net>
To: netdev@...r.kernel.org
Cc: David Ahern <dsa@...ulusnetworks.com>,
Johannes Berg <johannes.berg@...el.com>
Subject: [RFC 2/6] genetlink: add genlmsg_parse_strict()
From: Johannes Berg <johannes.berg@...el.com>
Signed-off-by: Johannes Berg <johannes.berg@...el.com>
---
include/net/genetlink.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 6850c7b1a3a6..4a25c341244c 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -183,6 +183,25 @@ static inline int genlmsg_parse(const struct nlmsghdr *nlh,
policy, extack);
}
+/**
+ * genlmsg_parse_strict - strictly parse attributes of a genetlink message
+ * @nlh: netlink message header
+ * @family: genetlink message family
+ * @tb: destination array with maxtype+1 elements
+ * @maxtype: maximum attribute type to be expected
+ * @policy: validation policy
+ * @extack: extended ACK report struct
+ */
+static inline int genlmsg_parse_strict(const struct nlmsghdr *nlh,
+ const struct genl_family *family,
+ struct nlattr *tb[], int maxtype,
+ const struct nla_policy *policy,
+ struct netlink_ext_ack *extack)
+{
+ return nlmsg_parse_strict(nlh, family->hdrsize + GENL_HDRLEN, tb,
+ maxtype, policy, extack);
+}
+
/**
* genl_dump_check_consistent - check if sequence is consistent and advertise if not
* @cb: netlink callback structure that stores the sequence number
--
2.17.2
Powered by blists - more mailing lists