summaryrefslogtreecommitdiff
path: root/backport/backport-include/net/genetlink.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-10-16 21:48:21 +0200
committerJohannes Berg <johannes.berg@intel.com>2017-10-17 09:16:30 +0200
commit60f18ada41ef32e0554b4c7056d3868bcaa515be (patch)
treec9c41c392d051ac74a572636466047f01cf6f143 /backport/backport-include/net/genetlink.h
parentc6db471aace2344cf0c0afe2625106389fcf608d (diff)
backports: fully add netlink extack for generic netlink
The previous backport just made the code compatible, but removed the extack functionality entirely. By ignoring the setsockopt() and just assuming that userspace does in fact support extack (which is true for all of wifi and in fact all users of libnl), we can support full extack functionality even on kernels that don't support it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'backport/backport-include/net/genetlink.h')
-rw-r--r--backport/backport-include/net/genetlink.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/backport/backport-include/net/genetlink.h b/backport/backport-include/net/genetlink.h
index b655d243..65a4a4b2 100644
--- a/backport/backport-include/net/genetlink.h
+++ b/backport/backport-include/net/genetlink.h
@@ -23,10 +23,16 @@ static inline struct netlink_ext_ack *genl_info_extack(struct genl_info *info)
#if LINUX_VERSION_IS_GEQ(4,12,0)
return info->extack;
#else
- return NULL;
+ return info->userhdr;
#endif
}
+/* this gets put in place of info->userhdr, since we use that above */
+static inline void *genl_info_userhdr(struct genl_info *info)
+{
+ return (u8 *)info->genlhdr + GENL_HDRLEN;
+}
+
/* this is for patches we apply */
#if LINUX_VERSION_IS_LESS(3,7,0)
#define genl_info_snd_portid(__genl_info) (__genl_info->snd_pid)
@@ -202,4 +208,23 @@ static inline struct nlattr **genl_family_attrbuf(struct genl_family *family)
#define __genl_ro_after_init __ro_after_init
#endif
+#if LINUX_VERSION_IS_LESS(4,12,0)
+static inline int
+__real_bp_extack_genl_register_family(struct genl_family *family)
+{
+ return genl_register_family(family);
+}
+static inline int
+__real_bp_extack_genl_unregister_family(struct genl_family *family)
+{
+ return genl_unregister_family(family);
+}
+int bp_extack_genl_register_family(struct genl_family *family);
+int bp_extack_genl_unregister_family(struct genl_family *family);
+#undef genl_register_family
+#define genl_register_family bp_extack_genl_register_family
+#undef genl_unregister_family
+#define genl_unregister_family bp_extack_genl_unregister_family
+#endif
+
#endif /* __BACKPORT_NET_GENETLINK_H */