summaryrefslogtreecommitdiff
path: root/include/net/genetlink.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-08-25 20:09:32 -0700
committerPaolo Abeni <pabeni@redhat.com>2022-08-30 12:20:43 +0200
commit45dca15759643806660e9285e6af8a1ba3c76c82 (patch)
tree8103714a8db796c0ebe105ecb4fc9fd99c60bade /include/net/genetlink.h
parent690252f19f0e486abb8590b3a7a03d4e065d93d4 (diff)
netlink: add helpers for extack attr presence checking
Being able to check attribute presence and set extack if not on one line is handy, add helpers. Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net/genetlink.h')
-rw-r--r--include/net/genetlink.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index a4827b5e1e07..8f780170e2f8 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -110,6 +110,13 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
#define GENL_SET_ERR_MSG(info, msg) NL_SET_ERR_MSG((info)->extack, msg)
+/* Report that a root attribute is missing */
+#define GENL_REQ_ATTR_CHECK(info, attr) ({ \
+ struct genl_info *__info = (info); \
+ \
+ NL_REQ_ATTR_CHECK(__info->extack, NULL, __info->attrs, (attr)); \
+})
+
enum genl_validate_flags {
GENL_DONT_VALIDATE_STRICT = BIT(0),
GENL_DONT_VALIDATE_DUMP = BIT(1),