diff options
author | Roee Zamir <roee.zamir@intel.com> | 2017-08-06 04:38:23 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2017-09-21 05:42:00 -0400 |
commit | 40b0bd24973487272167a09db040a70c053bedbe (patch) | |
tree | 94013df732e7b3c9570fb25db3db774b3a5a3dfc /net/mac80211 | |
parent | 2d23d0736e3a4a0fdb92b8e46ea476639f16aae8 (diff) |
mac80211: oce: enable receiving of bcast probe resp
One of OCE's optimizations is acception of broadcast probe responses.
Accept broadcast probe responses but don't set
NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP. Because a device's firmware
may filter out the broadcast probe resp - drivers should set this flag.
Signed-off-by: Roee Zamir <roee.zamir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
[johannes: make accepting broadcast conditional on the nl80211 scan
flag that was added for that specific purpose]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/scan.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 47d2ed570470..ef2becaade50 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 7 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> | 8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
9 | * Copyright 2013-2015 Intel Mobile Communications GmbH | 9 | * Copyright 2013-2015 Intel Mobile Communications GmbH |
10 | * Copyright 2016 Intel Deutschland GmbH | 10 | * Copyright 2016-2017 Intel Deutschland GmbH |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU General Public License version 2 as | 13 | * it under the terms of the GNU General Public License version 2 as |
@@ -183,6 +183,20 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
183 | return bss; | 183 | return bss; |
184 | } | 184 | } |
185 | 185 | ||
186 | static bool ieee80211_scan_accept_presp(struct ieee80211_sub_if_data *sdata, | ||
187 | u32 scan_flags, const u8 *da) | ||
188 | { | ||
189 | if (!sdata) | ||
190 | return false; | ||
191 | /* accept broadcast for OCE */ | ||
192 | if (scan_flags & NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP && | ||
193 | is_broadcast_ether_addr(da)) | ||
194 | return true; | ||
195 | if (scan_flags & NL80211_SCAN_FLAG_RANDOM_ADDR) | ||
196 | return true; | ||
197 | return ether_addr_equal(da, sdata->vif.addr); | ||
198 | } | ||
199 | |||
186 | void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) | 200 | void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) |
187 | { | 201 | { |
188 | struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); | 202 | struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); |
@@ -208,19 +222,24 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) | |||
208 | if (ieee80211_is_probe_resp(mgmt->frame_control)) { | 222 | if (ieee80211_is_probe_resp(mgmt->frame_control)) { |
209 | struct cfg80211_scan_request *scan_req; | 223 | struct cfg80211_scan_request *scan_req; |
210 | struct cfg80211_sched_scan_request *sched_scan_req; | 224 | struct cfg80211_sched_scan_request *sched_scan_req; |
225 | u32 scan_req_flags = 0, sched_scan_req_flags = 0; | ||
211 | 226 | ||
212 | scan_req = rcu_dereference(local->scan_req); | 227 | scan_req = rcu_dereference(local->scan_req); |
213 | sched_scan_req = rcu_dereference(local->sched_scan_req); | 228 | sched_scan_req = rcu_dereference(local->sched_scan_req); |
214 | 229 | ||
215 | /* ignore ProbeResp to foreign address unless scanning | 230 | if (scan_req) |
216 | * with randomised address | 231 | scan_req_flags = scan_req->flags; |
232 | |||
233 | if (sched_scan_req) | ||
234 | sched_scan_req_flags = sched_scan_req->flags; | ||
235 | |||
236 | /* ignore ProbeResp to foreign address or non-bcast (OCE) | ||
237 | * unless scanning with randomised address | ||
217 | */ | 238 | */ |
218 | if (!(sdata1 && | 239 | if (!ieee80211_scan_accept_presp(sdata1, scan_req_flags, |
219 | (ether_addr_equal(mgmt->da, sdata1->vif.addr) || | 240 | mgmt->da) && |
220 | scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR)) && | 241 | !ieee80211_scan_accept_presp(sdata2, sched_scan_req_flags, |
221 | !(sdata2 && | 242 | mgmt->da)) |
222 | (ether_addr_equal(mgmt->da, sdata2->vif.addr) || | ||
223 | sched_scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR))) | ||
224 | return; | 243 | return; |
225 | 244 | ||
226 | elements = mgmt->u.probe_resp.variable; | 245 | elements = mgmt->u.probe_resp.variable; |