nl80211: move vendor/testmode event skb functions out of ifdef
authorJohannes Berg <johannes.berg@intel.com>
Wed, 1 Jan 2014 16:22:30 +0000 (17:22 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 6 Jan 2014 11:09:09 +0000 (12:09 +0100)
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>
net/wireless/nl80211.c

index b4f40fe..2085712 100644 (file)
@@ -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)