diff options
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 111 |
1 files changed, 51 insertions, 60 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b4f40fe84a01..d0afd82ebd77 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -5285,12 +5285,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
5285 | goto unlock; | 5285 | goto unlock; |
5286 | } | 5286 | } |
5287 | } else { | 5287 | } else { |
5288 | enum ieee80211_band band; | 5288 | n_channels = ieee80211_get_num_supported_channels(wiphy); |
5289 | n_channels = 0; | ||
5290 | |||
5291 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) | ||
5292 | if (wiphy->bands[band]) | ||
5293 | n_channels += wiphy->bands[band]->n_channels; | ||
5294 | } | 5289 | } |
5295 | 5290 | ||
5296 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) | 5291 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) |
@@ -5498,11 +5493,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
5498 | if (!n_channels) | 5493 | if (!n_channels) |
5499 | return -EINVAL; | 5494 | return -EINVAL; |
5500 | } else { | 5495 | } else { |
5501 | n_channels = 0; | 5496 | n_channels = ieee80211_get_num_supported_channels(wiphy); |
5502 | |||
5503 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) | ||
5504 | if (wiphy->bands[band]) | ||
5505 | n_channels += wiphy->bands[band]->n_channels; | ||
5506 | } | 5497 | } |
5507 | 5498 | ||
5508 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) | 5499 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) |
@@ -6795,6 +6786,55 @@ __cfg80211_alloc_vendor_skb(struct cfg80211_registered_device *rdev, | |||
6795 | return NULL; | 6786 | return NULL; |
6796 | } | 6787 | } |
6797 | 6788 | ||
6789 | struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, | ||
6790 | enum nl80211_commands cmd, | ||
6791 | enum nl80211_attrs attr, | ||
6792 | int vendor_event_idx, | ||
6793 | int approxlen, gfp_t gfp) | ||
6794 | { | ||
6795 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | ||
6796 | const struct nl80211_vendor_cmd_info *info; | ||
6797 | |||
6798 | switch (cmd) { | ||
6799 | case NL80211_CMD_TESTMODE: | ||
6800 | if (WARN_ON(vendor_event_idx != -1)) | ||
6801 | return NULL; | ||
6802 | info = NULL; | ||
6803 | break; | ||
6804 | case NL80211_CMD_VENDOR: | ||
6805 | if (WARN_ON(vendor_event_idx < 0 || | ||
6806 | vendor_event_idx >= wiphy->n_vendor_events)) | ||
6807 | return NULL; | ||
6808 | info = &wiphy->vendor_events[vendor_event_idx]; | ||
6809 | break; | ||
6810 | default: | ||
6811 | WARN_ON(1); | ||
6812 | return NULL; | ||
6813 | } | ||
6814 | |||
6815 | return __cfg80211_alloc_vendor_skb(rdev, approxlen, 0, 0, | ||
6816 | cmd, attr, info, gfp); | ||
6817 | } | ||
6818 | EXPORT_SYMBOL(__cfg80211_alloc_event_skb); | ||
6819 | |||
6820 | void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp) | ||
6821 | { | ||
6822 | struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; | ||
6823 | void *hdr = ((void **)skb->cb)[1]; | ||
6824 | struct nlattr *data = ((void **)skb->cb)[2]; | ||
6825 | enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; | ||
6826 | |||
6827 | nla_nest_end(skb, data); | ||
6828 | genlmsg_end(skb, hdr); | ||
6829 | |||
6830 | if (data->nla_type == NL80211_ATTR_VENDOR_DATA) | ||
6831 | mcgrp = NL80211_MCGRP_VENDOR; | ||
6832 | |||
6833 | genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), skb, 0, | ||
6834 | mcgrp, gfp); | ||
6835 | } | ||
6836 | EXPORT_SYMBOL(__cfg80211_send_event_skb); | ||
6837 | |||
6798 | #ifdef CONFIG_NL80211_TESTMODE | 6838 | #ifdef CONFIG_NL80211_TESTMODE |
6799 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) | 6839 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) |
6800 | { | 6840 | { |
@@ -6921,55 +6961,6 @@ static int nl80211_testmode_dump(struct sk_buff *skb, | |||
6921 | rtnl_unlock(); | 6961 | rtnl_unlock(); |
6922 | return err; | 6962 | return err; |
6923 | } | 6963 | } |
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 | 6964 | #endif |
6974 | 6965 | ||
6975 | static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | 6966 | static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) |