aboutsummaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg2014-01-01 17:22:30 +0100
committerJohannes Berg2014-01-06 12:09:09 +0100
commite03ad6eade141daf0df07f1c312e8ae702327939 (patch)
treedd8e831c8f2d3745eaaebd3bb511599b0f5283ae /net/wireless
parent1b000789a4fe5f2013cc120a97d8c9b9c57b5431 (diff)
nl80211: move vendor/testmode event skb functions out of ifdef
The vendor/testmode event skb functions are needed outside the ifdef for vendor-specific events, so move them out. Reported-by: Jouni Malinen <j@w1.fi> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b4f40fe84a01..20857126f742 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6795,6 +6795,55 @@ __cfg80211_alloc_vendor_skb(struct cfg80211_registered_device *rdev,
return NULL;
}
+struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
+ enum nl80211_commands cmd,
+ enum nl80211_attrs attr,
+ int vendor_event_idx,
+ int approxlen, gfp_t gfp)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+ const struct nl80211_vendor_cmd_info *info;
+
+ switch (cmd) {
+ case NL80211_CMD_TESTMODE:
+ if (WARN_ON(vendor_event_idx != -1))
+ return NULL;
+ info = NULL;
+ break;
+ case NL80211_CMD_VENDOR:
+ if (WARN_ON(vendor_event_idx < 0 ||
+ vendor_event_idx >= wiphy->n_vendor_events))
+ return NULL;
+ info = &wiphy->vendor_events[vendor_event_idx];
+ break;
+ default:
+ WARN_ON(1);
+ return NULL;
+ }
+
+ return __cfg80211_alloc_vendor_skb(rdev, approxlen, 0, 0,
+ cmd, attr, info, gfp);
+}
+EXPORT_SYMBOL(__cfg80211_alloc_event_skb);
+
+void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp)
+{
+ struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0];
+ void *hdr = ((void **)skb->cb)[1];
+ struct nlattr *data = ((void **)skb->cb)[2];
+ enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE;
+
+ nla_nest_end(skb, data);
+ genlmsg_end(skb, hdr);
+
+ if (data->nla_type == NL80211_ATTR_VENDOR_DATA)
+ mcgrp = NL80211_MCGRP_VENDOR;
+
+ genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), skb, 0,
+ mcgrp, gfp);
+}
+EXPORT_SYMBOL(__cfg80211_send_event_skb);
+
#ifdef CONFIG_NL80211_TESTMODE
static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info)
{
@@ -6921,55 +6970,6 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
rtnl_unlock();
return err;
}
-
-struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
- enum nl80211_commands cmd,
- enum nl80211_attrs attr,
- int vendor_event_idx,
- int approxlen, gfp_t gfp)
-{
- struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
- const struct nl80211_vendor_cmd_info *info;
-
- switch (cmd) {
- case NL80211_CMD_TESTMODE:
- if (WARN_ON(vendor_event_idx != -1))
- return NULL;
- info = NULL;
- break;
- case NL80211_CMD_VENDOR:
- if (WARN_ON(vendor_event_idx < 0 ||
- vendor_event_idx >= wiphy->n_vendor_events))
- return NULL;
- info = &wiphy->vendor_events[vendor_event_idx];
- break;
- default:
- WARN_ON(1);
- return NULL;
- }
-
- return __cfg80211_alloc_vendor_skb(rdev, approxlen, 0, 0,
- cmd, attr, info, gfp);
-}
-EXPORT_SYMBOL(__cfg80211_alloc_event_skb);
-
-void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp)
-{
- struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0];
- void *hdr = ((void **)skb->cb)[1];
- struct nlattr *data = ((void **)skb->cb)[2];
- enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE;
-
- nla_nest_end(skb, data);
- genlmsg_end(skb, hdr);
-
- if (data->nla_type == NL80211_ATTR_VENDOR_DATA)
- mcgrp = NL80211_MCGRP_VENDOR;
-
- genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), skb, 0,
- mcgrp, gfp);
-}
-EXPORT_SYMBOL(__cfg80211_send_event_skb);
#endif
static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)