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