diff options
author | Luciano Coelho <luciano.coelho@intel.com> | 2015-01-09 07:06:37 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-01-14 03:45:17 -0500 |
commit | 75453ccb61120885d6715a49496c57930dbe6253 (patch) | |
tree | cbf08696ee37a2290daec51072555174c42b98fd /net/wireless | |
parent | ef51fb1d1cd54ae9e0b0efd3b9bdb561fe5483a0 (diff) |
nl80211: send netdetect configuration info in NL80211_CMD_GET_WOWLAN
Send the netdetect configuration information in the response to
NL8021_CMD_GET_WOWLAN commands. This includes the scan interval,
SSIDs to match and frequencies to scan.
Additionally, add the NL80211_WOWLAN_TRIG_NET_DETECT with
NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7c2ce26e22de..380784378df8 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1088,6 +1088,11 @@ static int nl80211_send_wowlan(struct sk_buff *msg, | |||
1088 | return -ENOBUFS; | 1088 | return -ENOBUFS; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | if ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_NET_DETECT) && | ||
1092 | nla_put_u32(msg, NL80211_WOWLAN_TRIG_NET_DETECT, | ||
1093 | rdev->wiphy.wowlan->max_nd_match_sets)) | ||
1094 | return -ENOBUFS; | ||
1095 | |||
1091 | if (large && nl80211_send_wowlan_tcp_caps(rdev, msg)) | 1096 | if (large && nl80211_send_wowlan_tcp_caps(rdev, msg)) |
1092 | return -ENOBUFS; | 1097 | return -ENOBUFS; |
1093 | 1098 | ||
@@ -8747,6 +8752,48 @@ static int nl80211_send_wowlan_tcp(struct sk_buff *msg, | |||
8747 | return 0; | 8752 | return 0; |
8748 | } | 8753 | } |
8749 | 8754 | ||
8755 | static int nl80211_send_wowlan_nd(struct sk_buff *msg, | ||
8756 | struct cfg80211_sched_scan_request *req) | ||
8757 | { | ||
8758 | struct nlattr *nd, *freqs, *matches, *match; | ||
8759 | int i; | ||
8760 | |||
8761 | if (!req) | ||
8762 | return 0; | ||
8763 | |||
8764 | nd = nla_nest_start(msg, NL80211_WOWLAN_TRIG_NET_DETECT); | ||
8765 | if (!nd) | ||
8766 | return -ENOBUFS; | ||
8767 | |||
8768 | if (nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, req->interval)) | ||
8769 | return -ENOBUFS; | ||
8770 | |||
8771 | freqs = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES); | ||
8772 | if (!freqs) | ||
8773 | return -ENOBUFS; | ||
8774 | |||
8775 | for (i = 0; i < req->n_channels; i++) | ||
8776 | nla_put_u32(msg, i, req->channels[i]->center_freq); | ||
8777 | |||
8778 | nla_nest_end(msg, freqs); | ||
8779 | |||
8780 | if (req->n_match_sets) { | ||
8781 | matches = nla_nest_start(msg, NL80211_ATTR_SCHED_SCAN_MATCH); | ||
8782 | for (i = 0; i < req->n_match_sets; i++) { | ||
8783 | match = nla_nest_start(msg, i); | ||
8784 | nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID, | ||
8785 | req->match_sets[i].ssid.ssid_len, | ||
8786 | req->match_sets[i].ssid.ssid); | ||
8787 | nla_nest_end(msg, match); | ||
8788 | } | ||
8789 | nla_nest_end(msg, matches); | ||
8790 | } | ||
8791 | |||
8792 | nla_nest_end(msg, nd); | ||
8793 | |||
8794 | return 0; | ||
8795 | } | ||
8796 | |||
8750 | static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) | 8797 | static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) |
8751 | { | 8798 | { |
8752 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 8799 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
@@ -8804,6 +8851,11 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
8804 | rdev->wiphy.wowlan_config->tcp)) | 8851 | rdev->wiphy.wowlan_config->tcp)) |
8805 | goto nla_put_failure; | 8852 | goto nla_put_failure; |
8806 | 8853 | ||
8854 | if (nl80211_send_wowlan_nd( | ||
8855 | msg, | ||
8856 | rdev->wiphy.wowlan_config->nd_config)) | ||
8857 | goto nla_put_failure; | ||
8858 | |||
8807 | nla_nest_end(msg, nl_wowlan); | 8859 | nla_nest_end(msg, nl_wowlan); |
8808 | } | 8860 | } |
8809 | 8861 | ||