blob: 316a72c1b16c24641a154f72cbd3a6820cb21c04 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnson5ec4d8c2018-03-24 15:04:36 -07002 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/*
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080020 * This file lim_process_probe_req_frame.cc contains the code
21 * for processing Probe Request Frame.
22 * Author: Chandra Modumudi
23 * Date: 02/28/02
24 * History:-
25 * Date Modified by Modification Information
26 * --------------------------------------------------------------------
27 *
28 */
29
30#include "wni_cfg.h"
31#include "ani_global.h"
32#include "cfg_api.h"
33
34#include "utils_api.h"
35#include "lim_types.h"
36#include "lim_utils.h"
37#include "lim_assoc_utils.h"
38#include "lim_ser_des_utils.h"
39#include "parser_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080040#include "lim_ft_defs.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#include "lim_session.h"
Naveen Rawat08db88f2017-09-08 15:07:48 -070042#include "wlan_utility.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080043
44void
45
Jeff Johnson9320c1e2018-12-02 13:09:20 -080046lim_send_sme_probe_req_ind(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047 tSirMacAddr peerMacAddr,
48 uint8_t *pProbeReqIE,
Jeff Johnsonb5c13332018-12-03 09:54:51 -080049 uint32_t ProbeReqIELen, struct pe_session *pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050
51/**
52 * lim_get_wpspbc_sessions() - to get wps pbs sessions
53 * @mac_ctx: Pointer to Global MAC structure
Jeff Johnsonbe7f4fd2018-05-11 21:05:54 -070054 * @addr: probe request source MAC address
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055 * @uuid_e: A pointer to UUIDE element of WPS IE in WPS PBC probe request
56 * @session: A pointer to station PE session
57 *
58 * This function is called to query the WPS PBC overlap. This function
59 * check WPS PBC probe request link list for PBC overlap
60 *
61 * @return None
62 */
63
Jeff Johnson9320c1e2018-12-02 13:09:20 -080064void lim_get_wpspbc_sessions(struct mac_context *mac_ctx, struct qdf_mac_addr addr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065 uint8_t *uuid_e, eWPSPBCOverlap *overlap,
Jeff Johnson202e3282018-11-18 22:57:39 -080066 struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080067{
68 int count = 0;
69 tSirWPSPBCSession *pbc;
70 uint32_t cur_time;
71
Anurag Chouhan210db072016-02-22 18:42:15 +053072 cur_time = (uint32_t) (qdf_mc_timer_get_system_ticks() /
Anurag Chouhan6d760662016-02-20 16:05:43 +053073 QDF_TICKS_PER_SECOND);
Anurag Chouhanc5548422016-02-24 18:33:27 +053074 qdf_zero_macaddr(&addr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +053075 qdf_mem_set((uint8_t *) uuid_e, SIR_WPS_UUID_LEN, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076 for (pbc = session->pAPWPSPBCSession; pbc; pbc = pbc->next) {
77 if (cur_time > pbc->timestamp + SIR_WPS_PBC_WALK_TIME)
78 break;
79 count++;
80 if (count > 1)
81 break;
Anurag Chouhanc5548422016-02-24 18:33:27 +053082 qdf_copy_macaddr(&addr, &pbc->addr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +053083 qdf_mem_copy((uint8_t *) uuid_e, (uint8_t *) pbc->uuid_e,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084 SIR_WPS_UUID_LEN);
85 }
86 if (count > 1)
87 /* Overlap */
88 *overlap = eSAP_WPSPBC_OVERLAP_IN120S;
89 else if (count == 0)
90 /* no WPS probe request in 120 second */
91 *overlap = eSAP_WPSPBC_NO_WPSPBC_PROBE_REQ_IN120S;
92 else
93 /* One WPS probe request in 120 second */
94 *overlap = eSAP_WPSPBC_ONE_WPSPBC_PROBE_REQ_IN120S;
95
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +053096 pe_debug("overlap: %d", *overlap);
Srinivas Girigowdab896a562017-03-16 17:41:26 -070097 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
98 addr.bytes, QDF_MAC_ADDR_SIZE);
99 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
100 uuid_e, SIR_WPS_UUID_LEN);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800101 return;
102}
103
104/**
Krishna Kumaar Natarajand9131902015-10-19 11:52:47 -0700105 * lim_remove_timeout_pbc_sessions() - remove pbc probe req entries.
Jeff Johnson348973e2018-11-22 16:51:12 -0800106 * @mac - Pointer to Global MAC structure
Krishna Kumaar Natarajand9131902015-10-19 11:52:47 -0700107 * @pbc - The beginning entry in WPS PBC probe request link list
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800108 *
Krishna Kumaar Natarajand9131902015-10-19 11:52:47 -0700109 * This function is called to remove the WPS PBC probe request entries from
110 * specific entry to end.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800111 *
Krishna Kumaar Natarajand9131902015-10-19 11:52:47 -0700112 * Return - None
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800113 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800114static void lim_remove_timeout_pbc_sessions(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800115 tSirWPSPBCSession *pbc)
116{
117 tSirWPSPBCSession *prev;
118
119 while (pbc) {
120 prev = pbc;
121 pbc = pbc->next;
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530122 pe_debug("WPS PBC sessions remove");
Srinivas Girigowdab896a562017-03-16 17:41:26 -0700123 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
124 prev->addr.bytes, QDF_MAC_ADDR_SIZE);
125 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
126 prev->uuid_e, SIR_WPS_UUID_LEN);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800127
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530128 qdf_mem_free(prev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800129 }
130}
131
Srinivas Girigowdaedcfab92015-11-24 15:21:41 -0800132/**
133 * lim_remove_pbc_sessions() - Remove PBC sessions
134 * @mac: Pointer to Global MAC structure
135 * @remove_mac: MAC Address of STA in WPS Session to be removed
136 * @session_entry: session entry
137 *
138 * Return: none
139 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800140void lim_remove_pbc_sessions(struct mac_context *mac, struct qdf_mac_addr remove_mac,
Jeff Johnson202e3282018-11-18 22:57:39 -0800141 struct pe_session *session_entry)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800142{
143 tSirWPSPBCSession *pbc, *prev = NULL;
Srinivas Girigowda4d65ebe2017-10-13 21:41:42 -0700144
Srinivas Girigowdaedcfab92015-11-24 15:21:41 -0800145 prev = pbc = session_entry->pAPWPSPBCSession;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146
147 while (pbc) {
Anurag Chouhanc5548422016-02-24 18:33:27 +0530148 if (qdf_is_macaddr_equal(&pbc->addr, &remove_mac)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800149 prev->next = pbc->next;
Srinivas Girigowdaedcfab92015-11-24 15:21:41 -0800150 if (pbc == session_entry->pAPWPSPBCSession)
151 session_entry->pAPWPSPBCSession = pbc->next;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530152 qdf_mem_free(pbc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800153 return;
154 }
155 prev = pbc;
156 pbc = pbc->next;
157 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800158}
159
160/**
161 * lim_update_pbc_session_entry
162 *
163 ***FUNCTION:
164 * This function is called when probe request with WPS PBC IE is received
165 *
166 ***LOGIC:
167 * This function add the WPS PBC probe request in the WPS PBC probe request link list
168 * The link list is in decreased time order of probe request that is received.
169 * The entry that is more than 120 second is removed.
170 *
171 ***ASSUMPTIONS:
172 *
173 *
174 ***NOTE:
175 *
Jeff Johnson348973e2018-11-22 16:51:12 -0800176 * @param mac Pointer to Global MAC structure
Jeff Johnsonbe7f4fd2018-05-11 21:05:54 -0700177 * @param addr A pointer to probe request source MAC address
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800178 * @param uuid_e A pointer to UUIDE element of WPS IE
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800179 * @param pe_session A pointer to station PE session
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800180 *
181 * @return None
182 */
183
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800184static void lim_update_pbc_session_entry(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185 uint8_t *addr, uint8_t *uuid_e,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800186 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800187{
188 tSirWPSPBCSession *pbc, *prev = NULL;
189
190 uint32_t curTime;
191
192 curTime =
Anurag Chouhan210db072016-02-22 18:42:15 +0530193 (uint32_t) (qdf_mc_timer_get_system_ticks() /
Anurag Chouhan6d760662016-02-20 16:05:43 +0530194 QDF_TICKS_PER_SECOND);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800195
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530196 pe_debug("Receive WPS probe reques curTime: %d", curTime);
Srinivas Girigowdab896a562017-03-16 17:41:26 -0700197 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
198 addr, QDF_MAC_ADDR_SIZE);
199 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
200 uuid_e, SIR_WPS_UUID_LEN);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800201
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800202 pbc = pe_session->pAPWPSPBCSession;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800203
204 while (pbc) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530205 if ((!qdf_mem_cmp
Srinivas Girigowda419e36b2015-11-24 15:39:54 -0800206 ((uint8_t *) pbc->addr.bytes, (uint8_t *) addr,
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530207 QDF_MAC_ADDR_SIZE))
208 && (!qdf_mem_cmp((uint8_t *) pbc->uuid_e,
209 (uint8_t *) uuid_e, SIR_WPS_UUID_LEN))) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800210 if (prev)
211 prev->next = pbc->next;
212 else
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800213 pe_session->pAPWPSPBCSession = pbc->next;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800214 break;
215 }
216 prev = pbc;
217 pbc = pbc->next;
218 }
219
220 if (!pbc) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530221 pbc = qdf_mem_malloc(sizeof(tSirWPSPBCSession));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700222 if (!pbc)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800223 return;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530224 qdf_mem_copy((uint8_t *) pbc->addr.bytes, (uint8_t *) addr,
Anurag Chouhan6d760662016-02-20 16:05:43 +0530225 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800226
227 if (uuid_e)
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530228 qdf_mem_copy((uint8_t *) pbc->uuid_e,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800229 (uint8_t *) uuid_e, SIR_WPS_UUID_LEN);
230 }
231
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800232 pbc->next = pe_session->pAPWPSPBCSession;
233 pe_session->pAPWPSPBCSession = pbc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800234 pbc->timestamp = curTime;
235
236 /* remove entries that have timed out */
237 prev = pbc;
238 pbc = pbc->next;
239
240 while (pbc) {
241 if (curTime > pbc->timestamp + SIR_WPS_PBC_WALK_TIME) {
242 prev->next = NULL;
Jeff Johnson348973e2018-11-22 16:51:12 -0800243 lim_remove_timeout_pbc_sessions(mac, pbc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800244 break;
245 }
246 prev = pbc;
247 pbc = pbc->next;
248 }
249}
250
251/**
252 * lim_wpspbc_close
253 *
254 ***FUNCTION:
255 * This function is called when BSS is closed
256 *
257 ***LOGIC:
258 * This function remove all the WPS PBC entries
259 *
260 ***ASSUMPTIONS:
261 *
262 *
263 ***NOTE:
264 *
Jeff Johnson348973e2018-11-22 16:51:12 -0800265 * @param mac Pointer to Global MAC structure
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800266 * @param pe_session A pointer to station PE session
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800267 *
268 * @return None
269 */
270
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800271void lim_wpspbc_close(struct mac_context *mac, struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800272{
273
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800274 lim_remove_timeout_pbc_sessions(mac, pe_session->pAPWPSPBCSession);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800275
276}
277
278/**
279 * lim_check11b_rates
280 *
281 ***FUNCTION:
282 * This function is called by lim_process_probe_req_frame() upon
283 * Probe Request frame reception.
284 *
285 ***LOGIC:
286 * This function check 11b rates in supportedRates and extendedRates rates
287 *
288 ***NOTE:
289 *
290 * @param rate
291 *
292 * @return BOOLEAN
293 */
294
Jeff Johnson662ba062016-10-07 07:26:47 -0700295static bool lim_check11b_rates(uint8_t rate)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800296{
297 if ((0x02 == (rate))
298 || (0x04 == (rate))
299 || (0x0b == (rate))
300 || (0x16 == (rate))
301 ) {
302 return true;
303 }
304 return false;
305}
306
307/**
308 * lim_process_probe_req_frame: to process probe req frame
309 * @mac_ctx: Pointer to Global MAC structure
310 * @rx_pkt_info: A pointer to Buffer descriptor + associated PDUs
311 * @session: a ponter to session entry
312 *
313 * This function is called by limProcessMessageQueue() upon
314 * Probe Request frame reception. This function processes received
315 * Probe Request frame and responds with Probe Response.
316 * Only AP or STA in IBSS mode that sent last Beacon will respond to
317 * Probe Request.
318 * ASSUMPTIONS:
319 * 1. AP or STA in IBSS mode that sent last Beacon will always respond
320 * to Probe Request received with broadcast SSID.
321 * NOTE:
322 * 1. Dunno what to do with Rates received in Probe Request frame
323 * 2. Frames with out-of-order fields/IEs are dropped.
324 *
325 *
326 * Return: none
327 */
328
329void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800330lim_process_probe_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
Jeff Johnson202e3282018-11-18 22:57:39 -0800331 struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800332{
333 uint8_t *body_ptr;
334 tpSirMacMgmtHdr mac_hdr;
335 uint32_t frame_len;
336 tSirProbeReq probe_req;
337 tAniSSID ssid;
338
339 /* Don't send probe responses if disabled */
340 if (mac_ctx->lim.gLimProbeRespDisableFlag)
341 return;
342
343 /*
344 * Don't send probe response if P2P go is scanning till scan
345 * come to idle state.
346 */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530347 if ((session->pePersona == QDF_P2P_GO_MODE) &&
Jeff Johnson5ec4d8c2018-03-24 15:04:36 -0700348 mac_ctx->lim.gpLimRemainOnChanReq) {
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530349 pe_debug("GO is scanning, don't send probersp on diff chnl");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800350 return;
351 }
352 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
353 if (LIM_IS_AP_ROLE(session) ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800354 (LIM_IS_IBSS_ROLE(session) &&
355 (WMA_GET_RX_BEACON_SENT(rx_pkt_info)))) {
356 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
357
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530358 pe_debug("Received Probe Request: %d bytes from",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800359 frame_len);
Nishank Aggarwalabfd70b2017-03-11 16:48:25 +0530360 lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800361 /* Get pointer to Probe Request frame body */
362 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
363
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +0530364 /* check for vendor IE presence */
365 if ((session->access_policy_vendor_ie) &&
366 (session->access_policy ==
367 LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT)) {
Naveen Rawat08db88f2017-09-08 15:07:48 -0700368 if (!wlan_get_vendor_ie_ptr_from_oui(
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +0530369 &session->access_policy_vendor_ie[2],
370 3, body_ptr, frame_len)) {
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530371 pe_warn("Vendor IE is not present and access policy is: %x dropping probe request",
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +0530372 session->access_policy);
373 return;
374 }
375 }
376
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800377 /* Parse Probe Request frame */
378 if (sir_convert_probe_req_frame2_struct(mac_ctx, body_ptr,
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700379 frame_len, &probe_req) == QDF_STATUS_E_FAILURE) {
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530380 pe_err("Parse error ProbeReq, length: %d, SA is: "
381 MAC_ADDRESS_STR, frame_len,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800382 MAC_ADDR_ARRAY(mac_hdr->sa));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800383 return;
384 }
Anurag Chouhan6d760662016-02-20 16:05:43 +0530385 if (session->pePersona == QDF_P2P_GO_MODE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800386 uint8_t i = 0, rate_11b = 0, other_rates = 0;
387 /* Check 11b rates in supported rates */
388 for (i = 0; i < probe_req.supportedRates.numRates;
389 i++) {
390 if (lim_check11b_rates(
391 probe_req.supportedRates.rate[i] &
392 0x7f))
393 rate_11b++;
394 else
395 other_rates++;
396 }
397
398 /* Check 11b rates in extended rates */
399 for (i = 0; i < probe_req.extendedRates.numRates; i++) {
400 if (lim_check11b_rates(
401 probe_req.extendedRates.rate[i] & 0x7f))
402 rate_11b++;
403 else
404 other_rates++;
405 }
406
407 if ((rate_11b > 0) && (other_rates == 0)) {
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530408 pe_debug("Received a probe req frame with only 11b rates, SA is: ");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800409 lim_print_mac_addr(mac_ctx,
Nishank Aggarwalabfd70b2017-03-11 16:48:25 +0530410 mac_hdr->sa, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800411 return;
412 }
413 }
414 if (LIM_IS_AP_ROLE(session) &&
415 ((session->APWPSIEs.SirWPSProbeRspIE.FieldPresent
416 & SIR_WPS_PROBRSP_VER_PRESENT)
417 && (probe_req.wscIePresent == 1)
418 && (probe_req.probeReqWscIeInfo.DevicePasswordID.id ==
419 WSC_PASSWD_ID_PUSH_BUTTON)
420 && (probe_req.probeReqWscIeInfo.UUID_E.present == 1))) {
421 if (session->fwdWPSPBCProbeReq) {
Srinivas Girigowdab896a562017-03-16 17:41:26 -0700422 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE,
423 QDF_TRACE_LEVEL_DEBUG,
424 mac_hdr->sa,
425 QDF_MAC_ADDR_SIZE);
426 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE,
427 QDF_TRACE_LEVEL_DEBUG,
428 body_ptr, frame_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800429 lim_send_sme_probe_req_ind(mac_ctx, mac_hdr->sa,
430 body_ptr, frame_len, session);
431 } else {
432 lim_update_pbc_session_entry(mac_ctx,
433 mac_hdr->sa,
434 probe_req.probeReqWscIeInfo.UUID_E.uuid,
435 session);
436 }
437 }
438 ssid.length = session->ssId.length;
439 /* Copy the SSID from sessio entry to local variable */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530440 qdf_mem_copy(ssid.ssId, session->ssId.ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800441 session->ssId.length);
442
443 /*
444 * Compare received SSID with current SSID. If they match,
445 * reply with Probe Response
446 */
447 if (probe_req.ssId.length) {
448 if (!ssid.length)
449 goto multipleSSIDcheck;
450
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530451 if (!qdf_mem_cmp((uint8_t *) &ssid,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800452 (uint8_t *) &(probe_req.ssId),
453 (uint8_t) (ssid.length + 1))) {
454 lim_send_probe_rsp_mgmt_frame(mac_ctx,
455 mac_hdr->sa, &ssid,
456 DPH_USE_MGMT_STAID,
457 DPH_NON_KEEPALIVE_FRAME,
458 session,
459 probe_req.p2pIePresent);
460 return;
461 } else if (session->pePersona ==
Anurag Chouhan6d760662016-02-20 16:05:43 +0530462 QDF_P2P_GO_MODE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800463 uint8_t direct_ssid[7] = "DIRECT-";
464 uint8_t direct_ssid_len = 7;
Srinivas Girigowda4d65ebe2017-10-13 21:41:42 -0700465
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530466 if (!qdf_mem_cmp((uint8_t *) &direct_ssid,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800467 (uint8_t *) &(probe_req.ssId.ssId),
468 (uint8_t) (direct_ssid_len))) {
469 lim_send_probe_rsp_mgmt_frame(mac_ctx,
470 mac_hdr->sa,
471 &ssid,
472 DPH_USE_MGMT_STAID,
473 DPH_NON_KEEPALIVE_FRAME,
474 session,
475 probe_req.p2pIePresent);
476 return;
477 }
478 } else {
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530479 pe_debug("Ignore ProbeReq frm with unmatch SSID received from");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800480 lim_print_mac_addr(mac_ctx, mac_hdr->sa,
Nishank Aggarwalabfd70b2017-03-11 16:48:25 +0530481 LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800482 }
483 } else {
484 /*
485 * Broadcast SSID in the Probe Request.
486 * Reply with SSID we're configured with.
487 * Turn off the SSID length to 0 if hidden SSID feature
488 * is present
489 */
490 if (session->ssidHidden)
491 /*
492 * We are returning from here as probe request
493 * contains the broadcast SSID. So no need to
494 * send the probe resp
495 */
496 return;
497 lim_send_probe_rsp_mgmt_frame(mac_ctx, mac_hdr->sa,
498 &ssid,
499 DPH_USE_MGMT_STAID,
500 DPH_NON_KEEPALIVE_FRAME,
501 session,
502 probe_req.p2pIePresent);
503 return;
504 }
505multipleSSIDcheck:
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530506 pe_debug("Ignore ProbeReq frm with unmatch SSID rcved from");
Nishank Aggarwalabfd70b2017-03-11 16:48:25 +0530507 lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800508 } else {
509 /* Ignore received Probe Request frame */
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530510 pe_debug("Ignoring Probe Request frame received from");
Nishank Aggarwalabfd70b2017-03-11 16:48:25 +0530511 lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800512 }
513 return;
514}
515
516/**
517 * lim_indicate_probe_req_to_hdd
518 *
519 ***FUNCTION:
520 * This function is called by lim_process_probe_req_frame_multiple_bss() upon
521 * Probe Request frame reception.
522 *
523 ***LOGIC:
524 * This function processes received Probe Request frame and Pass
525 * Probe Request Frame to HDD.
526 *
Jeff Johnson348973e2018-11-22 16:51:12 -0800527 * @param mac Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800528 * @param *pBd A pointer to Buffer descriptor + associated PDUs
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800529 * @param pe_session A pointer to PE session
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800530 *
531 * @return None
532 */
533
534static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800535lim_indicate_probe_req_to_hdd(struct mac_context *mac, uint8_t *pBd,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800536 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800537{
538 tpSirMacMgmtHdr pHdr;
539 uint32_t frameLen;
540
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530541 pe_debug("Received a probe request frame");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800542
543 pHdr = WMA_GET_RX_MAC_HEADER(pBd);
544 frameLen = WMA_GET_RX_PAYLOAD_LEN(pBd);
545
546 /* send the probe req to SME. */
Jeff Johnson348973e2018-11-22 16:51:12 -0800547 lim_send_sme_mgmt_frame_ind(mac, pHdr->fc.subType,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800548 (uint8_t *) pHdr,
549 (frameLen + sizeof(tSirMacMgmtHdr)),
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800550 pe_session->smeSessionId, WMA_GET_RX_CH(pBd),
551 pe_session,
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +0530552 WMA_GET_RX_RSSI_NORMALIZED(pBd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800553} /*** end lim_indicate_probe_req_to_hdd() ***/
554
555/**
556 * lim_process_probe_req_frame_multiple_bss() - to process probe req
557 * @mac_ctx: Pointer to Global MAC structure
558 * @buf_descr: A pointer to Buffer descriptor + associated PDUs
559 * @session: A pointer to PE session
560 *
561 * This function is called by limProcessMessageQueue() upon
562 * Probe Request frame reception. This function call
563 * lim_indicate_probe_req_to_hdd function to indicate
564 * Probe Request frame to HDD. It also call lim_process_probe_req_frame
565 * function which process received Probe Request frame and responds
566 * with Probe Response.
567 *
568 * @return None
569 */
570void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800571lim_process_probe_req_frame_multiple_bss(struct mac_context *mac_ctx,
Jeff Johnson202e3282018-11-18 22:57:39 -0800572 uint8_t *buf_descr, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800573{
574 uint8_t i;
575
576 if (session != NULL) {
577 if (LIM_IS_AP_ROLE(session)) {
578 lim_indicate_probe_req_to_hdd(mac_ctx,
579 buf_descr, session);
580 }
581 lim_process_probe_req_frame(mac_ctx, buf_descr, session);
582 return;
583 }
584
585 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
586 session = pe_find_session_by_session_id(mac_ctx, i);
587 if (session == NULL)
588 continue;
589 if (LIM_IS_AP_ROLE(session))
590 lim_indicate_probe_req_to_hdd(mac_ctx,
591 buf_descr, session);
592 if (LIM_IS_AP_ROLE(session) ||
Rajeev Kumarcf835a02016-04-15 15:01:31 -0700593 LIM_IS_IBSS_ROLE(session))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800594 lim_process_probe_req_frame(mac_ctx,
595 buf_descr, session);
596 }
597}
598
599/**
600 * lim_send_sme_probe_req_ind()
601 *
602 ***FUNCTION:
603 * This function is to send
604 * eWNI_SME_WPS_PBC_PROBE_REQ_IND message to host
605 *
606 ***PARAMS:
607 *
608 ***LOGIC:
609 *
610 ***ASSUMPTIONS:
611 * NA
612 *
613 ***NOTE:
614 * This function is used for sending eWNI_SME_WPS_PBC_PROBE_REQ_IND
615 * to host.
616 *
617 * @param peerMacAddr Indicates the peer MAC addr that the probe request
618 * is generated.
619 * @param pProbeReqIE pointer to RAW probe request IE
620 * @param ProbeReqIELen The length of probe request IE.
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800621 * @param pe_session A pointer to PE session
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800622 *
623 * @return None
624 */
625void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800626lim_send_sme_probe_req_ind(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800627 tSirMacAddr peerMacAddr,
628 uint8_t *pProbeReqIE,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800629 uint32_t ProbeReqIELen, struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800630{
631 tSirSmeProbeReqInd *pSirSmeProbeReqInd;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700632 struct scheduler_msg msgQ = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800633
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530634 pSirSmeProbeReqInd = qdf_mem_malloc(sizeof(tSirSmeProbeReqInd));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700635 if (!pSirSmeProbeReqInd)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800636 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800637
638 msgQ.type = eWNI_SME_WPS_PBC_PROBE_REQ_IND;
639 msgQ.bodyval = 0;
640 msgQ.bodyptr = pSirSmeProbeReqInd;
641
642 pSirSmeProbeReqInd->messageType = eWNI_SME_WPS_PBC_PROBE_REQ_IND;
643 pSirSmeProbeReqInd->length = sizeof(tSirSmeProbeReq);
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800644 pSirSmeProbeReqInd->sessionId = pe_session->smeSessionId;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800645
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800646 qdf_mem_copy(pSirSmeProbeReqInd->bssid.bytes, pe_session->bssId,
Anurag Chouhan6d760662016-02-20 16:05:43 +0530647 QDF_MAC_ADDR_SIZE);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530648 qdf_mem_copy(pSirSmeProbeReqInd->WPSPBCProbeReq.peer_macaddr.bytes,
Anurag Chouhan6d760662016-02-20 16:05:43 +0530649 peerMacAddr, QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800650
Jeff Johnson348973e2018-11-22 16:51:12 -0800651 MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800652 pe_session->peSessionId, msgQ.type));
Padma, Santhosh Kumar8472cb82017-11-07 18:40:17 +0530653
654 if (ProbeReqIELen > sizeof(pSirSmeProbeReqInd->WPSPBCProbeReq.
655 probeReqIE)) {
656 ProbeReqIELen = sizeof(pSirSmeProbeReqInd->WPSPBCProbeReq.
657 probeReqIE);
658 }
659
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660 pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIELen =
661 (uint16_t) ProbeReqIELen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530662 qdf_mem_copy(pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIE, pProbeReqIE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800663 ProbeReqIELen);
664
Jeff Johnson348973e2018-11-22 16:51:12 -0800665 if (lim_sys_process_mmh_msg_api(mac, &msgQ, ePROT) != QDF_STATUS_SUCCESS)
Nishank Aggarwal2f2ac282017-03-23 15:24:00 +0530666 pe_err("couldnt send the probe req to hdd");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800667
668} /*** end lim_send_sme_probe_req_ind() ***/