diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-01-01 11:22:30 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-01-06 06:09:09 -0500 |
commit | e03ad6eade141daf0df07f1c312e8ae702327939 (patch) | |
tree | dd8e831c8f2d3745eaaebd3bb511599b0f5283ae /net/wireless | |
parent | 1b000789a4fe5f2013cc120a97d8c9b9c57b5431 (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.c | 98 |
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, | |||
6795 | return NULL; | 6795 | return NULL; |
6796 | } | 6796 | } |
6797 | 6797 | ||
6798 | struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, | ||
6799 | enum nl80211_commands cmd, | ||
6800 | enum nl80211_attrs attr, | ||
6801 | int vendor_event_idx, | ||
6802 | int approxlen, gfp_t gfp) | ||
6803 | { | ||
6804 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | ||
6805 | const struct nl80211_vendor_cmd_info *info; | ||
6806 | |||
6807 | switch (cmd) { | ||
6808 | case NL80211_CMD_TESTMODE: | ||
6809 | if (WARN_ON(vendor_event_idx != -1)) | ||
6810 | return NULL; | ||
6811 | info = NULL; | ||
6812 | break; | ||
6813 | case NL80211_CMD_VENDOR: | ||
6814 | if (WARN_ON(vendor_event_idx < 0 || | ||
6815 | vendor_event_idx >= wiphy->n_vendor_events)) | ||
6816 | return NULL; | ||
6817 | info = &wiphy->vendor_events[vendor_event_idx]; | ||
6818 | break; | ||
6819 | default: | ||
6820 | WARN_ON(1); | ||
6821 | return NULL; | ||
6822 | } | ||
6823 | |||
6824 | return __cfg80211_alloc_vendor_skb(rdev, approxlen, 0, 0, | ||
6825 | cmd, attr, info, gfp); | ||
6826 | } | ||
6827 | EXPORT_SYMBOL(__cfg80211_alloc_event_skb); | ||
6828 | |||
6829 | void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp) | ||
6830 | { | ||
6831 | struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; | ||
6832 | void *hdr = ((void **)skb->cb)[1]; | ||
6833 | struct nlattr *data = ((void **)skb->cb)[2]; | ||
6834 | enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; | ||
6835 | |||
6836 | nla_nest_end(skb, data); | ||
6837 | genlmsg_end(skb, hdr); | ||
6838 | |||
6839 | if (data->nla_type == NL80211_ATTR_VENDOR_DATA) | ||
6840 | mcgrp = NL80211_MCGRP_VENDOR; | ||
6841 | |||
6842 | genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), skb, 0, | ||
6843 | mcgrp, gfp); | ||
6844 | } | ||
6845 | EXPORT_SYMBOL(__cfg80211_send_event_skb); | ||
6846 | |||
6798 | #ifdef CONFIG_NL80211_TESTMODE | 6847 | #ifdef CONFIG_NL80211_TESTMODE |
6799 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) | 6848 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) |
6800 | { | 6849 | { |
@@ -6921,55 +6970,6 @@ static int nl80211_testmode_dump(struct sk_buff *skb, | |||
6921 | rtnl_unlock(); | 6970 | rtnl_unlock(); |
6922 | return err; | 6971 | return err; |
6923 | } | 6972 | } |
6924 | |||
6925 | struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, | ||
6926 | enum nl80211_commands cmd, | ||
6927 | enum nl80211_attrs attr, | ||
6928 | int vendor_event_idx, | ||
6929 | int approxlen, gfp_t gfp) | ||
6930 | { | ||
6931 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | ||
6932 | const struct nl80211_vendor_cmd_info *info; | ||
6933 | |||
6934 | switch (cmd) { | ||
6935 | case NL80211_CMD_TESTMODE: | ||
6936 | if (WARN_ON(vendor_event_idx != -1)) | ||
6937 | return NULL; | ||
6938 | info = NULL; | ||
6939 | break; | ||
6940 | case NL80211_CMD_VENDOR: | ||
6941 | if (WARN_ON(vendor_event_idx < 0 || | ||
6942 | vendor_event_idx >= wiphy->n_vendor_events)) | ||
6943 | return NULL; | ||
6944 | info = &wiphy->vendor_events[vendor_event_idx]; | ||
6945 | break; | ||
6946 | default: | ||
6947 | WARN_ON(1); | ||
6948 | return NULL; | ||
6949 | } | ||
6950 | |||
6951 | return __cfg80211_alloc_vendor_skb(rdev, approxlen, 0, 0, | ||
6952 | cmd, attr, info, gfp); | ||
6953 | } | ||
6954 | EXPORT_SYMBOL(__cfg80211_alloc_event_skb); | ||
6955 | |||
6956 | void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp) | ||
6957 | { | ||
6958 | struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; | ||
6959 | void *hdr = ((void **)skb->cb)[1]; | ||
6960 | struct nlattr *data = ((void **)skb->cb)[2]; | ||
6961 | enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; | ||
6962 | |||
6963 | nla_nest_end(skb, data); | ||
6964 | genlmsg_end(skb, hdr); | ||
6965 | |||
6966 | if (data->nla_type == NL80211_ATTR_VENDOR_DATA) | ||
6967 | mcgrp = NL80211_MCGRP_VENDOR; | ||
6968 | |||
6969 | genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), skb, 0, | ||
6970 | mcgrp, gfp); | ||
6971 | } | ||
6972 | EXPORT_SYMBOL(__cfg80211_send_event_skb); | ||
6973 | #endif | 6973 | #endif |
6974 | 6974 | ||
6975 | static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | 6975 | static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) |