Skip to contentSkip to conversation

nl80211: Add generic netlink module alias for cfg80211/nl80211

PATCH Applied Marcel Holtmann 3 participants 4 messages Apr 28, 2013 – Apr 29, 2013 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nl80211: Add generic netlink module alias for cfg80211/nl80211

To support auto-loading of wireless modules from netlink users, add module alias for nl80211 family.

This also adds NL80211_GENL_NAME constant to define the "nl80211" netlink family name as part of uapi.

---
 include/uapi/linux/nl80211.h | 2 ++
 net/wireless/core.c          | 1 +
 net/wireless/nl80211.c       | 8 ++++----
 3 files changed, 7 insertions(+), 4 deletions(-)
include/uapi/linux/nl80211.h +2 -0
index d1e48b5..b573a55 100644
@@ -27,6 +27,8 @@
 
 #include <linux/types.h>
 
+#define NL80211_GENL_NAME "nl80211"
+
 /**
  * DOC: Station handling
  *
net/wireless/core.c +1 -0
index 84c9ad7..68f0c96 100644
@@ -34,6 +34,7 @@
 MODULE_AUTHOR("Johannes Berg");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("wireless configuration support");
+MODULE_ALIAS_GENL_FAMILY(NL80211_GENL_NAME);
 
 /* RCU-protected (and cfg80211_mutex for writers) */
 LIST_HEAD(cfg80211_rdev_list);
net/wireless/nl80211.c +4 -4
index afa2838..3c2da0a 100644
@@ -37,10 +37,10 @@ static void nl80211_post_doit(struct genl_ops *ops, struct sk_buff *skb,
 
 /* the netlink family */
 static struct genl_family nl80211_fam = {
-	.id = GENL_ID_GENERATE,	/* don't bother with a hardcoded ID */
-	.name = "nl80211",	/* have users key off the name instead */
-	.hdrsize = 0,		/* no private header */
-	.version = 1,		/* no particular meaning now */
+	.id = GENL_ID_GENERATE,		/* don't bother with a hardcoded ID */
+	.name = NL80211_GENL_NAME,	/* have users key off the name instead */
+	.hdrsize = 0,			/* no private header */
+	.version = 1,			/* no particular meaning now */
 	.maxattr = NL80211_ATTR_MAX,
 	.netnsok = true,
 	.pre_doit = nl80211_pre_doit,
Signature · 1 line
1.8.1.4
#1 lore raw

net/wireless/core.c line 37

Quoted 9 lines · Marcel Holtmann
net/wireless/core.c +1 -0
index 84c9ad7..68f0c96 100644
@@ -34,6 +34,7 @@
  MODULE_AUTHOR("Johannes Berg");
  MODULE_LICENSE("GPL");
  MODULE_DESCRIPTION("wireless configuration support");
+MODULE_ALIAS_GENL_FAMILY(NL80211_GENL_NAME);

Just being curious here (might learn something). What does this macro provide? Is it intended to help user-space tools identify the netlink API/family it provides?

net/wireless/core.c line 40

Quoted 2 lines
net/wireless/core.c +0 -0
  /* RCU-protected (and cfg80211_mutex for writers) */
  LIST_HEAD(cfg80211_rdev_list);

Regards,
Arend

#2 lore raw
Quoted 15 lines · Arend van Spriel

net/wireless/core.c line 37

Quoted 9 lines · Marcel Holtmann
net/wireless/core.c +1 -0
index 84c9ad7..68f0c96 100644
@@ -34,6 +34,7 @@
  MODULE_AUTHOR("Johannes Berg");
  MODULE_LICENSE("GPL");
  MODULE_DESCRIPTION("wireless configuration support");
+MODULE_ALIAS_GENL_FAMILY(NL80211_GENL_NAME);

Just being curious here (might learn something). What does this macro provide? Is it intended to help user-space tools identify the netlink API/family it provides?

Yikes, the answer is probably in the commit message:

"To support auto-loading of wireless modules from netlink users"

Sorry for the noise.

Gr. AvS

maintainer Applied
#3 lore raw
In reply to Marcel Holtmann
Quoted 5 lines · Marcel Holtmann

To support auto-loading of wireless modules from netlink users, add module alias for nl80211 family.

This also adds NL80211_GENL_NAME constant to define the "nl80211" netlink family name as part of uapi.

Applied, thanks.

johannes