Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * This file lim_process_probe_req_frame.cc contains the code |
| 30 | * for processing Probe Request Frame. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 02/28/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | * |
| 37 | */ |
| 38 | |
| 39 | #include "wni_cfg.h" |
| 40 | #include "ani_global.h" |
| 41 | #include "cfg_api.h" |
| 42 | |
| 43 | #include "utils_api.h" |
| 44 | #include "lim_types.h" |
| 45 | #include "lim_utils.h" |
| 46 | #include "lim_assoc_utils.h" |
| 47 | #include "lim_ser_des_utils.h" |
| 48 | #include "parser_api.h" |
| 49 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 50 | #include "lim_ft_defs.h" |
| 51 | #endif |
| 52 | #include "lim_session.h" |
| 53 | |
| 54 | void |
| 55 | |
| 56 | lim_send_sme_probe_req_ind(tpAniSirGlobal pMac, |
| 57 | tSirMacAddr peerMacAddr, |
| 58 | uint8_t *pProbeReqIE, |
| 59 | uint32_t ProbeReqIELen, tpPESession psessionEntry); |
| 60 | |
| 61 | /** |
| 62 | * lim_get_wpspbc_sessions() - to get wps pbs sessions |
| 63 | * @mac_ctx: Pointer to Global MAC structure |
| 64 | * @addr: A pointer to probe request source MAC addresss |
| 65 | * @uuid_e: A pointer to UUIDE element of WPS IE in WPS PBC probe request |
| 66 | * @session: A pointer to station PE session |
| 67 | * |
| 68 | * This function is called to query the WPS PBC overlap. This function |
| 69 | * check WPS PBC probe request link list for PBC overlap |
| 70 | * |
| 71 | * @return None |
| 72 | */ |
| 73 | |
| 74 | void lim_get_wpspbc_sessions(tpAniSirGlobal mac_ctx, uint8_t *addr, |
| 75 | uint8_t *uuid_e, eWPSPBCOverlap *overlap, |
| 76 | tpPESession session) |
| 77 | { |
| 78 | int count = 0; |
| 79 | tSirWPSPBCSession *pbc; |
| 80 | uint32_t cur_time; |
| 81 | |
| 82 | cur_time = (uint32_t) (cdf_mc_timer_get_system_ticks() / |
| 83 | CDF_TICKS_PER_SECOND); |
| 84 | cdf_mem_set((uint8_t *) addr, sizeof(tSirMacAddr), 0); |
| 85 | cdf_mem_set((uint8_t *) uuid_e, SIR_WPS_UUID_LEN, 0); |
| 86 | for (pbc = session->pAPWPSPBCSession; pbc; pbc = pbc->next) { |
| 87 | if (cur_time > pbc->timestamp + SIR_WPS_PBC_WALK_TIME) |
| 88 | break; |
| 89 | count++; |
| 90 | if (count > 1) |
| 91 | break; |
| 92 | cdf_mem_copy((uint8_t *) addr, (uint8_t *) pbc->addr, |
| 93 | sizeof(tSirMacAddr)); |
| 94 | cdf_mem_copy((uint8_t *) uuid_e, (uint8_t *) pbc->uuid_e, |
| 95 | SIR_WPS_UUID_LEN); |
| 96 | } |
| 97 | if (count > 1) |
| 98 | /* Overlap */ |
| 99 | *overlap = eSAP_WPSPBC_OVERLAP_IN120S; |
| 100 | else if (count == 0) |
| 101 | /* no WPS probe request in 120 second */ |
| 102 | *overlap = eSAP_WPSPBC_NO_WPSPBC_PROBE_REQ_IN120S; |
| 103 | else |
| 104 | /* One WPS probe request in 120 second */ |
| 105 | *overlap = eSAP_WPSPBC_ONE_WPSPBC_PROBE_REQ_IN120S; |
| 106 | |
| 107 | lim_log(mac_ctx, LOGE, FL("overlap = %d"), *overlap); |
| 108 | sir_dump_buf(mac_ctx, SIR_LIM_MODULE_ID, LOGE, addr, |
| 109 | sizeof(tSirMacAddr)); |
| 110 | sir_dump_buf(mac_ctx, SIR_LIM_MODULE_ID, LOGE, uuid_e, |
| 111 | SIR_WPS_UUID_LEN); |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * lim_remove_timeout_pb_csessions |
| 117 | * |
| 118 | ***FUNCTION: |
| 119 | * This function is called to remove the WPS PBC probe request entires from specific entry to end. |
| 120 | * |
| 121 | ***LOGIC: |
| 122 | * |
| 123 | * |
| 124 | ***ASSUMPTIONS: |
| 125 | * |
| 126 | * |
| 127 | ***NOTE: |
| 128 | * |
| 129 | * @param pMac Pointer to Global MAC structure |
| 130 | * @param pbc The beginning entry in WPS PBC probe request link list |
| 131 | * |
| 132 | * @return None |
| 133 | */ |
| 134 | static void lim_remove_timeout_pb_csessions(tpAniSirGlobal pMac, |
| 135 | tSirWPSPBCSession *pbc) |
| 136 | { |
| 137 | tSirWPSPBCSession *prev; |
| 138 | |
| 139 | while (pbc) { |
| 140 | prev = pbc; |
| 141 | pbc = pbc->next; |
| 142 | |
| 143 | PELOG4(lim_log(pMac, LOG4, FL("WPS PBC sessions remove"));) |
| 144 | PELOG4(sir_dump_buf |
| 145 | (pMac, SIR_LIM_MODULE_ID, LOG4, prev->addr, |
| 146 | sizeof(tSirMacAddr)); |
| 147 | ) |
| 148 | PELOG4(sir_dump_buf |
| 149 | (pMac, SIR_LIM_MODULE_ID, LOG4, prev->uuid_e, |
| 150 | SIR_WPS_UUID_LEN); |
| 151 | ) |
| 152 | |
| 153 | cdf_mem_free(prev); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | void lim_remove_pbc_sessions(tpAniSirGlobal pMac, tSirMacAddr pRemoveMac, |
| 158 | tpPESession psessionEntry) |
| 159 | { |
| 160 | tSirWPSPBCSession *pbc, *prev = NULL; |
| 161 | prev = pbc = psessionEntry->pAPWPSPBCSession; |
| 162 | |
| 163 | while (pbc) { |
| 164 | if (cdf_mem_compare((uint8_t *) pbc->addr, |
| 165 | (uint8_t *) pRemoveMac, |
| 166 | sizeof(tSirMacAddr))) { |
| 167 | prev->next = pbc->next; |
| 168 | if (pbc == psessionEntry->pAPWPSPBCSession) |
| 169 | psessionEntry->pAPWPSPBCSession = pbc->next; |
| 170 | cdf_mem_free(pbc); |
| 171 | return; |
| 172 | } |
| 173 | prev = pbc; |
| 174 | pbc = pbc->next; |
| 175 | } |
| 176 | |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * lim_update_pbc_session_entry |
| 181 | * |
| 182 | ***FUNCTION: |
| 183 | * This function is called when probe request with WPS PBC IE is received |
| 184 | * |
| 185 | ***LOGIC: |
| 186 | * This function add the WPS PBC probe request in the WPS PBC probe request link list |
| 187 | * The link list is in decreased time order of probe request that is received. |
| 188 | * The entry that is more than 120 second is removed. |
| 189 | * |
| 190 | ***ASSUMPTIONS: |
| 191 | * |
| 192 | * |
| 193 | ***NOTE: |
| 194 | * |
| 195 | * @param pMac Pointer to Global MAC structure |
| 196 | * @param addr A pointer to probe request source MAC addresss |
| 197 | * @param uuid_e A pointer to UUIDE element of WPS IE |
| 198 | * @param psessionEntry A pointer to station PE session |
| 199 | * |
| 200 | * @return None |
| 201 | */ |
| 202 | |
| 203 | static void lim_update_pbc_session_entry(tpAniSirGlobal pMac, |
| 204 | uint8_t *addr, uint8_t *uuid_e, |
| 205 | tpPESession psessionEntry) |
| 206 | { |
| 207 | tSirWPSPBCSession *pbc, *prev = NULL; |
| 208 | |
| 209 | uint32_t curTime; |
| 210 | |
| 211 | curTime = |
| 212 | (uint32_t) (cdf_mc_timer_get_system_ticks() / |
| 213 | CDF_TICKS_PER_SECOND); |
| 214 | |
| 215 | PELOG4(lim_log |
| 216 | (pMac, LOG4, FL("Receive WPS probe reques curTime=%d"), curTime); |
| 217 | ) |
| 218 | PELOG4(sir_dump_buf |
| 219 | (pMac, SIR_LIM_MODULE_ID, LOG4, addr, sizeof(tSirMacAddr)); |
| 220 | ) |
| 221 | PELOG4(sir_dump_buf |
| 222 | (pMac, SIR_LIM_MODULE_ID, LOG4, uuid_e, SIR_WPS_UUID_LEN); |
| 223 | ) |
| 224 | |
| 225 | pbc = psessionEntry->pAPWPSPBCSession; |
| 226 | |
| 227 | while (pbc) { |
| 228 | if (cdf_mem_compare |
| 229 | ((uint8_t *) pbc->addr, (uint8_t *) addr, |
| 230 | sizeof(tSirMacAddr)) |
| 231 | && cdf_mem_compare((uint8_t *) pbc->uuid_e, |
| 232 | (uint8_t *) uuid_e, SIR_WPS_UUID_LEN)) { |
| 233 | if (prev) |
| 234 | prev->next = pbc->next; |
| 235 | else |
| 236 | psessionEntry->pAPWPSPBCSession = pbc->next; |
| 237 | break; |
| 238 | } |
| 239 | prev = pbc; |
| 240 | pbc = pbc->next; |
| 241 | } |
| 242 | |
| 243 | if (!pbc) { |
| 244 | pbc = cdf_mem_malloc(sizeof(tSirWPSPBCSession)); |
| 245 | if (NULL == pbc) { |
| 246 | PELOGE(lim_log |
| 247 | (pMac, LOGE, FL("memory allocate failed!")); |
| 248 | ) |
| 249 | return; |
| 250 | } |
| 251 | cdf_mem_copy((uint8_t *) pbc->addr, (uint8_t *) addr, |
| 252 | sizeof(tSirMacAddr)); |
| 253 | |
| 254 | if (uuid_e) |
| 255 | cdf_mem_copy((uint8_t *) pbc->uuid_e, |
| 256 | (uint8_t *) uuid_e, SIR_WPS_UUID_LEN); |
| 257 | } |
| 258 | |
| 259 | pbc->next = psessionEntry->pAPWPSPBCSession; |
| 260 | psessionEntry->pAPWPSPBCSession = pbc; |
| 261 | pbc->timestamp = curTime; |
| 262 | |
| 263 | /* remove entries that have timed out */ |
| 264 | prev = pbc; |
| 265 | pbc = pbc->next; |
| 266 | |
| 267 | while (pbc) { |
| 268 | if (curTime > pbc->timestamp + SIR_WPS_PBC_WALK_TIME) { |
| 269 | prev->next = NULL; |
| 270 | lim_remove_timeout_pb_csessions(pMac, pbc); |
| 271 | break; |
| 272 | } |
| 273 | prev = pbc; |
| 274 | pbc = pbc->next; |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * lim_wpspbc_close |
| 280 | * |
| 281 | ***FUNCTION: |
| 282 | * This function is called when BSS is closed |
| 283 | * |
| 284 | ***LOGIC: |
| 285 | * This function remove all the WPS PBC entries |
| 286 | * |
| 287 | ***ASSUMPTIONS: |
| 288 | * |
| 289 | * |
| 290 | ***NOTE: |
| 291 | * |
| 292 | * @param pMac Pointer to Global MAC structure |
| 293 | * @param psessionEntry A pointer to station PE session |
| 294 | * |
| 295 | * @return None |
| 296 | */ |
| 297 | |
| 298 | void lim_wpspbc_close(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 299 | { |
| 300 | |
| 301 | lim_remove_timeout_pb_csessions(pMac, psessionEntry->pAPWPSPBCSession); |
| 302 | |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * lim_check11b_rates |
| 307 | * |
| 308 | ***FUNCTION: |
| 309 | * This function is called by lim_process_probe_req_frame() upon |
| 310 | * Probe Request frame reception. |
| 311 | * |
| 312 | ***LOGIC: |
| 313 | * This function check 11b rates in supportedRates and extendedRates rates |
| 314 | * |
| 315 | ***NOTE: |
| 316 | * |
| 317 | * @param rate |
| 318 | * |
| 319 | * @return BOOLEAN |
| 320 | */ |
| 321 | |
| 322 | bool lim_check11b_rates(uint8_t rate) |
| 323 | { |
| 324 | if ((0x02 == (rate)) |
| 325 | || (0x04 == (rate)) |
| 326 | || (0x0b == (rate)) |
| 327 | || (0x16 == (rate)) |
| 328 | ) { |
| 329 | return true; |
| 330 | } |
| 331 | return false; |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * lim_process_probe_req_frame: to process probe req frame |
| 336 | * @mac_ctx: Pointer to Global MAC structure |
| 337 | * @rx_pkt_info: A pointer to Buffer descriptor + associated PDUs |
| 338 | * @session: a ponter to session entry |
| 339 | * |
| 340 | * This function is called by limProcessMessageQueue() upon |
| 341 | * Probe Request frame reception. This function processes received |
| 342 | * Probe Request frame and responds with Probe Response. |
| 343 | * Only AP or STA in IBSS mode that sent last Beacon will respond to |
| 344 | * Probe Request. |
| 345 | * ASSUMPTIONS: |
| 346 | * 1. AP or STA in IBSS mode that sent last Beacon will always respond |
| 347 | * to Probe Request received with broadcast SSID. |
| 348 | * NOTE: |
| 349 | * 1. Dunno what to do with Rates received in Probe Request frame |
| 350 | * 2. Frames with out-of-order fields/IEs are dropped. |
| 351 | * |
| 352 | * |
| 353 | * Return: none |
| 354 | */ |
| 355 | |
| 356 | void |
| 357 | lim_process_probe_req_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, |
| 358 | tpPESession session) |
| 359 | { |
| 360 | uint8_t *body_ptr; |
| 361 | tpSirMacMgmtHdr mac_hdr; |
| 362 | uint32_t frame_len; |
| 363 | tSirProbeReq probe_req; |
| 364 | tAniSSID ssid; |
| 365 | |
| 366 | /* Don't send probe responses if disabled */ |
| 367 | if (mac_ctx->lim.gLimProbeRespDisableFlag) |
| 368 | return; |
| 369 | |
| 370 | /* |
| 371 | * Don't send probe response if P2P go is scanning till scan |
| 372 | * come to idle state. |
| 373 | */ |
| 374 | if ((session->pePersona == CDF_P2P_GO_MODE) && |
| 375 | ((mac_ctx->lim.gpLimRemainOnChanReq) || |
| 376 | (mac_ctx->lim.gLimHalScanState != eLIM_HAL_IDLE_SCAN_STATE))) { |
| 377 | lim_log(mac_ctx, LOG3, |
| 378 | FL("GO is scanning, don't send probersp on diff chnl")); |
| 379 | return; |
| 380 | } |
| 381 | mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); |
| 382 | if (LIM_IS_AP_ROLE(session) || |
| 383 | LIM_IS_BT_AMP_AP_ROLE(session) || |
| 384 | LIM_IS_BT_AMP_STA_ROLE(session) || |
| 385 | (LIM_IS_IBSS_ROLE(session) && |
| 386 | (WMA_GET_RX_BEACON_SENT(rx_pkt_info)))) { |
| 387 | frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); |
| 388 | |
| 389 | lim_log(mac_ctx, LOG3, |
| 390 | FL("Received Probe Request %d bytes from "), |
| 391 | frame_len); |
| 392 | lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOG3); |
| 393 | /* Get pointer to Probe Request frame body */ |
| 394 | body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info); |
| 395 | |
| 396 | /* Parse Probe Request frame */ |
| 397 | if (sir_convert_probe_req_frame2_struct(mac_ctx, body_ptr, |
| 398 | frame_len, &probe_req) == eSIR_FAILURE) { |
| 399 | lim_log(mac_ctx, LOGE, |
| 400 | FL("Parse error ProbeReq, length=%d, SA is: " |
| 401 | MAC_ADDRESS_STR), frame_len, |
| 402 | MAC_ADDR_ARRAY(mac_hdr->sa)); |
| 403 | mac_ctx->sys.probeError++; |
| 404 | return; |
| 405 | } |
| 406 | if (session->pePersona == CDF_P2P_GO_MODE) { |
| 407 | uint8_t i = 0, rate_11b = 0, other_rates = 0; |
| 408 | /* Check 11b rates in supported rates */ |
| 409 | for (i = 0; i < probe_req.supportedRates.numRates; |
| 410 | i++) { |
| 411 | if (lim_check11b_rates( |
| 412 | probe_req.supportedRates.rate[i] & |
| 413 | 0x7f)) |
| 414 | rate_11b++; |
| 415 | else |
| 416 | other_rates++; |
| 417 | } |
| 418 | |
| 419 | /* Check 11b rates in extended rates */ |
| 420 | for (i = 0; i < probe_req.extendedRates.numRates; i++) { |
| 421 | if (lim_check11b_rates( |
| 422 | probe_req.extendedRates.rate[i] & 0x7f)) |
| 423 | rate_11b++; |
| 424 | else |
| 425 | other_rates++; |
| 426 | } |
| 427 | |
| 428 | if ((rate_11b > 0) && (other_rates == 0)) { |
| 429 | lim_log(mac_ctx, LOG3, |
| 430 | FL("Received a probe req frame with only 11b rates, SA is: ")); |
| 431 | lim_print_mac_addr(mac_ctx, |
| 432 | mac_hdr->sa, LOG3); |
| 433 | return; |
| 434 | } |
| 435 | } |
| 436 | if (LIM_IS_AP_ROLE(session) && |
| 437 | ((session->APWPSIEs.SirWPSProbeRspIE.FieldPresent |
| 438 | & SIR_WPS_PROBRSP_VER_PRESENT) |
| 439 | && (probe_req.wscIePresent == 1) |
| 440 | && (probe_req.probeReqWscIeInfo.DevicePasswordID.id == |
| 441 | WSC_PASSWD_ID_PUSH_BUTTON) |
| 442 | && (probe_req.probeReqWscIeInfo.UUID_E.present == 1))) { |
| 443 | if (session->fwdWPSPBCProbeReq) { |
| 444 | sir_dump_buf(mac_ctx, SIR_LIM_MODULE_ID, |
| 445 | LOG4, mac_hdr->sa, sizeof(tSirMacAddr)); |
| 446 | sir_dump_buf(mac_ctx, SIR_LIM_MODULE_ID, |
| 447 | LOG4, body_ptr, frame_len); |
| 448 | lim_send_sme_probe_req_ind(mac_ctx, mac_hdr->sa, |
| 449 | body_ptr, frame_len, session); |
| 450 | } else { |
| 451 | lim_update_pbc_session_entry(mac_ctx, |
| 452 | mac_hdr->sa, |
| 453 | probe_req.probeReqWscIeInfo.UUID_E.uuid, |
| 454 | session); |
| 455 | } |
| 456 | } |
| 457 | ssid.length = session->ssId.length; |
| 458 | /* Copy the SSID from sessio entry to local variable */ |
| 459 | cdf_mem_copy(ssid.ssId, session->ssId.ssId, |
| 460 | session->ssId.length); |
| 461 | |
| 462 | /* |
| 463 | * Compare received SSID with current SSID. If they match, |
| 464 | * reply with Probe Response |
| 465 | */ |
| 466 | if (probe_req.ssId.length) { |
| 467 | if (!ssid.length) |
| 468 | goto multipleSSIDcheck; |
| 469 | |
| 470 | if (cdf_mem_compare((uint8_t *) &ssid, |
| 471 | (uint8_t *) &(probe_req.ssId), |
| 472 | (uint8_t) (ssid.length + 1))) { |
| 473 | lim_send_probe_rsp_mgmt_frame(mac_ctx, |
| 474 | mac_hdr->sa, &ssid, |
| 475 | DPH_USE_MGMT_STAID, |
| 476 | DPH_NON_KEEPALIVE_FRAME, |
| 477 | session, |
| 478 | probe_req.p2pIePresent); |
| 479 | return; |
| 480 | } else if (session->pePersona == |
| 481 | CDF_P2P_GO_MODE) { |
| 482 | uint8_t direct_ssid[7] = "DIRECT-"; |
| 483 | uint8_t direct_ssid_len = 7; |
| 484 | if (cdf_mem_compare((uint8_t *) &direct_ssid, |
| 485 | (uint8_t *) &(probe_req.ssId.ssId), |
| 486 | (uint8_t) (direct_ssid_len))) { |
| 487 | lim_send_probe_rsp_mgmt_frame(mac_ctx, |
| 488 | mac_hdr->sa, |
| 489 | &ssid, |
| 490 | DPH_USE_MGMT_STAID, |
| 491 | DPH_NON_KEEPALIVE_FRAME, |
| 492 | session, |
| 493 | probe_req.p2pIePresent); |
| 494 | return; |
| 495 | } |
| 496 | } else { |
| 497 | lim_log(mac_ctx, LOG3, |
| 498 | FL("Ignore ProbeReq frm with unmatch SSID received from ")); |
| 499 | lim_print_mac_addr(mac_ctx, mac_hdr->sa, |
| 500 | LOG3); |
| 501 | mac_ctx->sys.probeBadSsid++; |
| 502 | } |
| 503 | } else { |
| 504 | /* |
| 505 | * Broadcast SSID in the Probe Request. |
| 506 | * Reply with SSID we're configured with. |
| 507 | * Turn off the SSID length to 0 if hidden SSID feature |
| 508 | * is present |
| 509 | */ |
| 510 | if (session->ssidHidden) |
| 511 | /* |
| 512 | * We are returning from here as probe request |
| 513 | * contains the broadcast SSID. So no need to |
| 514 | * send the probe resp |
| 515 | */ |
| 516 | return; |
| 517 | lim_send_probe_rsp_mgmt_frame(mac_ctx, mac_hdr->sa, |
| 518 | &ssid, |
| 519 | DPH_USE_MGMT_STAID, |
| 520 | DPH_NON_KEEPALIVE_FRAME, |
| 521 | session, |
| 522 | probe_req.p2pIePresent); |
| 523 | return; |
| 524 | } |
| 525 | multipleSSIDcheck: |
| 526 | lim_log(mac_ctx, LOG3, |
| 527 | FL("Ignore ProbeReq frm with unmatch SSID rcved from")); |
| 528 | lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOG3); |
| 529 | mac_ctx->sys.probeBadSsid++; |
| 530 | } else { |
| 531 | /* Ignore received Probe Request frame */ |
| 532 | lim_log(mac_ctx, LOG3, |
| 533 | FL("Ignoring Probe Request frame received from ")); |
| 534 | lim_print_mac_addr(mac_ctx, mac_hdr->sa, LOG3); |
| 535 | mac_ctx->sys.probeIgnore++; |
| 536 | } |
| 537 | return; |
| 538 | } |
| 539 | |
| 540 | /** |
| 541 | * lim_indicate_probe_req_to_hdd |
| 542 | * |
| 543 | ***FUNCTION: |
| 544 | * This function is called by lim_process_probe_req_frame_multiple_bss() upon |
| 545 | * Probe Request frame reception. |
| 546 | * |
| 547 | ***LOGIC: |
| 548 | * This function processes received Probe Request frame and Pass |
| 549 | * Probe Request Frame to HDD. |
| 550 | * |
| 551 | * @param pMac Pointer to Global MAC structure |
| 552 | * @param *pBd A pointer to Buffer descriptor + associated PDUs |
| 553 | * @param psessionEntry A pointer to PE session |
| 554 | * |
| 555 | * @return None |
| 556 | */ |
| 557 | |
| 558 | static void |
| 559 | lim_indicate_probe_req_to_hdd(tpAniSirGlobal pMac, uint8_t *pBd, |
| 560 | tpPESession psessionEntry) |
| 561 | { |
| 562 | tpSirMacMgmtHdr pHdr; |
| 563 | uint32_t frameLen; |
| 564 | |
| 565 | lim_log(pMac, LOG1, "Received a probe request frame"); |
| 566 | |
| 567 | pHdr = WMA_GET_RX_MAC_HEADER(pBd); |
| 568 | frameLen = WMA_GET_RX_PAYLOAD_LEN(pBd); |
| 569 | |
| 570 | /* send the probe req to SME. */ |
| 571 | lim_send_sme_mgmt_frame_ind(pMac, pHdr->fc.subType, |
| 572 | (uint8_t *) pHdr, |
| 573 | (frameLen + sizeof(tSirMacMgmtHdr)), |
| 574 | psessionEntry->smeSessionId, WMA_GET_RX_CH(pBd), |
| 575 | psessionEntry, 0); |
| 576 | } /*** end lim_indicate_probe_req_to_hdd() ***/ |
| 577 | |
| 578 | /** |
| 579 | * lim_process_probe_req_frame_multiple_bss() - to process probe req |
| 580 | * @mac_ctx: Pointer to Global MAC structure |
| 581 | * @buf_descr: A pointer to Buffer descriptor + associated PDUs |
| 582 | * @session: A pointer to PE session |
| 583 | * |
| 584 | * This function is called by limProcessMessageQueue() upon |
| 585 | * Probe Request frame reception. This function call |
| 586 | * lim_indicate_probe_req_to_hdd function to indicate |
| 587 | * Probe Request frame to HDD. It also call lim_process_probe_req_frame |
| 588 | * function which process received Probe Request frame and responds |
| 589 | * with Probe Response. |
| 590 | * |
| 591 | * @return None |
| 592 | */ |
| 593 | void |
| 594 | lim_process_probe_req_frame_multiple_bss(tpAniSirGlobal mac_ctx, |
| 595 | uint8_t *buf_descr, tpPESession session) |
| 596 | { |
| 597 | uint8_t i; |
| 598 | |
| 599 | if (session != NULL) { |
| 600 | if (LIM_IS_AP_ROLE(session)) { |
| 601 | lim_indicate_probe_req_to_hdd(mac_ctx, |
| 602 | buf_descr, session); |
| 603 | } |
| 604 | lim_process_probe_req_frame(mac_ctx, buf_descr, session); |
| 605 | return; |
| 606 | } |
| 607 | |
| 608 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 609 | session = pe_find_session_by_session_id(mac_ctx, i); |
| 610 | if (session == NULL) |
| 611 | continue; |
| 612 | if (LIM_IS_AP_ROLE(session)) |
| 613 | lim_indicate_probe_req_to_hdd(mac_ctx, |
| 614 | buf_descr, session); |
| 615 | if (LIM_IS_AP_ROLE(session) || |
| 616 | LIM_IS_IBSS_ROLE(session) || |
| 617 | LIM_IS_BT_AMP_AP_ROLE(session) || |
| 618 | LIM_IS_BT_AMP_STA_ROLE(session)) |
| 619 | lim_process_probe_req_frame(mac_ctx, |
| 620 | buf_descr, session); |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | /** |
| 625 | * lim_send_sme_probe_req_ind() |
| 626 | * |
| 627 | ***FUNCTION: |
| 628 | * This function is to send |
| 629 | * eWNI_SME_WPS_PBC_PROBE_REQ_IND message to host |
| 630 | * |
| 631 | ***PARAMS: |
| 632 | * |
| 633 | ***LOGIC: |
| 634 | * |
| 635 | ***ASSUMPTIONS: |
| 636 | * NA |
| 637 | * |
| 638 | ***NOTE: |
| 639 | * This function is used for sending eWNI_SME_WPS_PBC_PROBE_REQ_IND |
| 640 | * to host. |
| 641 | * |
| 642 | * @param peerMacAddr Indicates the peer MAC addr that the probe request |
| 643 | * is generated. |
| 644 | * @param pProbeReqIE pointer to RAW probe request IE |
| 645 | * @param ProbeReqIELen The length of probe request IE. |
| 646 | * @param psessionEntry A pointer to PE session |
| 647 | * |
| 648 | * @return None |
| 649 | */ |
| 650 | void |
| 651 | lim_send_sme_probe_req_ind(tpAniSirGlobal pMac, |
| 652 | tSirMacAddr peerMacAddr, |
| 653 | uint8_t *pProbeReqIE, |
| 654 | uint32_t ProbeReqIELen, tpPESession psessionEntry) |
| 655 | { |
| 656 | tSirSmeProbeReqInd *pSirSmeProbeReqInd; |
| 657 | tSirMsgQ msgQ; |
| 658 | |
| 659 | pSirSmeProbeReqInd = cdf_mem_malloc(sizeof(tSirSmeProbeReqInd)); |
| 660 | if (NULL == pSirSmeProbeReqInd) { |
| 661 | /* Log error */ |
| 662 | lim_log(pMac, LOGP, |
| 663 | FL |
| 664 | ("call to AllocateMemory failed for eWNI_SME_PROBE_REQ_IND")); |
| 665 | return; |
| 666 | } |
| 667 | |
| 668 | msgQ.type = eWNI_SME_WPS_PBC_PROBE_REQ_IND; |
| 669 | msgQ.bodyval = 0; |
| 670 | msgQ.bodyptr = pSirSmeProbeReqInd; |
| 671 | |
| 672 | pSirSmeProbeReqInd->messageType = eWNI_SME_WPS_PBC_PROBE_REQ_IND; |
| 673 | pSirSmeProbeReqInd->length = sizeof(tSirSmeProbeReq); |
| 674 | pSirSmeProbeReqInd->sessionId = psessionEntry->smeSessionId; |
| 675 | |
| 676 | cdf_mem_copy(pSirSmeProbeReqInd->bssId, psessionEntry->bssId, |
| 677 | sizeof(tSirMacAddr)); |
| 678 | cdf_mem_copy(pSirSmeProbeReqInd->WPSPBCProbeReq.peerMacAddr, |
| 679 | peerMacAddr, sizeof(tSirMacAddr)); |
| 680 | |
| 681 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 682 | pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIELen = |
| 683 | (uint16_t) ProbeReqIELen; |
| 684 | cdf_mem_copy(pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIE, pProbeReqIE, |
| 685 | ProbeReqIELen); |
| 686 | |
| 687 | if (lim_sys_process_mmh_msg_api(pMac, &msgQ, ePROT) != eSIR_SUCCESS) { |
| 688 | PELOGE(lim_log |
| 689 | (pMac, LOGE, FL("couldnt send the probe req to hdd")); |
| 690 | ) |
| 691 | } |
| 692 | |
| 693 | } /*** end lim_send_sme_probe_req_ind() ***/ |