Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, 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 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /**======================================================================== |
| 43 | |
| 44 | \file wlan_hdd_assoc.c |
| 45 | \brief WLAN Host Device Driver implementation |
| 46 | |
| 47 | Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved. |
| 48 | |
| 49 | Qualcomm Confidential and Proprietary. |
| 50 | |
| 51 | ========================================================================*/ |
| 52 | /**========================================================================= |
| 53 | EDIT HISTORY FOR FILE |
| 54 | |
| 55 | |
| 56 | This section contains comments describing changes made to the module. |
| 57 | Notice that changes are listed in reverse chronological order. |
| 58 | |
| 59 | |
| 60 | $Header:$ $DateTime: $ $Author: $ |
| 61 | |
| 62 | |
| 63 | when who what, where, why |
| 64 | -------- --- -------------------------------------------------------- |
| 65 | 05/06/09 Shailender Created module. |
| 66 | ==========================================================================*/ |
| 67 | |
| 68 | #include "wlan_hdd_includes.h" |
| 69 | #include <aniGlobal.h> |
| 70 | #include "dot11f.h" |
| 71 | #include "wlan_nlink_common.h" |
| 72 | #include "wlan_btc_svc.h" |
| 73 | #include "wlan_hdd_power.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 74 | #include <linux/ieee80211.h> |
| 75 | #include <linux/wireless.h> |
| 76 | #include <net/cfg80211.h> |
| 77 | #include "wlan_hdd_cfg80211.h" |
| 78 | #include "csrInsideApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 79 | #include "wlan_hdd_p2p.h" |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 80 | #ifdef FEATURE_WLAN_TDLS |
| 81 | #include "wlan_hdd_tdls.h" |
| 82 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 83 | #include "sme_Api.h" |
| 84 | |
| 85 | v_BOOL_t mibIsDot11DesiredBssTypeInfrastructure( hdd_adapter_t *pAdapter ); |
| 86 | |
| 87 | struct ether_addr |
| 88 | { |
| 89 | u_char ether_addr_octet[6]; |
| 90 | }; |
| 91 | // These are needed to recognize WPA and RSN suite types |
| 92 | #define HDD_WPA_OUI_SIZE 4 |
| 93 | v_U8_t ccpWpaOui00[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 94 | v_U8_t ccpWpaOui01[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 95 | v_U8_t ccpWpaOui02[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 96 | v_U8_t ccpWpaOui03[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 97 | v_U8_t ccpWpaOui04[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 98 | v_U8_t ccpWpaOui05[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 99 | #ifdef FEATURE_WLAN_CCX |
| 100 | v_U8_t ccpWpaOui06[ HDD_WPA_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM |
| 101 | #endif /* FEATURE_WLAN_CCX */ |
| 102 | #define HDD_RSN_OUI_SIZE 4 |
| 103 | v_U8_t ccpRSNOui00[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x00 }; // group cipher |
| 104 | v_U8_t ccpRSNOui01[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x01 }; // WEP-40 or RSN |
| 105 | v_U8_t ccpRSNOui02[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x02 }; // TKIP or RSN-PSK |
| 106 | v_U8_t ccpRSNOui03[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x03 }; // Reserved |
| 107 | v_U8_t ccpRSNOui04[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x04 }; // AES-CCMP |
| 108 | v_U8_t ccpRSNOui05[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x05 }; // WEP-104 |
| 109 | #ifdef FEATURE_WLAN_CCX |
| 110 | v_U8_t ccpRSNOui06[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x40, 0x96, 0x00 }; // CCKM |
| 111 | #endif /* FEATURE_WLAN_CCX */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 112 | #ifdef WLAN_FEATURE_11W |
| 113 | v_U8_t ccpRSNOui07[ HDD_RSN_OUI_SIZE ] = { 0x00, 0x0F, 0xAC, 0x06 }; // RSN-PSK-SHA256 |
| 114 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 115 | |
| 116 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 117 | // Offset where the EID-Len-IE, start. |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 118 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2)*/ |
| 119 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 120 | #endif |
| 121 | |
| 122 | #define BEACON_FRAME_IES_OFFSET 12 |
| 123 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 124 | void hdd_ResetCountryCodeAfterDisAssoc(hdd_adapter_t *pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 126 | #ifdef WLAN_FEATURE_11W |
| 127 | void hdd_indicateUnprotMgmtFrame(hdd_adapter_t *pAdapter, |
| 128 | tANI_U32 nFrameLength, |
| 129 | tANI_U8* pbFrames, |
| 130 | tANI_U8 frameType ); |
| 131 | #endif |
| 132 | |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 133 | v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 134 | eConnectionState connState ) |
| 135 | { |
| 136 | // save the new connection state |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 137 | pHddStaCtx->conn_info.connState = connState; |
| 138 | } |
| 139 | |
| 140 | // returns FALSE if not connected. |
| 141 | // returns TRUE for the two 'connected' states (Infra Associated or IBSS Connected ). |
| 142 | // returns the connection state. Can specify NULL if you dont' want to get the actual state. |
| 143 | |
| 144 | static inline v_BOOL_t hdd_connGetConnectionState( hdd_station_ctx_t *pHddStaCtx, |
| 145 | eConnectionState *pConnState ) |
| 146 | { |
| 147 | v_BOOL_t fConnected; |
| 148 | eConnectionState connState; |
| 149 | |
| 150 | // get the connection state. |
| 151 | connState = pHddStaCtx->conn_info.connState; |
| 152 | // Set the fConnected return variable based on the Connected State. |
| 153 | if ( eConnectionState_Associated == connState || |
| 154 | eConnectionState_IbssConnected == connState ) |
| 155 | { |
| 156 | fConnected = VOS_TRUE; |
| 157 | } |
| 158 | else |
| 159 | { |
| 160 | fConnected = VOS_FALSE; |
| 161 | } |
| 162 | |
| 163 | if ( pConnState ) |
| 164 | { |
| 165 | *pConnState = connState; |
| 166 | } |
| 167 | |
| 168 | return( fConnected ); |
| 169 | } |
| 170 | |
| 171 | v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx ) |
| 172 | { |
| 173 | return( hdd_connGetConnectionState( pHddStaCtx, NULL ) ); |
| 174 | } |
| 175 | |
| 176 | //TODO - Not used anyhwere. Can be removed. |
| 177 | #if 0 |
| 178 | // |
| 179 | v_BOOL_t hdd_connIsConnectedInfra( hdd_adapter_t *pAdapter ) |
| 180 | { |
| 181 | v_BOOL_t fConnectedInfra = FALSE; |
| 182 | eConnectionState connState; |
| 183 | |
| 184 | if ( hdd_connGetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connState ) ) |
| 185 | { |
| 186 | if ( eConnectionState_Associated == connState ) |
| 187 | { |
| 188 | fConnectedInfra = TRUE; |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | return( fConnectedInfra ); |
| 193 | } |
| 194 | #endif |
| 195 | |
| 196 | static inline v_BOOL_t hdd_connGetConnectedCipherAlgo( hdd_station_ctx_t *pHddStaCtx, eCsrEncryptionType *pConnectedCipherAlgo ) |
| 197 | { |
| 198 | v_BOOL_t fConnected = VOS_FALSE; |
| 199 | |
| 200 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
| 201 | |
| 202 | if ( pConnectedCipherAlgo ) |
| 203 | { |
| 204 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 205 | } |
| 206 | |
| 207 | return( fConnected ); |
| 208 | } |
| 209 | |
| 210 | inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eMib_dot11DesiredBssType *pConnectedBssType ) |
| 211 | { |
| 212 | v_BOOL_t fConnected = VOS_FALSE; |
| 213 | |
| 214 | fConnected = hdd_connGetConnectionState( pHddStaCtx, NULL ); |
| 215 | |
| 216 | if ( pConnectedBssType ) |
| 217 | { |
| 218 | *pConnectedBssType = pHddStaCtx->conn_info.connDot11DesiredBssType; |
| 219 | } |
| 220 | |
| 221 | return( fConnected ); |
| 222 | } |
| 223 | |
| 224 | static inline void hdd_connSaveConnectedBssType( hdd_station_ctx_t *pHddStaCtx, eCsrRoamBssType csrRoamBssType ) |
| 225 | { |
| 226 | switch( csrRoamBssType ) |
| 227 | { |
| 228 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 229 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_infrastructure; |
| 230 | break; |
| 231 | |
| 232 | case eCSR_BSS_TYPE_IBSS: |
| 233 | case eCSR_BSS_TYPE_START_IBSS: |
| 234 | pHddStaCtx->conn_info.connDot11DesiredBssType = eMib_dot11DesiredBssType_independent; |
| 235 | break; |
| 236 | |
| 237 | /** We will never set the BssType to 'any' when attempting a connection |
| 238 | so CSR should never send this back to us.*/ |
| 239 | case eCSR_BSS_TYPE_ANY: |
| 240 | default: |
| 241 | VOS_ASSERT( 0 ); |
| 242 | break; |
| 243 | } |
| 244 | |
| 245 | } |
| 246 | |
| 247 | void hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType ) |
| 248 | { |
| 249 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 250 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 251 | |
| 252 | VOS_ASSERT( pRoamInfo ); |
| 253 | |
| 254 | if ( pRoamInfo ) |
| 255 | { |
| 256 | // Save the BSSID for the connection... |
| 257 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType ) |
| 258 | { |
| 259 | VOS_ASSERT( pRoamInfo->pBssDesc ); |
| 260 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,6 ); |
| 261 | |
| 262 | // Save the Station ID for this station from the 'Roam Info'. |
| 263 | //For IBSS mode, staId is assigned in NEW_PEER_IND |
| 264 | //For reassoc, the staID doesn't change and it may be invalid in this structure |
| 265 | //so no change here. |
| 266 | if( !pRoamInfo->fReassocReq ) |
| 267 | { |
| 268 | pHddStaCtx->conn_info.staId [0]= pRoamInfo->staId; |
| 269 | } |
| 270 | } |
| 271 | else if ( eCSR_BSS_TYPE_IBSS == eBssType ) |
| 272 | { |
| 273 | vos_mem_copy(pHddStaCtx->conn_info.bssId, pRoamInfo->bssid,sizeof(pRoamInfo->bssid) ); |
| 274 | } |
| 275 | else |
| 276 | { |
| 277 | // can't happen. We need a valid IBSS or Infra setting in the BSSDescription |
| 278 | // or we can't function. |
| 279 | VOS_ASSERT( 0 ); |
| 280 | } |
| 281 | |
| 282 | // notify WMM |
| 283 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 284 | |
| 285 | if( !pRoamInfo->u.pConnectedProfile ) |
| 286 | { |
| 287 | VOS_ASSERT( pRoamInfo->u.pConnectedProfile ); |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | // Get Multicast Encryption Type |
| 292 | encryptType = pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 293 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 294 | // Get Unicast Encrytion Type |
| 295 | encryptType = pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 296 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 297 | |
| 298 | pHddStaCtx->conn_info.authType = pRoamInfo->u.pConnectedProfile->AuthType; |
| 299 | |
| 300 | pHddStaCtx->conn_info.operationChannel = pRoamInfo->u.pConnectedProfile->operationChannel; |
| 301 | |
| 302 | // Save the ssid for the connection |
| 303 | vos_mem_copy( &pHddStaCtx->conn_info.SSID.SSID, &pRoamInfo->u.pConnectedProfile->SSID, sizeof( tSirMacSSid ) ); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | // save the connected BssType |
| 308 | hdd_connSaveConnectedBssType( pHddStaCtx, eBssType ); |
| 309 | |
| 310 | } |
| 311 | |
| 312 | #if defined(WLAN_FEATURE_VOWIFI_11R) |
| 313 | /* |
| 314 | * Send the 11R key information to the supplicant. |
| 315 | * Only then can the supplicant generate the PMK-R1. |
| 316 | * (BTW, the CCX supplicant also needs the Assoc Resp IEs |
| 317 | * for the same purpose.) |
| 318 | * |
| 319 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA |
| 320 | * this contains the R1KHID, R0KHID and the MDID. |
| 321 | * For FT, this consists of the Reassoc Rsp FTIEs. |
| 322 | * This is the Assoc Response. |
| 323 | */ |
| 324 | static void hdd_SendFTAssocResponse(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 325 | tCsrRoamInfo *pCsrRoamInfo) |
| 326 | { |
| 327 | union iwreq_data wrqu; |
| 328 | char *buff; |
| 329 | unsigned int len = 0; |
| 330 | u8 *pFTAssocRsp = NULL; |
| 331 | |
| 332 | if (pCsrRoamInfo->nAssocRspLength == 0) |
| 333 | { |
| 334 | hddLog(LOGE, |
| 335 | "%s: pCsrRoamInfo->nAssocRspLength=%d", |
| 336 | __func__, (int)pCsrRoamInfo->nAssocRspLength); |
| 337 | return; |
| 338 | } |
| 339 | |
| 340 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 341 | pCsrRoamInfo->nAssocReqLength); |
| 342 | if (pFTAssocRsp == NULL) |
| 343 | { |
| 344 | hddLog(LOGE, "%s: AssocReq or AssocRsp is NULL", __func__); |
| 345 | return; |
| 346 | } |
| 347 | |
| 348 | // pFTAssocRsp needs to point to the IEs |
| 349 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 350 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 351 | (unsigned int)pFTAssocRsp[0], |
| 352 | (unsigned int)pFTAssocRsp[1]); |
| 353 | |
| 354 | // We need to send the IEs to the supplicant. |
| 355 | buff = kmalloc(IW_GENERIC_IE_MAX, GFP_ATOMIC); |
| 356 | if (buff == NULL) |
| 357 | { |
| 358 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
| 359 | return; |
| 360 | } |
| 361 | |
| 362 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
| 363 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 364 | wrqu.data.length = len; |
| 365 | memset(buff, 0, IW_GENERIC_IE_MAX); |
| 366 | memcpy(buff, pFTAssocRsp, len); |
| 367 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 368 | |
| 369 | kfree(buff); |
| 370 | } |
| 371 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 372 | |
| 373 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 374 | |
| 375 | /*--------------------------------------------------- |
| 376 | * |
| 377 | * Send the FTIEs, RIC IEs during FT. This is eventually |
| 378 | * used to send the FT events to the supplicant |
| 379 | * |
| 380 | * At the reception of Auth2 we send the RIC followed |
| 381 | * by the auth response IEs to the supplicant. |
| 382 | * Once both are received in the supplicant, an FT |
| 383 | * event is generated to the supplicant. |
| 384 | * |
| 385 | *--------------------------------------------------- |
| 386 | */ |
| 387 | void hdd_SendFTEvent(hdd_adapter_t *pAdapter) |
| 388 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | tANI_U16 auth_resp_len = 0; |
| 390 | tANI_U32 ric_ies_length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 392 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 393 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 394 | struct cfg80211_ft_event_params ftEvent; |
| 395 | v_U8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 396 | v_U8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 397 | v_U8_t target_ap[SIR_MAC_ADDR_LENGTH]; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 398 | struct net_device *dev = pAdapter->dev; |
| 399 | #else |
| 400 | char *buff; |
| 401 | union iwreq_data wrqu; |
| 402 | tANI_U16 str_len; |
| 403 | #endif |
| 404 | |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 405 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 406 | vos_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 407 | vos_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 408 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 409 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)ricIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 410 | DOT11F_IE_FTINFO_MAX_LEN, &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 411 | if (ric_ies_length == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 412 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 413 | hddLog(LOGW, |
| 414 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 415 | __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 416 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 417 | |
| 418 | ftEvent.ric_ies = ricIe; |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 419 | ftEvent.ric_ies_len = ric_ies_length; |
| 420 | hddLog(LOG1, "%s: RIC IEs is of length %d", __func__, (int)ric_ies_length); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 421 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 422 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)ftIe, |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 423 | DOT11F_IE_FTINFO_MAX_LEN, &auth_resp_len); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 424 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 425 | if (auth_resp_len == 0) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 426 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 427 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 428 | return; |
| 429 | } |
| 430 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 431 | vos_mem_copy(target_ap, ftIe, SIR_MAC_ADDR_LENGTH); |
| 432 | |
| 433 | ftEvent.target_ap = target_ap; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 434 | |
| 435 | ftEvent.ies = (u8 *)(ftIe + SIR_MAC_ADDR_LENGTH); |
| 436 | ftEvent.ies_len = auth_resp_len - SIR_MAC_ADDR_LENGTH; |
| 437 | |
| 438 | hddLog(LOG1, "%s ftEvent.ies_len %d",__FUNCTION__, ftEvent.ies_len); |
| 439 | hddLog(LOG1, "%s ftEvent.ric_ies_len %d",__FUNCTION__, ftEvent.ric_ies_len ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 440 | hddLog(LOG1, "%s ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x ", |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 441 | __FUNCTION__, ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 442 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 443 | ftEvent.target_ap[5]); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 444 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 445 | (void)cfg80211_ft_event(dev, &ftEvent); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 446 | |
| 447 | #else |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 448 | // We need to send the IEs to the supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 449 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 450 | if (buff == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 451 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 452 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 453 | return; |
| 454 | } |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 455 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 456 | |
| 457 | // Sme needs to send the RIC IEs first |
| 458 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 459 | sme_GetRICIEs( pHddCtx->hHal, (u8 *)&(buff[str_len]), |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 460 | (IW_CUSTOM_MAX - str_len), &ric_ies_length ); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 461 | if (ric_ies_length == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 462 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 463 | hddLog(LOGW, |
| 464 | "%s: RIC IEs is of length 0 not sending RIC Information for now", |
| 465 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 466 | } |
| 467 | else |
| 468 | { |
| 469 | wrqu.data.length = str_len + ric_ies_length; |
| 470 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 471 | } |
| 472 | |
| 473 | // Sme needs to provide the Auth Resp |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 474 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 475 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 476 | sme_GetFTPreAuthResponse(pHddCtx->hHal, (u8 *)&buff[str_len], |
| 477 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 478 | |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 479 | if (auth_resp_len == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 480 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 481 | hddLog(LOGE, "%s: AuthRsp FTIES is of length 0", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 482 | return; |
| 483 | } |
| 484 | |
| 485 | wrqu.data.length = str_len + auth_resp_len; |
| 486 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 487 | |
| 488 | kfree(buff); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 489 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 493 | |
| 494 | #ifdef FEATURE_WLAN_CCX |
| 495 | |
| 496 | /* |
| 497 | * Send the CCX required "new AP Channel info" to the supplicant. |
| 498 | * (This keeps the supplicant "up to date" on the current channel.) |
| 499 | * |
| 500 | * The current (new AP) channel information is passed in. |
| 501 | */ |
| 502 | static void hdd_SendNewAPChannelInfo(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 503 | tCsrRoamInfo *pCsrRoamInfo) |
| 504 | { |
| 505 | union iwreq_data wrqu; |
| 506 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
| 507 | |
| 508 | |
| 509 | if (descriptor == NULL) |
| 510 | { |
| 511 | hddLog(LOGE, |
| 512 | "%s: pCsrRoamInfo->pBssDesc=%p\n", |
| 513 | __func__, descriptor); |
| 514 | return; |
| 515 | } |
| 516 | |
| 517 | // Send the Channel event, the supplicant needs this to generate the Adjacent AP report. |
| 518 | hddLog(LOGW, "%s: Sending up an SIOCGIWFREQ, channelId=%d\n", __func__, descriptor->channelId); |
| 519 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 520 | wrqu.freq.m = descriptor->channelId; |
| 521 | wrqu.freq.e = 0; |
| 522 | wrqu.freq.i = 0; |
| 523 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 524 | } |
| 525 | |
| 526 | #endif /* FEATURE_WLAN_CCX */ |
| 527 | |
| 528 | void hdd_SendUpdateBeaconIEsEvent(hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo) |
| 529 | { |
| 530 | union iwreq_data wrqu; |
| 531 | u8 *pBeaconIes; |
| 532 | u8 currentLen = 0; |
| 533 | char *buff; |
| 534 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 535 | |
| 536 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 537 | |
| 538 | if (0 == pCsrRoamInfo->nBeaconLength) |
| 539 | { |
| 540 | hddLog(LOGE, "%s: pCsrRoamInfo->nBeaconFrameLength = 0", __func__); |
| 541 | return; |
| 542 | } |
| 543 | pBeaconIes = (u8 *)(pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 544 | if (pBeaconIes == NULL) |
| 545 | { |
| 546 | hddLog(LOGE, "%s: Beacon IEs is NULL", __func__); |
| 547 | return; |
| 548 | } |
| 549 | |
| 550 | // pBeaconIes needs to point to the IEs |
| 551 | hddLog(LOG1, "%s: Beacon IEs is now at %02x%02x", __func__, |
| 552 | (unsigned int)pBeaconIes[0], |
| 553 | (unsigned int)pBeaconIes[1]); |
| 554 | hddLog(LOG1, "%s: Beacon IEs length = %d", __func__, pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
| 555 | |
| 556 | // We need to send the IEs to the supplicant. |
| 557 | buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); |
| 558 | if (buff == NULL) |
| 559 | { |
| 560 | hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); |
| 561 | return; |
| 562 | } |
| 563 | vos_mem_zero(buff, IW_CUSTOM_MAX); |
| 564 | |
| 565 | strLen = strlcpy(buff,"BEACONIEs=", IW_CUSTOM_MAX); |
| 566 | currentLen = strLen + 1; |
| 567 | |
| 568 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 569 | do |
| 570 | { |
| 571 | /* If the beacon size exceeds max CUSTOM event size, break it into chunks of CUSTOM event |
| 572 | * max size and send it to supplicant. Changes are done in supplicant to handle this */ |
| 573 | vos_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
| 574 | currentLen = VOS_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
| 575 | vos_mem_copy(&buff[strLen + 1], pBeaconIes+currentOffset, currentLen); |
| 576 | currentOffset += currentLen; |
| 577 | totalIeLen -= currentLen; |
| 578 | wrqu.data.length = strLen + 1 + currentLen; |
| 579 | if (totalIeLen) |
| 580 | buff[strLen] = 1; // This tells supplicant more chunks are pending |
| 581 | else |
| 582 | buff[strLen] = 0; // For last chunk of beacon IE to supplicant |
| 583 | |
| 584 | hddLog(LOG1, "%s: Beacon IEs length to supplicant = %d", __func__, currentLen); |
| 585 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 586 | } while (totalIeLen > 0); |
| 587 | |
| 588 | kfree(buff); |
| 589 | } |
| 590 | |
| 591 | static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRoamInfo) |
| 592 | { |
| 593 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 594 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 595 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 596 | union iwreq_data wrqu; |
| 597 | int we_event; |
| 598 | char *msg; |
| 599 | int type = -1; |
| 600 | |
| 601 | #if defined (WLAN_FEATURE_VOWIFI_11R) |
| 602 | // Added to find the auth type on the fly at run time |
| 603 | // rather than with cfg to see if FT is enabled |
| 604 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 605 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 606 | #endif |
| 607 | |
| 608 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 609 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 610 | we_event = SIOCGIWAP; |
| 611 | |
| 612 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
| 613 | { |
| 614 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 615 | type = WLAN_STA_ASSOC_DONE_IND; |
| 616 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 617 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 618 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 619 | { |
| 620 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_1) |
| 621 | { |
| 622 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTED_STATE_1; |
| 623 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 624 | "Connecting state to Connected State for 8-way " |
| 625 | "Handshake"); |
| 626 | } |
| 627 | else if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTING_STATE_2) |
| 628 | { |
| 629 | globalP2PConnectionStatus = P2P_CLIENT_COMPLETED_STATE; |
| 630 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 631 | "Connecting state to P2P Client Connection Completed"); |
| 632 | } |
| 633 | } |
| 634 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 635 | pr_info("wlan: connected to %02x:%02x:%02x:%02x:%02x:%02x\n", |
| 636 | wrqu.ap_addr.sa_data[0], |
| 637 | wrqu.ap_addr.sa_data[1], |
| 638 | wrqu.ap_addr.sa_data[2], |
| 639 | wrqu.ap_addr.sa_data[3], |
| 640 | wrqu.ap_addr.sa_data[4], |
| 641 | wrqu.ap_addr.sa_data[5]); |
| 642 | hdd_SendUpdateBeaconIEsEvent(pAdapter, pCsrRoamInfo); |
| 643 | |
| 644 | /* Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS is Enabled Or |
| 645 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_VOWIFI_11R is Enabled |
| 646 | * and fFTEnable is TRUE */ |
| 647 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 648 | // Send FT Keys to the supplicant when FT is enabled |
| 649 | if ((pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN_PSK) || |
| 650 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_FT_RSN) |
| 651 | #ifdef FEATURE_WLAN_CCX |
| 652 | || (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 653 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) |
| 654 | #endif |
| 655 | ) |
| 656 | { |
| 657 | hdd_SendFTAssocResponse(dev, pAdapter, pCsrRoamInfo); |
| 658 | } |
| 659 | #endif |
| 660 | } |
| 661 | else if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) // IBss Associated |
| 662 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 663 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId, ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | type = WLAN_STA_ASSOC_DONE_IND; |
| 665 | pr_info("wlan: new IBSS connection to %02x:%02x:%02x:%02x:%02x:%02x", |
| 666 | pHddStaCtx->conn_info.bssId[0], |
| 667 | pHddStaCtx->conn_info.bssId[1], |
| 668 | pHddStaCtx->conn_info.bssId[2], |
| 669 | pHddStaCtx->conn_info.bssId[3], |
| 670 | pHddStaCtx->conn_info.bssId[4], |
| 671 | pHddStaCtx->conn_info.bssId[5]); |
| 672 | } |
| 673 | else /* Not Associated */ |
| 674 | { |
| 675 | pr_info("wlan: disconnected\n"); |
| 676 | type = WLAN_STA_DISASSOC_DONE_IND; |
| 677 | memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN); |
| 678 | } |
Sudhir Sattayappa Kohalli | 90e4c75 | 2013-03-21 14:25:04 -0700 | [diff] [blame] | 679 | hdd_dump_concurrency_info(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 680 | |
| 681 | msg = NULL; |
| 682 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 683 | driver so not sending the status of the connection to supplicant*/ |
| 684 | if(pHddCtx->isLoadUnloadInProgress != TRUE) |
| 685 | { |
| 686 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 687 | #ifdef FEATURE_WLAN_CCX |
| 688 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)/* Associated */ |
| 689 | { |
| 690 | if ( (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_RSN) || |
| 691 | (pRoamProfile->AuthType.authType[0] == eCSR_AUTH_TYPE_CCKM_WPA) ) |
| 692 | hdd_SendNewAPChannelInfo(dev, pAdapter, pCsrRoamInfo); |
| 693 | } |
| 694 | #endif |
| 695 | } |
| 696 | send_btc_nlink_msg(type, 0); |
| 697 | } |
| 698 | |
| 699 | void hdd_connRemoveConnectInfo( hdd_station_ctx_t *pHddStaCtx ) |
| 700 | { |
| 701 | // Remove staId, bssId and peerMacAddress |
| 702 | pHddStaCtx->conn_info.staId [ 0 ] = 0; |
| 703 | vos_mem_zero( &pHddStaCtx->conn_info.bssId, sizeof( v_MACADDR_t ) ); |
| 704 | vos_mem_zero( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], sizeof( v_MACADDR_t ) ); |
| 705 | |
| 706 | // Clear all security settings |
| 707 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 708 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 709 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 710 | |
| 711 | vos_mem_zero( &pHddStaCtx->conn_info.Keys, sizeof( tCsrKeys ) ); |
| 712 | |
| 713 | // Set not-connected state |
| 714 | pHddStaCtx->conn_info.connDot11DesiredBssType = eCSR_BSS_TYPE_ANY; |
| 715 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected ); |
| 716 | |
| 717 | vos_mem_zero( &pHddStaCtx->conn_info.SSID, sizeof( tCsrSSIDInfo ) ); |
| 718 | } |
| 719 | /* TODO Revist this function. and data path */ |
| 720 | static VOS_STATUS hdd_roamDeregisterSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 721 | { |
| 722 | VOS_STATUS vosStatus; |
| 723 | hdd_disconnect_tx_rx(pAdapter); |
| 724 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 725 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 726 | { |
| 727 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 728 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
| 729 | "Status= %d [0x%08lX]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 730 | __func__, staId, vosStatus, vosStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | } |
| 732 | return( vosStatus ); |
| 733 | } |
| 734 | |
| 735 | |
| 736 | static eHalStatus hdd_DisConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 737 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 738 | eCsrRoamResult roamResult ) |
| 739 | { |
| 740 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 741 | VOS_STATUS vstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 742 | struct net_device *dev = pAdapter->dev; |
| 743 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 744 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 745 | |
| 746 | // Sanity check |
| 747 | if(dev == NULL) |
| 748 | { |
| 749 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 750 | "%s: net_dev is released return", __func__); |
| 751 | return eHAL_STATUS_FAILURE; |
| 752 | } |
| 753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 754 | // notify apps that we can't pass traffic anymore |
| 755 | netif_tx_disable(dev); |
| 756 | netif_carrier_off(dev); |
| 757 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 758 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 759 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 760 | /* If only STA mode is on */ |
| 761 | if((pHddCtx->concurrency_mode <= 1) && (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
| 762 | { |
| 763 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 764 | } |
| 765 | hdd_clearRoamProfileIe( pAdapter ); |
| 766 | |
| 767 | // indicate 'disconnect' status to wpa_supplicant... |
| 768 | hdd_SendAssociationEvent(dev,pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 769 | /* indicate disconnected event to nl80211 */ |
| 770 | if(roamStatus != eCSR_ROAM_IBSS_LEAVE) |
| 771 | { |
| 772 | /*During the WLAN uninitialization,supplicant is stopped before the |
| 773 | driver so not sending the status of the connection to supplicant*/ |
| 774 | if(pHddCtx->isLoadUnloadInProgress != TRUE) |
| 775 | { |
| 776 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 777 | "%s: sent disconnected event to nl80211", |
| 778 | __func__); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 779 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 780 | if(pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
| 781 | { |
| 782 | if(globalP2PConnectionStatus == P2P_CLIENT_CONNECTED_STATE_1) |
| 783 | { |
| 784 | globalP2PConnectionStatus = P2P_CLIENT_DISCONNECTED_STATE; |
| 785 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] 8 way Handshake completed " |
| 786 | "and moved to disconnected state"); |
| 787 | } |
| 788 | else if(globalP2PConnectionStatus == P2P_CLIENT_COMPLETED_STATE) |
| 789 | { |
| 790 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 791 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] P2P Client is removed " |
| 792 | "and moved to inactive state"); |
| 793 | } |
| 794 | } |
| 795 | #endif |
| 796 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */ |
| 798 | if( eCSR_ROAM_LOSTLINK == roamStatus ) |
| 799 | { |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 800 | cfg80211_disconnected(dev, pRoamInfo->reasonCode, NULL, 0, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 801 | } |
| 802 | else |
| 803 | { |
| 804 | cfg80211_disconnected(dev, WLAN_REASON_UNSPECIFIED, NULL, 0, GFP_KERNEL); |
| 805 | } |
| 806 | |
| 807 | //If the Device Mode is Station |
| 808 | // and the P2P Client is Connected |
| 809 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 810 | |
| 811 | // In case of JB, as Change-Iface may or maynot be called for p2p0 |
| 812 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
| 813 | if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 814 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 815 | (vos_concurrent_sessions_running())) |
| 816 | { |
| 817 | //Enable BMPS only of other Session is P2P Client |
| 818 | hdd_context_t *pHddCtx = NULL; |
| 819 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
| 820 | |
| 821 | if (NULL != pVosContext) |
| 822 | { |
| 823 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 824 | |
| 825 | if(NULL != pHddCtx) |
| 826 | { |
| 827 | //Only P2P Client is there Enable Bmps back |
| 828 | if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 829 | (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 830 | { |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 831 | if (pHddCtx->hdd_wlan_suspended) |
| 832 | { |
| 833 | if(WLAN_HDD_INFRA_STATION == pAdapter->device_mode) |
| 834 | { |
| 835 | hdd_reset_pwrparams(pHddCtx); |
| 836 | } |
| 837 | else |
| 838 | { |
| 839 | hdd_set_pwrparams(pHddCtx); |
| 840 | } |
| 841 | } |
| 842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 843 | hdd_enable_bmps_imps(pHddCtx); |
| 844 | } |
| 845 | } |
| 846 | } |
| 847 | } |
| 848 | } |
| 849 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 850 | |
| 851 | |
| 852 | //We should clear all sta register with TL, for now, only one. |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 853 | vstatus = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 854 | if ( !VOS_IS_STATUS_SUCCESS(vstatus ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 855 | { |
| 856 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 857 | "hdd_roamDeregisterSTA() failed to for staID %d. " |
| 858 | "Status= %d [0x%x]", |
| 859 | pHddStaCtx->conn_info.staId[0], status, status ); |
| 860 | |
| 861 | status = eHAL_STATUS_FAILURE; |
| 862 | } |
| 863 | |
| 864 | pHddCtx->sta_to_adapter[pHddStaCtx->conn_info.staId[0]] = NULL; |
| 865 | // Clear saved connection information in HDD |
| 866 | hdd_connRemoveConnectInfo( pHddStaCtx ); |
| 867 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 868 | #ifdef FEATURE_WLAN_TDLS |
| 869 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 870 | #endif |
| 871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 872 | //Unblock anyone waiting for disconnect to complete |
| 873 | complete(&pAdapter->disconnect_comp_var); |
| 874 | return( status ); |
| 875 | } |
| 876 | static VOS_STATUS hdd_roamRegisterSTA( hdd_adapter_t *pAdapter, |
| 877 | tCsrRoamInfo *pRoamInfo, |
| 878 | v_U8_t staId, |
| 879 | v_MACADDR_t *pPeerMacAddress, |
| 880 | tSirBssDescription *pBssDesc ) |
| 881 | { |
| 882 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 883 | WLAN_STADescType staDesc = {0}; |
| 884 | eCsrEncryptionType connectedCipherAlgo; |
| 885 | v_BOOL_t fConnected; |
| 886 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 887 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 888 | |
| 889 | // Get the Station ID from the one saved during the assocation. |
| 890 | staDesc.ucSTAId = staId; |
| 891 | |
| 892 | if ( pHddStaCtx->conn_info.connDot11DesiredBssType == eMib_dot11DesiredBssType_infrastructure) |
| 893 | { |
| 894 | staDesc.wSTAType = WLAN_STA_INFRA; |
| 895 | |
| 896 | // grab the bssid from the connection info in the adapter structure and hand that |
| 897 | // over to TL when registering. |
| 898 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pHddStaCtx->conn_info.bssId,sizeof(pHddStaCtx->conn_info.bssId) ); |
| 899 | } |
| 900 | else |
| 901 | { |
| 902 | // for an IBSS 'connect', setup the Station Descriptor for TL. |
| 903 | staDesc.wSTAType = WLAN_STA_IBSS; |
| 904 | |
| 905 | // Note that for IBSS, the STA MAC address and BSSID are goign to be different where |
| 906 | // in infrastructure, they are the same (BSSID is the MAC address of the AP). So, |
| 907 | // for IBSS we have a second field to pass to TL in the STA descriptor that we don't |
| 908 | // pass when making an Infrastructure connection. |
| 909 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, pPeerMacAddress->bytes,sizeof(pPeerMacAddress->bytes) ); |
| 910 | vos_mem_copy( staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 911 | } |
| 912 | |
| 913 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 914 | |
| 915 | // set the QoS field appropriately |
| 916 | if (hdd_wmm_is_active(pAdapter)) |
| 917 | { |
| 918 | staDesc.ucQosEnabled = 1; |
| 919 | } |
| 920 | else |
| 921 | { |
| 922 | staDesc.ucQosEnabled = 0; |
| 923 | } |
| 924 | |
| 925 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 926 | if ( connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE ) |
| 927 | { |
| 928 | staDesc.ucProtectedFrame = 1; |
| 929 | } |
| 930 | else |
| 931 | { |
| 932 | staDesc.ucProtectedFrame = 0; |
| 933 | |
| 934 | } |
| 935 | |
| 936 | #ifdef FEATURE_WLAN_CCX |
| 937 | staDesc.ucIsCcxSta = pRoamInfo->isCCXAssoc; |
| 938 | #endif //FEATURE_WLAN_CCX |
| 939 | |
| 940 | #ifdef VOLANS_ENABLE_SW_REPLAY_CHECK |
| 941 | /* check whether replay check is valid for the station or not */ |
| 942 | if( (eCSR_ENCRYPT_TYPE_TKIP == connectedCipherAlgo) || (eCSR_ENCRYPT_TYPE_AES == connectedCipherAlgo)) |
| 943 | { |
| 944 | /* Encryption mode is either TKIP or AES |
| 945 | and replay check is valid for only these |
| 946 | two encryption modes */ |
| 947 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 948 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 949 | "HDD register TL ucIsReplayCheckValid %d: Replay check is needed for station", staDesc.ucIsReplayCheckValid); |
| 950 | } |
| 951 | |
| 952 | else |
| 953 | { |
| 954 | /* For other encryption modes replay check is |
| 955 | not needed */ |
| 956 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
| 957 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 958 | "HDD register TL ucIsReplayCheckValid %d", staDesc.ucIsReplayCheckValid); |
| 959 | } |
| 960 | #endif |
| 961 | |
| 962 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 963 | hddLog(LOG1, "%s: WAPI STA Registered: %d", __func__, pAdapter->wapi_info.fIsWapiSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 964 | if (pAdapter->wapi_info.fIsWapiSta) |
| 965 | { |
| 966 | staDesc.ucIsWapiSta = 1; |
| 967 | } |
| 968 | else |
| 969 | { |
| 970 | staDesc.ucIsWapiSta = 0; |
| 971 | } |
| 972 | #endif /* FEATURE_WLAN_WAPI */ |
| 973 | |
| 974 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 975 | "HDD register TL Sec_enabled= %d.", staDesc.ucProtectedFrame ); |
| 976 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 977 | // UMA is Not ready yet, Xlation will be done by TL |
| 978 | staDesc.ucSwFrameTXXlation = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | staDesc.ucSwFrameRXXlation = 1; |
| 980 | staDesc.ucAddRmvLLC = 1; |
| 981 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register TL QoS_enabled=%d", |
| 982 | staDesc.ucQosEnabled ); |
| 983 | // Initialize signatures and state |
| 984 | staDesc.ucUcastSig = pRoamInfo->ucastSig; |
| 985 | staDesc.ucBcastSig = pRoamInfo->bcastSig; |
| 986 | staDesc.ucInitState = pRoamInfo->fAuthRequired ? |
| 987 | WLANTL_STA_CONNECTED : WLANTL_STA_AUTHENTICATED; |
| 988 | // Register the Station with TL... |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 989 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "%s: HDD register TL ucInitState=%d", __func__, staDesc.ucInitState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | vosStatus = WLANTL_RegisterSTAClient( pHddCtx->pvosContext, |
| 991 | hdd_rx_packet_cbk, |
| 992 | hdd_tx_complete_cbk, |
| 993 | hdd_tx_fetch_packet_cbk, &staDesc, |
| 994 | pBssDesc->rssi ); |
| 995 | |
| 996 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 997 | { |
| 998 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 999 | "WLANTL_RegisterSTAClient() failed to register. Status= %d [0x%08lX]", |
| 1000 | vosStatus, vosStatus ); |
| 1001 | return vosStatus; |
| 1002 | } |
| 1003 | |
| 1004 | // if ( WPA ), tell TL to go to 'connected' and after keys come to the driver, |
| 1005 | // then go to 'authenticated'. For all other authentication types (those that do |
| 1006 | // not require upper layer authentication) we can put TL directly into 'authenticated' |
| 1007 | // state. |
| 1008 | |
| 1009 | VOS_ASSERT( fConnected ); |
| 1010 | |
| 1011 | if ( !pRoamInfo->fAuthRequired ) |
| 1012 | { |
| 1013 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 1014 | "open/shared auth StaId= %d. Changing TL state to AUTHENTICATED at Join time", pHddStaCtx->conn_info.staId[ 0 ] ); |
| 1015 | |
| 1016 | // Connections that do not need Upper layer auth, transition TL directly |
| 1017 | // to 'Authenticated' state. |
| 1018 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
| 1019 | WLANTL_STA_AUTHENTICATED ); |
| 1020 | |
| 1021 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1022 | } |
| 1023 | else |
| 1024 | { |
| 1025 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 1026 | "ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", pHddStaCtx->conn_info.staId[ 0 ] ); |
| 1027 | |
| 1028 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, staDesc.ucSTAId, |
| 1029 | WLANTL_STA_CONNECTED ); |
| 1030 | |
| 1031 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 1032 | } |
| 1033 | return( vosStatus ); |
| 1034 | } |
| 1035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1037 | tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength) |
| 1038 | { |
| 1039 | unsigned int len = 0; |
| 1040 | u8 *pFTAssocRsp = NULL; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1041 | v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1042 | tANI_U32 rspRsnLength = 0; |
| 1043 | struct ieee80211_channel *chan; |
| 1044 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1045 | if (!rspRsnIe) |
| 1046 | { |
| 1047 | hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__); |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 1048 | return; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1049 | } |
| 1050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1051 | if (pCsrRoamInfo == NULL) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1052 | { |
| 1053 | hddLog(LOGE, "%s: Invalid CSR roam info", __func__); |
| 1054 | goto done; |
| 1055 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1056 | |
| 1057 | if (pCsrRoamInfo->nAssocRspLength == 0) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1058 | { |
| 1059 | hddLog(LOGE, "%s: Invalid assoc response length", __func__); |
| 1060 | goto done; |
| 1061 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1062 | |
| 1063 | pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 1064 | pCsrRoamInfo->nAssocReqLength); |
| 1065 | if (pFTAssocRsp == NULL) |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1066 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1067 | |
| 1068 | //pFTAssocRsp needs to point to the IEs |
| 1069 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 1070 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x\n", __func__, |
| 1071 | (unsigned int)pFTAssocRsp[0], |
| 1072 | (unsigned int)pFTAssocRsp[1]); |
| 1073 | |
| 1074 | // Send the Assoc Resp, the supplicant needs this for initial Auth. |
Madan Mohan Koyyalamudi | 1bed23d | 2012-11-13 10:59:48 -0800 | [diff] [blame] | 1075 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | rspRsnLength = len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | memcpy(rspRsnIe, pFTAssocRsp, len); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1078 | memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1079 | |
| 1080 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, (int) pCsrRoamInfo->pBssDesc->channelId); |
| 1081 | cfg80211_roamed(dev,chan,pCsrRoamInfo->bssid, |
| 1082 | reqRsnIe, reqRsnLength, |
| 1083 | rspRsnIe, rspRsnLength,GFP_KERNEL); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 1084 | |
| 1085 | done: |
| 1086 | kfree(rspRsnIe); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1087 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | |
| 1089 | static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1090 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1091 | eCsrRoamResult roamResult ) |
| 1092 | { |
| 1093 | struct net_device *dev = pAdapter->dev; |
| 1094 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1095 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1096 | VOS_STATUS vosStatus; |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 1097 | v_U8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 1098 | tANI_U32 reqRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1099 | #if defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) || defined (WLAN_FEATURE_VOWIFI_11R) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1100 | int ft_carrier_on = FALSE; |
| 1101 | #endif |
| 1102 | int status; |
| 1103 | |
| 1104 | if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult ) |
| 1105 | { |
| 1106 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Associated ); |
| 1107 | |
| 1108 | // Save the connection info from CSR... |
| 1109 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE ); |
| 1110 | #ifdef FEATURE_WLAN_WAPI |
| 1111 | if ( pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE || |
| 1112 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_WAPI_WAI_PSK ) |
| 1113 | { |
| 1114 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 1115 | } |
| 1116 | else |
| 1117 | { |
| 1118 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 1119 | } |
| 1120 | #endif /* FEATURE_WLAN_WAPI */ |
| 1121 | |
| 1122 | // indicate 'connect' status to userspace |
| 1123 | hdd_SendAssociationEvent(dev,pRoamInfo); |
| 1124 | |
| 1125 | |
| 1126 | // Initialize the Linkup event completion variable |
| 1127 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 1128 | |
| 1129 | /* |
| 1130 | Sometimes Switching ON the Carrier is taking time to activate the device properly. Before allowing any |
| 1131 | packet to go up to the application, device activation has to be ensured for proper queue mapping by the |
| 1132 | kernel. we have registered net device notifier for device change notification. With this we will come to |
| 1133 | know that the device is getting activated properly. |
| 1134 | */ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1135 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1136 | if (pHddStaCtx->ft_carrier_on == FALSE) |
| 1137 | { |
| 1138 | #endif |
| 1139 | // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable |
| 1140 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 1141 | |
| 1142 | // Enable Linkup Event Servicing which allows the net device notifier to set the linkup event variable |
| 1143 | pAdapter->isLinkUpSvcNeeded = TRUE; |
| 1144 | |
| 1145 | // Switch on the Carrier to activate the device |
| 1146 | netif_carrier_on(dev); |
| 1147 | |
| 1148 | // Wait for the Link to up to ensure all the queues are set properly by the kernel |
| 1149 | status = wait_for_completion_interruptible_timeout(&pAdapter->linkup_event_var, |
| 1150 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT)); |
| 1151 | if(!status) |
| 1152 | { |
| 1153 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Warning:ASSOC_LINKUP_TIMEOUT", __func__); |
| 1154 | } |
| 1155 | |
| 1156 | // Disable Linkup Event Servicing - no more service required from the net device notifier call |
| 1157 | pAdapter->isLinkUpSvcNeeded = FALSE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1158 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1159 | } |
| 1160 | else { |
| 1161 | pHddStaCtx->ft_carrier_on = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1162 | ft_carrier_on = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1163 | } |
| 1164 | #endif |
| 1165 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 1166 | |
Gopichand Nakkala | c369458 | 2013-02-13 20:51:22 -0800 | [diff] [blame] | 1167 | #ifdef FEATURE_WLAN_TDLS |
| 1168 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 1169 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1170 | //For reassoc, the station is already registered, all we need is to change the state |
| 1171 | //of the STA in TL. |
| 1172 | //If authentication is required (WPA/WPA2/DWEP), change TL to CONNECTED instead of AUTHENTICATED |
| 1173 | if( !pRoamInfo->fReassocReq ) |
| 1174 | { |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1175 | struct cfg80211_bss *bss; |
| 1176 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1177 | u8 *pFTAssocRsp = NULL; |
| 1178 | unsigned int assocRsplen = 0; |
| 1179 | u8 *pFTAssocReq = NULL; |
| 1180 | unsigned int assocReqlen = 0; |
| 1181 | struct ieee80211_channel *chan; |
| 1182 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1183 | v_U8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1184 | tANI_U32 rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1185 | |
| 1186 | /* add bss_id to cfg80211 data base */ |
| 1187 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 1188 | if (NULL == bss) |
| 1189 | { |
| 1190 | pr_err("wlan: Not able to create BSS entry\n"); |
| 1191 | return eHAL_STATUS_FAILURE; |
| 1192 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1193 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1194 | if(pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN || |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1195 | pRoamInfo->u.pConnectedProfile->AuthType == eCSR_AUTH_TYPE_FT_RSN_PSK ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1196 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1197 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1198 | //Association Response |
| 1199 | pFTAssocRsp = (u8 *)(pRoamInfo->pbFrames + pRoamInfo->nBeaconLength + |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1200 | pRoamInfo->nAssocReqLength); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1201 | if (pFTAssocRsp != NULL) |
| 1202 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1203 | // pFTAssocRsp needs to point to the IEs |
| 1204 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 1205 | hddLog(LOG1, "%s: AssocRsp is now at %02x%02x", __func__, |
| 1206 | (unsigned int)pFTAssocRsp[0], |
| 1207 | (unsigned int)pFTAssocRsp[1]); |
| 1208 | assocRsplen = pRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1209 | } |
| 1210 | else |
| 1211 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1212 | hddLog(LOGE, "%s:AssocRsp is NULL", __func__); |
| 1213 | assocRsplen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1214 | } |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1215 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1216 | //Association Request |
| 1217 | pFTAssocReq = (u8 *)(pRoamInfo->pbFrames + |
| 1218 | pRoamInfo->nBeaconLength); |
| 1219 | if (pFTAssocReq != NULL) |
| 1220 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1221 | if(!ft_carrier_on) |
| 1222 | { |
| 1223 | // pFTAssocReq needs to point to the IEs |
| 1224 | pFTAssocReq += FT_ASSOC_REQ_IES_OFFSET; |
| 1225 | hddLog(LOG1, "%s: pFTAssocReq is now at %02x%02x", __func__, |
| 1226 | (unsigned int)pFTAssocReq[0], |
| 1227 | (unsigned int)pFTAssocReq[1]); |
| 1228 | assocReqlen = pRoamInfo->nAssocReqLength - FT_ASSOC_REQ_IES_OFFSET; |
| 1229 | } |
| 1230 | else |
| 1231 | { |
| 1232 | /* This should contain only the FTIEs */ |
| 1233 | assocReqlen = pRoamInfo->nAssocReqLength; |
| 1234 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1235 | } |
| 1236 | else |
| 1237 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1238 | hddLog(LOGE, "%s:AssocReq is NULL", __func__); |
| 1239 | assocReqlen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1240 | } |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1241 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1242 | if(ft_carrier_on) |
| 1243 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1244 | hddLog(LOG1, "%s ft_carrier_on is %d, sending roamed " |
| 1245 | "indication\n", __FUNCTION__, ft_carrier_on); |
| 1246 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
| 1247 | (int)pRoamInfo->pBssDesc->channelId); |
| 1248 | hddLog(LOG1, "assocReqlen %d assocRsplen %d\n", assocReqlen, |
| 1249 | assocRsplen); |
| 1250 | cfg80211_roamed(dev,chan, pRoamInfo->bssid, |
| 1251 | pFTAssocReq, assocReqlen, pFTAssocRsp, assocRsplen, |
| 1252 | GFP_KERNEL); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1253 | } |
| 1254 | else |
| 1255 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1256 | hddLog(LOG1, "%s ft_carrier_on is %d, sending connect " |
| 1257 | "indication\n", __FUNCTION__, ft_carrier_on); |
| 1258 | cfg80211_connect_result(dev, pRoamInfo->bssid, |
| 1259 | pFTAssocReq, assocReqlen, |
| 1260 | pFTAssocRsp, assocRsplen, |
| 1261 | WLAN_STATUS_SUCCESS, |
| 1262 | GFP_KERNEL); |
| 1263 | cfg80211_put_bss(bss); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1264 | } |
| 1265 | } |
| 1266 | else |
| 1267 | #endif |
| 1268 | { |
| 1269 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 1270 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1271 | pAdapter->sessionId, |
| 1272 | &reqRsnLength, |
| 1273 | reqRsnIe); |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1274 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1275 | csrRoamGetWpaRsnRspIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1276 | pAdapter->sessionId, |
| 1277 | &rspRsnLength, |
| 1278 | rspRsnIe); |
| 1279 | #if defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1280 | if(ft_carrier_on) |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1281 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1282 | else |
| 1283 | #endif /* FEATURE_WLAN_CCX */ |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1284 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1285 | { |
Madan Mohan Koyyalamudi | f146b38 | 2012-11-06 18:53:10 -0800 | [diff] [blame] | 1286 | /* inform connect result to nl80211 */ |
| 1287 | cfg80211_connect_result(dev, pRoamInfo->bssid, |
| 1288 | reqRsnIe, reqRsnLength, |
| 1289 | rspRsnIe, rspRsnLength, |
| 1290 | WLAN_STATUS_SUCCESS, |
| 1291 | GFP_KERNEL); |
| 1292 | |
| 1293 | cfg80211_put_bss(bss); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 1294 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1295 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1296 | // Register the Station with TL after associated... |
| 1297 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
| 1298 | pRoamInfo, |
| 1299 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1300 | NULL, |
| 1301 | pRoamInfo->pBssDesc ); |
| 1302 | } |
| 1303 | else |
| 1304 | { |
Madan Mohan Koyyalamudi | 2dd4c8d | 2012-11-08 14:44:14 -0800 | [diff] [blame] | 1305 | /* wpa supplicant expecting WPA/RSN IE in connect result */ |
| 1306 | /* in case of reassociation also need to indicate it to supplicant */ |
| 1307 | csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1308 | pAdapter->sessionId, |
| 1309 | &reqRsnLength, |
| 1310 | reqRsnIe); |
| 1311 | |
| 1312 | hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1313 | //Reassoc successfully |
| 1314 | if( pRoamInfo->fAuthRequired ) |
| 1315 | { |
| 1316 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, pHddStaCtx->conn_info.staId[ 0 ], |
| 1317 | WLANTL_STA_CONNECTED ); |
| 1318 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_FALSE; |
| 1319 | } |
| 1320 | else |
| 1321 | { |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 1322 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 1323 | "%s: staId: %d Changing TL state to AUTHENTICATED", |
| 1324 | __func__, pHddStaCtx->conn_info.staId[ 0 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, pHddStaCtx->conn_info.staId[ 0 ], |
| 1326 | WLANTL_STA_AUTHENTICATED ); |
| 1327 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1328 | } |
| 1329 | } |
| 1330 | |
| 1331 | if ( VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1332 | { |
| 1333 | // perform any WMM-related association processing |
| 1334 | hdd_wmm_assoc(pAdapter, pRoamInfo, eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 1335 | } |
| 1336 | else |
| 1337 | { |
| 1338 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 1339 | "Cannot register STA with TL. Failed with vosStatus = %d [%08lX]", |
| 1340 | vosStatus, vosStatus ); |
| 1341 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 1342 | #ifdef WLAN_FEATURE_11W |
| 1343 | vos_mem_zero( &pAdapter->hdd_stats.hddPmfStats, |
| 1344 | sizeof(pAdapter->hdd_stats.hddPmfStats) ); |
| 1345 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1346 | // Start the Queue |
| 1347 | netif_tx_wake_all_queues(dev); |
| 1348 | } |
| 1349 | else |
| 1350 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 1352 | |
| 1353 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1354 | pr_info("wlan: connection failed with %02x:%02x:%02x:%02x:%02x:%02x" |
| 1355 | " reason:%d and Status:%d\n", pWextState->req_bssId[0], |
| 1356 | pWextState->req_bssId[1], pWextState->req_bssId[2], |
| 1357 | pWextState->req_bssId[3], pWextState->req_bssId[4], |
| 1358 | pWextState->req_bssId[5], roamResult, roamStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1359 | |
| 1360 | /*Handle all failure conditions*/ |
| 1361 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected); |
| 1362 | if((pHddCtx->concurrency_mode <= 1) && (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
| 1363 | { |
| 1364 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 1365 | } |
| 1366 | |
| 1367 | //If the Device Mode is Station |
| 1368 | // and the P2P Client is Connected |
| 1369 | //Enable BMPS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1370 | |
| 1371 | // In case of JB, as Change-Iface may or maynot be called for p2p0 |
| 1372 | // Enable BMPS/IMPS in case P2P_CLIENT disconnected |
| 1373 | if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1374 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1375 | (vos_concurrent_sessions_running())) |
| 1376 | { |
| 1377 | //Enable BMPS only of other Session is P2P Client |
| 1378 | hdd_context_t *pHddCtx = NULL; |
| 1379 | v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL ); |
| 1380 | |
| 1381 | if (NULL != pVosContext) |
| 1382 | { |
| 1383 | pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext); |
| 1384 | |
| 1385 | if(NULL != pHddCtx) |
| 1386 | { |
| 1387 | //Only P2P Client is there Enable Bmps back |
| 1388 | if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1389 | (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1390 | { |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 1391 | if (pHddCtx->hdd_wlan_suspended) |
| 1392 | { |
| 1393 | if(WLAN_HDD_INFRA_STATION == pAdapter->device_mode) |
| 1394 | { |
| 1395 | hdd_reset_pwrparams(pHddCtx); |
| 1396 | } |
| 1397 | else |
| 1398 | { |
| 1399 | hdd_set_pwrparams(pHddCtx); |
| 1400 | } |
| 1401 | } |
| 1402 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1403 | hdd_enable_bmps_imps(pHddCtx); |
| 1404 | } |
| 1405 | } |
| 1406 | } |
| 1407 | } |
| 1408 | |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 1409 | /* CR465478: Only send up a connection failure result when CSR has |
| 1410 | * completed operation - with a ASSOCIATION_FAILURE status. */ |
| 1411 | if ( eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1412 | { |
James Zmuda | fbf5ffc | 2013-03-25 12:45:35 -0700 | [diff] [blame] | 1413 | /* inform association failure event to nl80211 */ |
| 1414 | if ( eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult ) |
| 1415 | { |
| 1416 | cfg80211_connect_result ( dev, pWextState->req_bssId, |
| 1417 | NULL, 0, NULL, 0, |
| 1418 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
| 1419 | GFP_KERNEL ); |
| 1420 | } |
| 1421 | else |
| 1422 | { |
| 1423 | cfg80211_connect_result ( dev, pWextState->req_bssId, |
| 1424 | NULL, 0, NULL, 0, |
| 1425 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
| 1426 | GFP_KERNEL ); |
| 1427 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1428 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1429 | |
Madan Mohan Koyyalamudi | ee255f1 | 2012-09-28 15:41:19 -0700 | [diff] [blame] | 1430 | /*Clear the roam profile*/ |
| 1431 | hdd_clearRoamProfileIe( pAdapter ); |
| 1432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1433 | netif_tx_disable(dev); |
| 1434 | netif_carrier_off(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1435 | |
| 1436 | if (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) |
| 1437 | { |
| 1438 | /* Association failed; Reset the country code information |
| 1439 | * so that it re-initialize the valid channel list*/ |
| 1440 | hdd_ResetCountryCodeAfterDisAssoc(pAdapter); |
| 1441 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1442 | } |
| 1443 | |
| 1444 | return eHAL_STATUS_SUCCESS; |
| 1445 | } |
| 1446 | |
| 1447 | /**============================================================================ |
| 1448 | * |
| 1449 | @brief roamRoamIbssIndicationHandler() - Here we update the status of the |
| 1450 | Ibss when we receive information that we have started/joined an ibss session |
| 1451 | We always return SUCCESS. |
| 1452 | |
| 1453 | ===========================================================================*/ |
| 1454 | static eHalStatus roamRoamIbssIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1455 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1456 | eCsrRoamResult roamResult ) |
| 1457 | { |
| 1458 | switch( roamResult ) |
| 1459 | { |
| 1460 | // both IBSS Started and IBSS Join should come in here. |
| 1461 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 1462 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 1463 | { |
| 1464 | // we should have a pRoamInfo on this callback... |
| 1465 | VOS_ASSERT( pRoamInfo ); |
| 1466 | |
| 1467 | // When IBSS Started comes from CSR, we need to move connection state to |
| 1468 | // IBSS Disconnected (meaning no peers are in the IBSS). |
| 1469 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssDisconnected ); |
| 1470 | |
| 1471 | break; |
| 1472 | } |
| 1473 | |
| 1474 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 1475 | { |
| 1476 | VOS_ASSERT( pRoamInfo ); |
| 1477 | |
| 1478 | break; |
| 1479 | } |
| 1480 | |
| 1481 | default: |
| 1482 | break; |
| 1483 | } |
| 1484 | |
| 1485 | return( eHAL_STATUS_SUCCESS ); |
| 1486 | } |
| 1487 | |
| 1488 | /**============================================================================ |
| 1489 | * |
| 1490 | @brief roamSaveIbssStation() - Save the IBSS peer MAC address in the adapter. |
| 1491 | This information is passed to iwconfig later. The peer that joined |
| 1492 | last is passed as information to iwconfig. |
| 1493 | If we add HDD_MAX_NUM_IBSS_STA or less STA we return success else we |
| 1494 | return FALSE. |
| 1495 | |
| 1496 | ===========================================================================*/ |
| 1497 | static int roamSaveIbssStation( hdd_station_ctx_t *pHddStaCtx, v_U8_t staId, v_MACADDR_t *peerMacAddress ) |
| 1498 | { |
| 1499 | int fSuccess = FALSE; |
| 1500 | int idx = 0; |
| 1501 | |
| 1502 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 1503 | { |
| 1504 | if ( 0 == pHddStaCtx->conn_info.staId[ idx ] ) |
| 1505 | { |
| 1506 | pHddStaCtx->conn_info.staId[ idx ] = staId; |
| 1507 | |
| 1508 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ], peerMacAddress ); |
| 1509 | |
| 1510 | fSuccess = TRUE; |
| 1511 | break; |
| 1512 | } |
| 1513 | } |
| 1514 | |
| 1515 | return( fSuccess ); |
| 1516 | } |
| 1517 | /**============================================================================ |
| 1518 | * |
| 1519 | @brief roamRemoveIbssStation() - Remove the IBSS peer MAC address in the adapter. |
| 1520 | If we remove HDD_MAX_NUM_IBSS_STA or less STA we return success else we |
| 1521 | return FALSE. |
| 1522 | |
| 1523 | ===========================================================================*/ |
| 1524 | static int roamRemoveIbssStation( hdd_station_ctx_t *pHddStaCtx, v_U8_t staId ) |
| 1525 | { |
| 1526 | int fSuccess = FALSE; |
| 1527 | int idx = 0; |
| 1528 | v_U8_t valid_idx = 0; |
| 1529 | v_U8_t del_idx = 0; |
| 1530 | |
| 1531 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 1532 | { |
| 1533 | if ( staId == pHddStaCtx->conn_info.staId[ idx ] ) |
| 1534 | { |
| 1535 | pHddStaCtx->conn_info.staId[ idx ] = 0; |
| 1536 | |
| 1537 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ idx ] ); |
| 1538 | |
| 1539 | fSuccess = TRUE; |
| 1540 | // Note the deleted Index, if its 0 we need special handling |
| 1541 | del_idx = idx; |
| 1542 | } |
| 1543 | else |
| 1544 | { |
| 1545 | if (pHddStaCtx->conn_info.staId[idx] != 0) |
| 1546 | { |
| 1547 | valid_idx = idx; |
| 1548 | } |
| 1549 | } |
| 1550 | } |
| 1551 | |
| 1552 | // Find next active staId, to have a valid sta trigger for TL. |
| 1553 | if (fSuccess == TRUE) |
| 1554 | { |
| 1555 | if (del_idx == 0) |
| 1556 | { |
| 1557 | if (pHddStaCtx->conn_info.staId[valid_idx] != 0) |
| 1558 | { |
| 1559 | pHddStaCtx->conn_info.staId[0] = pHddStaCtx->conn_info.staId[valid_idx]; |
| 1560 | vos_copy_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ 0 ], |
| 1561 | &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ]); |
| 1562 | |
| 1563 | pHddStaCtx->conn_info.staId[valid_idx] = 0; |
| 1564 | vos_zero_macaddr( &pHddStaCtx->conn_info.peerMacAddress[ valid_idx ] ); |
| 1565 | } |
| 1566 | } |
| 1567 | } |
| 1568 | return( fSuccess ); |
| 1569 | } |
| 1570 | |
| 1571 | /**============================================================================ |
| 1572 | * |
| 1573 | @brief roamIbssConnectHandler() : We update the status of the IBSS to |
| 1574 | connected in this function. |
| 1575 | |
| 1576 | ===========================================================================*/ |
| 1577 | static eHalStatus roamIbssConnectHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo ) |
| 1578 | { |
| 1579 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "IBSS Connect Indication from SME!!!" ); |
| 1580 | // Set the internal connection state to show 'IBSS Connected' (IBSS with a partner stations)... |
| 1581 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_IbssConnected ); |
| 1582 | |
| 1583 | // Save the connection info from CSR... |
| 1584 | hdd_connSaveConnectInfo( pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS ); |
| 1585 | |
| 1586 | // Send the bssid address to the wext. |
| 1587 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1588 | /* add bss_id to cfg80211 data base */ |
| 1589 | wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 1590 | /* send ibss join indication to nl80211 */ |
| 1591 | cfg80211_ibss_joined(pAdapter->dev, &pRoamInfo->bssid[0], GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1592 | |
| 1593 | return( eHAL_STATUS_SUCCESS ); |
| 1594 | } |
| 1595 | /**============================================================================ |
| 1596 | * |
| 1597 | @brief hdd_RoamSetKeyCompleteHandler() - Update the security parameters. |
| 1598 | |
| 1599 | ===========================================================================*/ |
| 1600 | static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1601 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1602 | eCsrRoamResult roamResult ) |
| 1603 | { |
| 1604 | eCsrEncryptionType connectedCipherAlgo; |
| 1605 | v_BOOL_t fConnected = FALSE; |
| 1606 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1607 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1608 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1609 | ENTER(); |
| 1610 | // if ( WPA ), tell TL to go to 'authenticated' after the keys are set. |
| 1611 | // then go to 'authenticated'. For all other authentication types (those that do |
| 1612 | // not require upper layer authentication) we can put TL directly into 'authenticated' |
| 1613 | // state. |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1615 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 1616 | if( fConnected ) |
| 1617 | { |
| 1618 | // TODO: Considering getting a state machine in HDD later. |
| 1619 | // This routuine is invoked twice. 1)set PTK 2)set GTK. The folloing if statement will be |
| 1620 | // TRUE when setting GTK. At this time we don't handle the state in detail. |
| 1621 | // Related CR: 174048 - TL not in authenticated state |
| 1622 | if(( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) && (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired) |
| 1623 | { |
| 1624 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 1625 | "Key set for StaId= %d. Changing TL state to AUTHENTICATED", pHddStaCtx->conn_info.staId[ 0 ] ); |
| 1626 | |
| 1627 | // Connections that do not need Upper layer authentication, transition TL |
| 1628 | // to 'Authenticated' state after the keys are set. |
| 1629 | vosStatus = WLANTL_ChangeSTAState( pHddCtx->pvosContext, pHddStaCtx->conn_info.staId[ 0 ], |
| 1630 | WLANTL_STA_AUTHENTICATED ); |
| 1631 | |
| 1632 | pHddStaCtx->conn_info.uIsAuthenticated = VOS_TRUE; |
| 1633 | } |
Gopichand Nakkala | 8b54e91 | 2013-03-11 10:44:21 +0530 | [diff] [blame] | 1634 | else |
| 1635 | { |
| 1636 | vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext, |
| 1637 | pHddStaCtx->conn_info.staId[ 0 ]); |
| 1638 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1639 | |
| 1640 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 1641 | } |
| 1642 | else |
| 1643 | { |
| 1644 | // possible disassoc after issuing set key and waiting set key complete |
| 1645 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 1646 | } |
| 1647 | |
| 1648 | EXIT(); |
| 1649 | return( eHAL_STATUS_SUCCESS ); |
| 1650 | } |
| 1651 | /**============================================================================ |
| 1652 | * |
| 1653 | @brief hdd_RoamMicErrorIndicationHandler() - This function indicates the Mic failure to the supplicant. |
| 1654 | ===========================================================================*/ |
| 1655 | static eHalStatus hdd_RoamMicErrorIndicationHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1656 | tANI_U32 roamId, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
| 1657 | { |
| 1658 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1659 | |
| 1660 | if( eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 1661 | TKIP_COUNTER_MEASURE_STOPED == pHddStaCtx->WextState.mTKIPCounterMeasures ) |
| 1662 | { |
| 1663 | struct iw_michaelmicfailure msg; |
| 1664 | union iwreq_data wreq; |
| 1665 | memset(&msg, '\0', sizeof(msg)); |
| 1666 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 1667 | memcpy(msg.src_addr.sa_data, pRoamInfo->u.pMICFailureInfo->taMacAddr, sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
| 1668 | hddLog(LOG1, "MIC MAC %02x:%02x:%02x:%02x:%02x:%02x", |
| 1669 | msg.src_addr.sa_data[0], |
| 1670 | msg.src_addr.sa_data[1], |
| 1671 | msg.src_addr.sa_data[2], |
| 1672 | msg.src_addr.sa_data[3], |
| 1673 | msg.src_addr.sa_data[4], |
| 1674 | msg.src_addr.sa_data[5]); |
| 1675 | |
| 1676 | if(pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) |
| 1677 | msg.flags = IW_MICFAILURE_GROUP; |
| 1678 | else |
| 1679 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 1680 | memset(&wreq, 0, sizeof(wreq)); |
| 1681 | wreq.data.length = sizeof(msg); |
| 1682 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, (char *)&msg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1683 | /* inform mic failure to nl80211 */ |
| 1684 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 1685 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 1686 | ((pRoamInfo->u.pMICFailureInfo->multicast == eSIR_TRUE) ? |
| 1687 | NL80211_KEYTYPE_GROUP : |
| 1688 | NL80211_KEYTYPE_PAIRWISE), |
| 1689 | pRoamInfo->u.pMICFailureInfo->keyId, |
| 1690 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 1691 | GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1692 | |
| 1693 | } |
| 1694 | |
| 1695 | return( eHAL_STATUS_SUCCESS ); |
| 1696 | } |
| 1697 | |
| 1698 | /**============================================================================ |
| 1699 | * |
| 1700 | @brief roamRoamConnectStatusUpdateHandler() - The Ibss connection status is |
| 1701 | updated regularly here in this function. |
| 1702 | |
| 1703 | ===========================================================================*/ |
| 1704 | static eHalStatus roamRoamConnectStatusUpdateHandler( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 1705 | tANI_U32 roamId, eRoamCmdStatus roamStatus, |
| 1706 | eCsrRoamResult roamResult ) |
| 1707 | { |
| 1708 | VOS_STATUS vosStatus; |
| 1709 | |
| 1710 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1711 | switch( roamResult ) |
| 1712 | { |
| 1713 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 1714 | { |
| 1715 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1716 | "IBSS New Peer indication from SME " |
| 1717 | "with peerMac %2x-%2x-%2x-%2x-%2x-%2x and stationID= %d", |
| 1718 | pRoamInfo->peerMac[0], pRoamInfo->peerMac[1], pRoamInfo->peerMac[2], |
| 1719 | pRoamInfo->peerMac[3], pRoamInfo->peerMac[4], pRoamInfo->peerMac[5], |
| 1720 | pRoamInfo->staId ); |
| 1721 | |
| 1722 | if ( !roamSaveIbssStation( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pRoamInfo->staId, (v_MACADDR_t *)pRoamInfo->peerMac ) ) |
| 1723 | { |
| 1724 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 1725 | "New IBSS peer but we already have the max we can handle. Can't register this one" ); |
| 1726 | break; |
| 1727 | } |
| 1728 | |
| 1729 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 1730 | |
| 1731 | // Register the Station with TL for the new peer. |
| 1732 | vosStatus = hdd_roamRegisterSTA( pAdapter, |
| 1733 | pRoamInfo, |
| 1734 | pRoamInfo->staId, |
| 1735 | (v_MACADDR_t *)pRoamInfo->peerMac, |
| 1736 | pRoamInfo->pBssDesc ); |
| 1737 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1738 | { |
| 1739 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1740 | "Cannot register STA with TL for IBSS. Failed with vosStatus = %d [%08lX]", |
| 1741 | vosStatus, vosStatus ); |
| 1742 | } |
| 1743 | |
| 1744 | netif_carrier_on(pAdapter->dev); |
| 1745 | netif_tx_start_all_queues(pAdapter->dev); |
| 1746 | break; |
| 1747 | } |
| 1748 | |
| 1749 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 1750 | { |
| 1751 | |
| 1752 | roamIbssConnectHandler( pAdapter, pRoamInfo ); |
| 1753 | |
| 1754 | break; |
| 1755 | } |
| 1756 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 1757 | { |
| 1758 | |
| 1759 | if ( !roamRemoveIbssStation( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pRoamInfo->staId ) ) |
| 1760 | { |
| 1761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 1762 | "IBSS peer departed by cannot find peer in our registration table with TL" ); |
| 1763 | } |
| 1764 | |
| 1765 | hdd_roamDeregisterSTA( pAdapter, pRoamInfo->staId ); |
| 1766 | |
| 1767 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 1768 | |
| 1769 | break; |
| 1770 | } |
| 1771 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 1772 | { |
| 1773 | // Stop only when we are inactive |
| 1774 | netif_tx_disable(pAdapter->dev); |
| 1775 | netif_carrier_off(pAdapter->dev); |
| 1776 | hdd_connSetConnectionState( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), eConnectionState_NotConnected ); |
| 1777 | |
| 1778 | // Send the bssid address to the wext. |
| 1779 | hdd_SendAssociationEvent(pAdapter->dev, pRoamInfo); |
| 1780 | // clean up data path |
| 1781 | hdd_disconnect_tx_rx(pAdapter); |
| 1782 | break; |
| 1783 | } |
| 1784 | default: |
| 1785 | break; |
| 1786 | |
| 1787 | } |
| 1788 | |
| 1789 | return( eHAL_STATUS_SUCCESS ); |
| 1790 | } |
| 1791 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1792 | #ifdef FEATURE_WLAN_TDLS |
| 1793 | /**============================================================================ |
| 1794 | * |
| 1795 | @brief hdd_roamRegisterTDLSSTA() - Construct the staDesc and register with |
| 1796 | TL the new STA. This is called as part of ADD_STA in the TDLS setup |
| 1797 | Return: VOS_STATUS |
| 1798 | |
| 1799 | ===========================================================================*/ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1800 | VOS_STATUS hdd_roamRegisterTDLSSTA( hdd_adapter_t *pAdapter, |
| 1801 | tANI_U8 *peerMac, tANI_U16 staId, tANI_U8 ucastSig) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1802 | { |
| 1803 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1804 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 1805 | VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; |
| 1806 | WLAN_STADescType staDesc = {0}; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1807 | eCsrEncryptionType connectedCipherAlgo = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 1808 | v_BOOL_t fConnected = FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1809 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1810 | fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo ); |
| 1811 | if (!fConnected) { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1812 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1813 | "%s not connected. ignored", __func__); |
| 1814 | return VOS_FALSE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1815 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1816 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1817 | /* |
| 1818 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 1819 | * be peer MAC, here we are wokrking on direct Link |
| 1820 | */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1821 | staDesc.ucSTAId = staId ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1822 | |
| 1823 | staDesc.wSTAType = WLAN_STA_TDLS ; |
| 1824 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1825 | vos_mem_copy( staDesc.vSTAMACAddress.bytes, peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1826 | sizeof(tSirMacAddr) ); |
| 1827 | |
| 1828 | vos_mem_copy(staDesc.vBSSIDforIBSS.bytes, pHddStaCtx->conn_info.bssId,6 ); |
| 1829 | vos_copy_macaddr( &staDesc.vSelfMACAddress, &pAdapter->macAddressCurrent ); |
| 1830 | |
| 1831 | /* set the QoS field appropriately ..*/ |
| 1832 | (hdd_wmm_is_active(pAdapter)) ? (staDesc.ucQosEnabled = 1) |
| 1833 | : (staDesc.ucQosEnabled = 0) ; |
| 1834 | |
| 1835 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "HDD register \ |
| 1836 | TL QoS_enabled=%d\n", staDesc.ucQosEnabled ); |
| 1837 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1838 | staDesc.ucProtectedFrame = (connectedCipherAlgo != eCSR_ENCRYPT_TYPE_NONE) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1839 | |
| 1840 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 1841 | "HDD register TL Sec_enabled= %d.\n", staDesc.ucProtectedFrame ); |
| 1842 | |
| 1843 | /* |
| 1844 | * UMA is ready we inform TL to do frame translation. |
| 1845 | */ |
| 1846 | staDesc.ucSwFrameTXXlation = 1; |
| 1847 | staDesc.ucSwFrameRXXlation = 1; |
| 1848 | staDesc.ucAddRmvLLC = 1; |
| 1849 | |
| 1850 | /* Initialize signatures and state */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1851 | staDesc.ucUcastSig = ucastSig ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1852 | |
| 1853 | /* tdls Direct Link do not need bcastSig */ |
| 1854 | staDesc.ucBcastSig = 0 ; |
| 1855 | |
| 1856 | #ifdef VOLANS_ENABLE_SW_REPLAY_CHECK |
| 1857 | if(staDesc.ucProtectedFrame) |
| 1858 | staDesc.ucIsReplayCheckValid = VOS_TRUE; |
| 1859 | else |
| 1860 | staDesc.ucIsReplayCheckValid = VOS_FALSE; |
| 1861 | #endif |
| 1862 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1863 | staDesc.ucInitState = WLANTL_STA_AUTHENTICATED ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1864 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1865 | /* Register the Station with TL... */ |
| 1866 | vosStatus = WLANTL_RegisterSTAClient( pVosContext, |
| 1867 | hdd_rx_packet_cbk, |
| 1868 | hdd_tx_complete_cbk, |
| 1869 | hdd_tx_fetch_packet_cbk, &staDesc, 0 ); |
| 1870 | |
| 1871 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1872 | { |
| 1873 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1874 | "WLANTL_RegisterSTAClient() failed to register. \ |
| 1875 | Status= %d [0x%08lX]", vosStatus, vosStatus ); |
| 1876 | return vosStatus; |
| 1877 | } |
| 1878 | |
| 1879 | return( vosStatus ); |
| 1880 | } |
| 1881 | |
Chauhan Rajesh | b48f96d | 2013-01-24 21:00:15 -0800 | [diff] [blame] | 1882 | static VOS_STATUS hdd_roamDeregisterTDLSSTA( hdd_adapter_t *pAdapter, tANI_U8 staId ) |
| 1883 | { |
| 1884 | VOS_STATUS vosStatus; |
| 1885 | vosStatus = WLANTL_ClearSTAClient( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, staId ); |
| 1886 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1887 | { |
| 1888 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 1889 | "%s: WLANTL_ClearSTAClient() failed to for staID %d. " |
| 1890 | "Status= %d [0x%08lX]", |
| 1891 | __func__, staId, vosStatus, vosStatus ); |
| 1892 | } |
| 1893 | return( vosStatus ); |
| 1894 | } |
| 1895 | |
| 1896 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1897 | /* |
| 1898 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 1899 | * TL in case of new TDLS client is added and deregistration at the time |
| 1900 | * TDLS client is deleted. |
| 1901 | */ |
| 1902 | |
| 1903 | eHalStatus hdd_RoamTdlsStatusUpdateHandler(hdd_adapter_t *pAdapter, |
| 1904 | tCsrRoamInfo *pRoamInfo, |
| 1905 | tANI_U32 roamId, |
| 1906 | eRoamCmdStatus roamStatus, |
| 1907 | eCsrRoamResult roamResult) |
| 1908 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1909 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1910 | eHalStatus status = eHAL_STATUS_FAILURE ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 1911 | tANI_U8 staIdx; |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 1912 | |
| 1913 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 1914 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 1915 | ("hdd_tdlsStatusUpdate: %s staIdx %d %02x:%02x:%02x:%02x:%02x:%02x \n"), |
| 1916 | roamResult == eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : |
| 1917 | roamResult == eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 1918 | roamResult == eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" : |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 1919 | roamResult == eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND? "DEL_ALL_TDLS_PEER_IND" : |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1920 | roamResult == eCSR_ROAM_RESULT_UPDATE_TDLS_PEER? "UPDATE_TDLS_PEER" : |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 1921 | "UNKNOWN", |
| 1922 | pRoamInfo->staId, |
| 1923 | pRoamInfo->peerMac[0], |
| 1924 | pRoamInfo->peerMac[1], |
| 1925 | pRoamInfo->peerMac[2], |
| 1926 | pRoamInfo->peerMac[3], |
| 1927 | pRoamInfo->peerMac[4], |
| 1928 | pRoamInfo->peerMac[5]) ; |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 1929 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1930 | switch( roamResult ) |
| 1931 | { |
| 1932 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 1933 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 1934 | if(eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 1935 | { |
| 1936 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1937 | ("%s: Add Sta is failed. %d"),__func__, pRoamInfo->statusCode); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 1938 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1939 | else |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1940 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1941 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1942 | /* check if there is available index for this new TDLS STA */ |
| 1943 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
| 1944 | { |
| 1945 | if (0 == pHddCtx->tdlsConnInfo[staIdx].staId ) |
| 1946 | { |
| 1947 | pHddCtx->tdlsConnInfo[staIdx].sessionId = pRoamInfo->sessionId; |
| 1948 | pHddCtx->tdlsConnInfo[staIdx].staId = pRoamInfo->staId; |
| 1949 | |
| 1950 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1951 | ("TDLS: STA IDX at %d is %d " |
| 1952 | "of mac %02x:%02x:%02x:%02x:%02x:%02x"), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1953 | staIdx, pHddCtx->tdlsConnInfo[staIdx].staId, |
| 1954 | pRoamInfo->peerMac[0], |
| 1955 | pRoamInfo->peerMac[1], |
| 1956 | pRoamInfo->peerMac[2], |
| 1957 | pRoamInfo->peerMac[3], |
| 1958 | pRoamInfo->peerMac[4], |
| 1959 | pRoamInfo->peerMac[5]) ; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1960 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1961 | vos_copy_macaddr(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1962 | (v_MACADDR_t *)pRoamInfo->peerMac) ; |
| 1963 | status = eHAL_STATUS_SUCCESS ; |
| 1964 | break ; |
| 1965 | } |
| 1966 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1967 | if (staIdx < HDD_MAX_NUM_TDLS_STA) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1968 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1969 | if (-1 == wlan_hdd_tdls_set_sta_id(pAdapter, pRoamInfo->peerMac, pRoamInfo->staId)) { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1970 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1971 | "wlan_hdd_tdls_set_sta_id() failed"); |
| 1972 | return VOS_FALSE; |
| 1973 | } |
| 1974 | |
| 1975 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 1976 | /* store the ucast signature which will be used later when |
| 1977 | registering to TL |
| 1978 | */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 1979 | wlan_hdd_tdls_set_signature( pAdapter, pRoamInfo->peerMac, pRoamInfo->ucastSig ); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1980 | } |
| 1981 | else |
| 1982 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1983 | status = eHAL_STATUS_FAILURE; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1984 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1985 | "no availalbe slot in conn_info. staId %d cannot be stored", pRoamInfo->staId); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1986 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1987 | pAdapter->tdlsAddStaStatus = status; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1988 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 1989 | complete(&pAdapter->tdls_add_station_comp); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1990 | break ; |
| 1991 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1992 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 1993 | { |
| 1994 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) |
| 1995 | { |
| 1996 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1997 | "%s: Add Sta is failed. %d", __func__, pRoamInfo->statusCode); |
| 1998 | } |
| 1999 | /* store the ucast signature which will be used later when |
| 2000 | * registering to TL |
| 2001 | */ |
| 2002 | pAdapter->tdlsAddStaStatus = pRoamInfo->statusCode; |
| 2003 | complete(&pAdapter->tdls_add_station_comp); |
| 2004 | break; |
| 2005 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2006 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2007 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2008 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2009 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2010 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 2011 | pRoamInfo->staId == pHddCtx->tdlsConnInfo[staIdx].staId) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2012 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2014 | ("HDD: del STA IDX = %x"), pRoamInfo->staId) ; |
| 2015 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2016 | wlan_hdd_tdls_reset_peer(pAdapter, pRoamInfo->peerMac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2017 | hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId ); |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2018 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2019 | |
| 2020 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 2021 | |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2022 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 2023 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
| 2024 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2025 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2026 | wlan_hdd_tdls_check_bmps(pAdapter); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2027 | status = eHAL_STATUS_SUCCESS ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2028 | break ; |
| 2029 | } |
| 2030 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2031 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2032 | break ; |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 2033 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 2034 | { |
| 2035 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2036 | "%s: Sending teardown to supplicant with reason code %u", |
| 2037 | __func__, pRoamInfo->reasonCode); |
| 2038 | |
| 2039 | #ifdef CONFIG_TDLS_IMPLICIT |
| 2040 | cfg80211_tdls_oper_request(pAdapter->dev, |
| 2041 | pRoamInfo->peerMac, |
| 2042 | NL80211_TDLS_TEARDOWN, |
| 2043 | pRoamInfo->reasonCode, |
| 2044 | GFP_KERNEL); |
| 2045 | #endif |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2046 | status = eHAL_STATUS_SUCCESS ; |
| 2047 | break ; |
| 2048 | } |
| 2049 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 2050 | { |
| 2051 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2052 | for ( staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++ ) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2053 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2054 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pRoamInfo->sessionId) && |
| 2055 | pHddCtx->tdlsConnInfo[staIdx].staId) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2056 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2057 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2058 | ("hdd_tdlsStatusUpdate: staIdx %d %02x:%02x:%02x:%02x:%02x:%02x"), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2059 | pHddCtx->tdlsConnInfo[staIdx].staId, |
| 2060 | pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes[0], |
| 2061 | pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes[1], |
| 2062 | pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes[2], |
| 2063 | pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes[3], |
| 2064 | pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes[4], |
| 2065 | pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes[5]) ; |
| 2066 | wlan_hdd_tdls_reset_peer(pAdapter, pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes); |
| 2067 | hdd_roamDeregisterTDLSSTA ( pAdapter, pHddCtx->tdlsConnInfo[staIdx].staId ); |
| 2068 | wlan_hdd_tdls_decrement_peer_count(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2069 | |
| 2070 | (WLAN_HDD_GET_CTX(pAdapter))->sta_to_adapter[staIdx] = NULL; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2071 | vos_mem_zero(&pHddCtx->tdlsConnInfo[staIdx].peerMac, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2072 | sizeof(v_MACADDR_t)) ; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2073 | pHddCtx->tdlsConnInfo[staIdx].staId = 0 ; |
| 2074 | pHddCtx->tdlsConnInfo[staIdx].sessionId = 255; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2075 | |
| 2076 | status = eHAL_STATUS_SUCCESS ; |
| 2077 | } |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 2078 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2079 | } |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 2080 | break ; |
| 2081 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2082 | default: |
| 2083 | { |
| 2084 | break ; |
| 2085 | } |
| 2086 | } |
| 2087 | |
| 2088 | return status ; |
| 2089 | } |
| 2090 | #endif |
| 2091 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2092 | eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, |
| 2093 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ) |
| 2094 | { |
| 2095 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 2096 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 2097 | hdd_wext_state_t *pWextState = NULL; |
| 2098 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2099 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2100 | |
| 2101 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2102 | "CSR Callback: status= %d result= %d roamID=%ld", |
| 2103 | roamStatus, roamResult, roamId ); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2104 | |
| 2105 | /*Sanity check*/ |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 2106 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2107 | { |
| 2108 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | ec625f7 | 2012-11-22 17:17:38 +0530 | [diff] [blame] | 2109 | "invalid adapter or adapter has invalid magic"); |
| 2110 | return eHAL_STATUS_FAILURE; |
| 2111 | } |
| 2112 | |
| 2113 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2114 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2115 | |
| 2116 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 2117 | { |
| 2118 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2119 | "invalid WEXT state or HDD station context"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2120 | return eHAL_STATUS_FAILURE; |
| 2121 | } |
| 2122 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2123 | switch( roamStatus ) |
| 2124 | { |
| 2125 | case eCSR_ROAM_SESSION_OPENED: |
| 2126 | if(pAdapter != NULL) |
| 2127 | { |
| 2128 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 2129 | complete(&pAdapter->session_open_comp_var); |
| 2130 | } |
| 2131 | break; |
| 2132 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2133 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2134 | /* We did pre-auth,then we attempted a 11r or ccx reassoc. |
| 2135 | * reassoc failed due to failure, timeout, reject from ap |
| 2136 | * in any case tell the OS, our carrier is off and mark |
| 2137 | * interface down */ |
| 2138 | case eCSR_ROAM_FT_REASSOC_FAILED: |
| 2139 | hddLog(LOG1, FL("Reassoc Failed\n")); |
| 2140 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2141 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 2142 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2143 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 2144 | } |
| 2145 | pHddStaCtx->ft_carrier_on = FALSE; |
| 2146 | break; |
| 2147 | |
| 2148 | case eCSR_ROAM_FT_START: |
| 2149 | // When we roam for CCX and 11r, we dont want the |
| 2150 | // OS to be informed that the link is down. So mark |
| 2151 | // the link ready for ft_start. After this the |
| 2152 | // eCSR_ROAM_SHOULD_ROAM will be received. |
| 2153 | // Where in we will not mark the link down |
| 2154 | // Also we want to stop tx at this point when we will be |
| 2155 | // doing disassoc at this time. This saves 30-60 msec |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2156 | // after reassoc. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2157 | { |
| 2158 | struct net_device *dev = pAdapter->dev; |
| 2159 | netif_tx_disable(dev); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2160 | /* |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 2161 | * Deregister for this STA with TL with the objective to flush |
| 2162 | * all the packets for this STA from wmm_tx_queue. If not done here, |
| 2163 | * we would run into a race condition (CR390567) wherein TX |
| 2164 | * thread would schedule packets from wmm_tx_queue AFTER peer STA has |
| 2165 | * been deleted. And, these packets get assigned with a STA idx of |
| 2166 | * self-sta (since the peer STA has been deleted) and get transmitted |
| 2167 | * on the new channel before the reassoc request. Since there will be |
| 2168 | * no ACK on the new channel, each packet gets retransmitted which |
| 2169 | * takes several seconds before the transmission of reassoc request. |
| 2170 | * This leads to reassoc-timeout and roam failure. |
| 2171 | */ |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2172 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 2173 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 2174 | { |
| 2175 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2176 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 2177 | pHddStaCtx->conn_info.staId[0], status, status ); |
| 2178 | halStatus = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 2179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2180 | } |
| 2181 | pHddStaCtx->ft_carrier_on = TRUE; |
| 2182 | break; |
| 2183 | #endif |
| 2184 | |
| 2185 | case eCSR_ROAM_SHOULD_ROAM: |
| 2186 | // Dont need to do anything |
| 2187 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | struct net_device *dev = pAdapter->dev; |
| 2189 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2190 | // notify apps that we can't pass traffic anymore |
| 2191 | netif_tx_disable(dev); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2192 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2193 | if (pHddStaCtx->ft_carrier_on == FALSE) |
| 2194 | { |
| 2195 | #endif |
| 2196 | netif_carrier_off(dev); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2197 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2198 | } |
| 2199 | #endif |
| 2200 | |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2201 | #if !(defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2202 | //We should clear all sta register with TL, for now, only one. |
| 2203 | status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] ); |
| 2204 | if ( !VOS_IS_STATUS_SUCCESS(status ) ) |
| 2205 | { |
| 2206 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2207 | FL("hdd_roamDeregisterSTA() failed to for staID %d. Status= %d [0x%x]"), |
| 2208 | pHddStaCtx->conn_info.staId[0], status, status ); |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2209 | halStatus = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2210 | } |
Madan Mohan Koyyalamudi | 2d8cc89 | 2012-09-18 16:24:34 -0700 | [diff] [blame] | 2211 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | // Clear saved connection information in HDD |
| 2213 | hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) ); |
| 2214 | } |
| 2215 | break; |
| 2216 | case eCSR_ROAM_LOSTLINK: |
| 2217 | case eCSR_ROAM_DISASSOCIATED: |
| 2218 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2219 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2220 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2221 | "****eCSR_ROAM_DISASSOCIATED****"); |
| 2222 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2223 | /* Check if Mcast/Bcast Filters are set, if yes clear the filters here */ |
| 2224 | if ((WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set == TRUE) { |
| 2225 | hdd_conf_mcastbcast_filter((WLAN_HDD_GET_CTX(pAdapter)), FALSE); |
| 2226 | (WLAN_HDD_GET_CTX(pAdapter))->hdd_mcastbcast_filter_set = FALSE; |
| 2227 | } |
| 2228 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 2229 | if (pHddCtx->cfg_ini->isMcAddrListFilter) |
| 2230 | { |
| 2231 | /*Multicast addr filtering is enabled*/ |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 2232 | if (pAdapter->mc_addr_list.isFilterApplied) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2233 | { |
| 2234 | /*Filter applied during suspend mode*/ |
| 2235 | /*Clear it here*/ |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 2236 | wlan_hdd_set_mc_addr_list(pAdapter, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2237 | } |
| 2238 | } |
| 2239 | #endif |
| 2240 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2241 | if (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) |
| 2242 | { |
| 2243 | /* Disconnected from current AP. Reset the country code information |
| 2244 | * so that it re-initialize the valid channel list*/ |
| 2245 | hdd_ResetCountryCodeAfterDisAssoc(pAdapter); |
| 2246 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | } |
| 2248 | break; |
| 2249 | case eCSR_ROAM_IBSS_LEAVE: |
| 2250 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2251 | "****eCSR_ROAM_IBSS_LEAVE****"); |
| 2252 | halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2253 | break; |
| 2254 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
| 2255 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2256 | "****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
| 2257 | if ( (roamResult != eCSR_ROAM_RESULT_ASSOCIATED) |
| 2258 | && ( (pWextState->roamProfile.EncryptionType.encryptionType[0] == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) |
| 2259 | || (pWextState->roamProfile.EncryptionType.encryptionType[0] == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY) |
| 2260 | ) |
| 2261 | && (eCSR_AUTH_TYPE_SHARED_KEY != pWextState->roamProfile.AuthType.authType[0]) |
| 2262 | ) |
| 2263 | { |
| 2264 | v_U32_t roamId = 0; |
| 2265 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 2266 | "****WEP open authentication failed, trying with shared authentication****"); |
| 2267 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 2268 | pWextState->roamProfile.AuthType.authType[0] = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 2269 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 2270 | halStatus = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &(pWextState->roamProfile), &roamId); |
| 2271 | } |
| 2272 | else |
| 2273 | { |
| 2274 | halStatus = hdd_AssociationCompletionHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2275 | } |
| 2276 | |
| 2277 | break; |
| 2278 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
| 2279 | halStatus = hdd_AssociationCompletionHandler( pAdapter, |
| 2280 | pRoamInfo, roamId, roamStatus, roamResult ); |
| 2281 | break; |
| 2282 | case eCSR_ROAM_IBSS_IND: |
| 2283 | halStatus = roamRoamIbssIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2284 | break; |
| 2285 | |
| 2286 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
| 2287 | halStatus = roamRoamConnectStatusUpdateHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2288 | break; |
| 2289 | |
| 2290 | case eCSR_ROAM_MIC_ERROR_IND: |
| 2291 | halStatus = hdd_RoamMicErrorIndicationHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2292 | break; |
| 2293 | |
| 2294 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 2295 | halStatus = hdd_RoamSetKeyCompleteHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); |
| 2296 | break; |
| 2297 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2298 | case eCSR_ROAM_FT_RESPONSE: |
| 2299 | hdd_SendFTEvent(pAdapter); |
| 2300 | break; |
| 2301 | #endif |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 2302 | #if defined(FEATURE_WLAN_LFR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2303 | case eCSR_ROAM_PMK_NOTIFY: |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2304 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType) |
| 2305 | { |
| 2306 | /* Notify the supplicant of a new candidate */ |
| 2307 | halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false); |
| 2308 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2309 | break; |
| 2310 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2312 | case eCSR_ROAM_INDICATE_MGMT_FRAME: |
| 2313 | hdd_indicateMgmtFrame( pAdapter, |
| 2314 | pRoamInfo->nFrameLength, |
| 2315 | pRoamInfo->pbFrames, |
| 2316 | pRoamInfo->frameType, |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 2317 | pRoamInfo->rxChan, |
| 2318 | pRoamInfo->rxRssi ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2319 | break; |
| 2320 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 2321 | hdd_remainChanReadyHandler( pAdapter ); |
| 2322 | break; |
| 2323 | case eCSR_ROAM_SEND_ACTION_CNF: |
| 2324 | hdd_sendActionCnf( pAdapter, |
| 2325 | (roamResult == eCSR_ROAM_RESULT_NONE) ? TRUE : FALSE ); |
| 2326 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2327 | #ifdef FEATURE_WLAN_TDLS |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 2328 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2329 | halStatus = hdd_RoamTdlsStatusUpdateHandler( pAdapter, pRoamInfo, |
Ng Chilam | fc41646 | 2012-12-27 17:26:52 -0800 | [diff] [blame] | 2330 | roamId, roamStatus, roamResult ); |
| 2331 | break ; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2332 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 2333 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, pRoamInfo->reasonCode); |
| 2334 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 2335 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2336 | #ifdef WLAN_FEATURE_11W |
| 2337 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 2338 | hdd_indicateUnprotMgmtFrame(pAdapter, pRoamInfo->nFrameLength, |
| 2339 | pRoamInfo->pbFrames, |
| 2340 | pRoamInfo->frameType); |
| 2341 | break; |
| 2342 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2343 | default: |
| 2344 | break; |
| 2345 | } |
| 2346 | return( halStatus ); |
| 2347 | } |
| 2348 | eCsrAuthType hdd_TranslateRSNToCsrAuthType( u_int8_t auth_suite[4]) |
| 2349 | { |
| 2350 | eCsrAuthType auth_type; |
| 2351 | // is the auth type supported? |
| 2352 | if ( memcmp(auth_suite , ccpRSNOui01, 4) == 0) |
| 2353 | { |
| 2354 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 2355 | } else |
| 2356 | if (memcmp(auth_suite , ccpRSNOui02, 4) == 0) |
| 2357 | { |
| 2358 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 2359 | } else |
| 2360 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2361 | if (memcmp(auth_suite , ccpRSNOui04, 4) == 0) |
| 2362 | { |
| 2363 | // Check for 11r FT Authentication with PSK |
| 2364 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 2365 | } else |
| 2366 | if (memcmp(auth_suite , ccpRSNOui03, 4) == 0) |
| 2367 | { |
| 2368 | // Check for 11R FT Authentication with 802.1X |
| 2369 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 2370 | } else |
| 2371 | #endif |
| 2372 | #ifdef FEATURE_WLAN_CCX |
| 2373 | if (memcmp(auth_suite , ccpRSNOui06, 4) == 0) |
| 2374 | { |
| 2375 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 2376 | } else |
| 2377 | #endif /* FEATURE_WLAN_CCX */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2378 | #ifdef WLAN_FEATURE_11W |
| 2379 | if (memcmp(auth_suite , ccpRSNOui07, 4) == 0) |
| 2380 | { |
| 2381 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 2382 | } else |
| 2383 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2384 | { |
| 2385 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 2386 | } |
| 2387 | return auth_type; |
| 2388 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 2389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2390 | eCsrAuthType |
| 2391 | hdd_TranslateWPAToCsrAuthType(u_int8_t auth_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2392 | { |
| 2393 | eCsrAuthType auth_type; |
| 2394 | // is the auth type supported? |
| 2395 | if ( memcmp(auth_suite , ccpWpaOui01, 4) == 0) |
| 2396 | { |
| 2397 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 2398 | } else |
| 2399 | if (memcmp(auth_suite , ccpWpaOui02, 4) == 0) |
| 2400 | { |
| 2401 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 2402 | } else |
| 2403 | #ifdef FEATURE_WLAN_CCX |
| 2404 | if (memcmp(auth_suite , ccpWpaOui06, 4) == 0) |
| 2405 | { |
| 2406 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 2407 | } else |
| 2408 | #endif /* FEATURE_WLAN_CCX */ |
| 2409 | { |
| 2410 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 2411 | } |
| 2412 | hddLog(LOG1, FL("auth_type: %d"), auth_type); |
| 2413 | return auth_type; |
| 2414 | } |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 2415 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2416 | eCsrEncryptionType |
| 2417 | hdd_TranslateRSNToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2418 | { |
| 2419 | eCsrEncryptionType cipher_type; |
| 2420 | // is the cipher type supported? |
| 2421 | if ( memcmp(cipher_suite , ccpRSNOui04, 4) == 0) |
| 2422 | { |
| 2423 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 2424 | } |
| 2425 | else if (memcmp(cipher_suite , ccpRSNOui02, 4) == 0) |
| 2426 | { |
| 2427 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 2428 | } |
| 2429 | else if (memcmp(cipher_suite , ccpRSNOui00, 4) == 0) |
| 2430 | { |
| 2431 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 2432 | } |
| 2433 | else if (memcmp(cipher_suite , ccpRSNOui01, 4) == 0) |
| 2434 | { |
| 2435 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 2436 | } |
| 2437 | else if (memcmp(cipher_suite , ccpRSNOui05, 4) == 0) |
| 2438 | { |
| 2439 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 2440 | } |
| 2441 | else |
| 2442 | { |
| 2443 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 2444 | } |
| 2445 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 2446 | return cipher_type; |
| 2447 | } |
| 2448 | /* To find if the MAC address is NULL */ |
| 2449 | static tANI_U8 hdd_IsMACAddrNULL (tANI_U8 *macAddr, tANI_U8 length) |
| 2450 | { |
| 2451 | int i; |
| 2452 | for (i = 0; i < length; i++) |
| 2453 | { |
| 2454 | if (0x00 != (macAddr[i])) |
| 2455 | { |
| 2456 | return FALSE; |
| 2457 | } |
| 2458 | } |
| 2459 | return TRUE; |
| 2460 | } /****** end hdd_IsMACAddrNULL() ******/ |
Jeff Johnson | 7dda777 | 2013-02-27 08:36:13 -0800 | [diff] [blame] | 2461 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2462 | eCsrEncryptionType |
| 2463 | hdd_TranslateWPAToCsrEncryptionType(u_int8_t cipher_suite[4]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2464 | { |
| 2465 | eCsrEncryptionType cipher_type; |
| 2466 | // is the cipher type supported? |
| 2467 | if ( memcmp(cipher_suite , ccpWpaOui04, 4) == 0) |
| 2468 | { |
| 2469 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 2470 | } else |
| 2471 | if (memcmp(cipher_suite , ccpWpaOui02, 4) == 0) |
| 2472 | { |
| 2473 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 2474 | } else |
| 2475 | if (memcmp(cipher_suite , ccpWpaOui00, 4) == 0) |
| 2476 | { |
| 2477 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 2478 | } else |
| 2479 | if (memcmp(cipher_suite , ccpWpaOui01, 4) == 0) |
| 2480 | { |
| 2481 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 2482 | } else |
| 2483 | if (memcmp(cipher_suite , ccpWpaOui05, 4) == 0) |
| 2484 | { |
| 2485 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 2486 | } else |
| 2487 | { |
| 2488 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 2489 | } |
| 2490 | hddLog(LOG1, FL("cipher_type: %d"), cipher_type); |
| 2491 | return cipher_type; |
| 2492 | } |
| 2493 | |
| 2494 | static tANI_S32 hdd_ProcessGENIE(hdd_adapter_t *pAdapter, |
| 2495 | struct ether_addr *pBssid, |
| 2496 | eCsrEncryptionType *pEncryptType, |
| 2497 | eCsrEncryptionType *mcEncryptType, |
| 2498 | eCsrAuthType *pAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2499 | #ifdef WLAN_FEATURE_11W |
| 2500 | u_int8_t *pMfpRequired, |
| 2501 | u_int8_t *pMfpCapable, |
| 2502 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2503 | u_int16_t gen_ie_len, |
| 2504 | u_int8_t *gen_ie) |
| 2505 | { |
| 2506 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2507 | eHalStatus result; |
| 2508 | tDot11fIERSN dot11RSNIE; |
| 2509 | tDot11fIEWPA dot11WPAIE; |
| 2510 | tANI_U32 i; |
| 2511 | tANI_U8 *pRsnIe; |
| 2512 | tANI_U16 RSNIeLen; |
| 2513 | tPmkidCacheInfo PMKIDCache[4]; // Local transfer memory |
| 2514 | |
| 2515 | /* Clear struct of tDot11fIERSN and tDot11fIEWPA specifically setting present |
| 2516 | flag to 0 */ |
| 2517 | memset( &dot11WPAIE, 0 , sizeof(tDot11fIEWPA) ); |
| 2518 | memset( &dot11RSNIE, 0 , sizeof(tDot11fIERSN) ); |
| 2519 | |
| 2520 | // Validity checks |
| 2521 | if ((gen_ie_len < VOS_MIN(DOT11F_IE_RSN_MIN_LEN, DOT11F_IE_WPA_MIN_LEN)) || |
| 2522 | (gen_ie_len > VOS_MAX(DOT11F_IE_RSN_MAX_LEN, DOT11F_IE_WPA_MAX_LEN)) ) |
| 2523 | return -EINVAL; |
| 2524 | // Type check |
| 2525 | if ( gen_ie[0] == DOT11F_EID_RSN) |
| 2526 | { |
| 2527 | // Validity checks |
| 2528 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN ) || |
| 2529 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN) ) |
| 2530 | { |
| 2531 | return -EINVAL; |
| 2532 | } |
| 2533 | // Skip past the EID byte and length byte |
| 2534 | pRsnIe = gen_ie + 2; |
| 2535 | RSNIeLen = gen_ie_len - 2; |
| 2536 | // Unpack the RSN IE |
| 2537 | dot11fUnpackIeRSN((tpAniSirGlobal) halHandle, |
| 2538 | pRsnIe, |
| 2539 | RSNIeLen, |
| 2540 | &dot11RSNIE); |
| 2541 | // Copy out the encryption and authentication types |
| 2542 | hddLog(LOG1, FL("%s: pairwise cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2543 | __func__, dot11RSNIE.pwise_cipher_suite_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2544 | hddLog(LOG1, FL("%s: authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2545 | __func__, dot11RSNIE.akm_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2546 | /*Here we have followed the apple base code, |
| 2547 | but probably I suspect we can do something different*/ |
| 2548 | //dot11RSNIE.akm_suite_count |
| 2549 | // Just translate the FIRST one |
| 2550 | *pAuthType = hdd_TranslateRSNToCsrAuthType(dot11RSNIE.akm_suites[0]); |
| 2551 | //dot11RSNIE.pwise_cipher_suite_count |
| 2552 | *pEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.pwise_cipher_suites[0]); |
| 2553 | //dot11RSNIE.gp_cipher_suite_count |
| 2554 | *mcEncryptType = hdd_TranslateRSNToCsrEncryptionType(dot11RSNIE.gp_cipher_suite); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2555 | #ifdef WLAN_FEATURE_11W |
| 2556 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1 ; |
| 2557 | *pMfpCapable = (dot11RSNIE.RSN_Cap[0] >> 7) & 0x1 ; |
| 2558 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2559 | // Set the PMKSA ID Cache for this interface |
| 2560 | for (i=0; i<dot11RSNIE.pmkid_count; i++) |
| 2561 | { |
| 2562 | if ( pBssid == NULL) |
| 2563 | { |
| 2564 | break; |
| 2565 | } |
| 2566 | if ( hdd_IsMACAddrNULL( (u_char *) pBssid , sizeof( (char *) pBssid))) |
| 2567 | { |
| 2568 | break; |
| 2569 | } |
| 2570 | // For right now, I assume setASSOCIATE() has passed in the bssid. |
| 2571 | vos_mem_copy(PMKIDCache[i].BSSID, |
| 2572 | pBssid, ETHER_ADDR_LEN); |
| 2573 | vos_mem_copy(PMKIDCache[i].PMKID, |
| 2574 | dot11RSNIE.pmkid[i], |
| 2575 | CSR_RSN_PMKID_SIZE); |
| 2576 | } |
| 2577 | // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache |
| 2578 | hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with cache entry %ld."), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2579 | __func__, i ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2580 | // Finally set the PMKSA ID Cache in CSR |
| 2581 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
| 2582 | PMKIDCache, |
| 2583 | dot11RSNIE.pmkid_count ); |
| 2584 | } |
| 2585 | else if (gen_ie[0] == DOT11F_EID_WPA) |
| 2586 | { |
| 2587 | // Validity checks |
| 2588 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN ) || |
| 2589 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) |
| 2590 | { |
| 2591 | return -EINVAL; |
| 2592 | } |
| 2593 | // Skip past the EID byte and length byte - and four byte WiFi OUI |
| 2594 | pRsnIe = gen_ie + 2 + 4; |
| 2595 | RSNIeLen = gen_ie_len - (2 + 4); |
| 2596 | // Unpack the WPA IE |
| 2597 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 2598 | pRsnIe, |
| 2599 | RSNIeLen, |
| 2600 | &dot11WPAIE); |
| 2601 | // Copy out the encryption and authentication types |
| 2602 | hddLog(LOG1, FL("%s: WPA unicast cipher suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2603 | __func__, dot11WPAIE.unicast_cipher_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2604 | hddLog(LOG1, FL("%s: WPA authentication suite count: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2605 | __func__, dot11WPAIE.auth_suite_count); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2606 | //dot11WPAIE.auth_suite_count |
| 2607 | // Just translate the FIRST one |
| 2608 | *pAuthType = hdd_TranslateWPAToCsrAuthType(dot11WPAIE.auth_suites[0]); |
| 2609 | //dot11WPAIE.unicast_cipher_count |
| 2610 | *pEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.unicast_ciphers[0]); |
| 2611 | //dot11WPAIE.unicast_cipher_count |
| 2612 | *mcEncryptType = hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 2613 | } |
| 2614 | else |
| 2615 | { |
| 2616 | hddLog(LOGW, FL("gen_ie[0]: %d"), gen_ie[0]); |
| 2617 | return -EINVAL; |
| 2618 | } |
| 2619 | return 0; |
| 2620 | } |
| 2621 | int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 2622 | { |
| 2623 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2624 | v_U32_t status = 0; |
| 2625 | eCsrEncryptionType RSNEncryptType; |
| 2626 | eCsrEncryptionType mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2627 | #ifdef WLAN_FEATURE_11W |
| 2628 | u_int8_t RSNMfpRequired; |
| 2629 | u_int8_t RSNMfpCapable; |
| 2630 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2631 | struct ether_addr bSsid; // MAC address of assoc peer |
| 2632 | // MAC address of assoc peer |
| 2633 | // But, this routine is only called when we are NOT associated. |
| 2634 | vos_mem_copy(bSsid.ether_addr_octet, |
| 2635 | pWextState->roamProfile.BSSIDs.bssid, |
| 2636 | sizeof(bSsid.ether_addr_octet)); |
| 2637 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) |
| 2638 | { |
| 2639 | //continue |
| 2640 | } |
| 2641 | else |
| 2642 | { |
| 2643 | return 0; |
| 2644 | } |
| 2645 | // The actual processing may eventually be more extensive than this. |
| 2646 | // Right now, just consume any PMKIDs that are sent in by the app. |
| 2647 | status = hdd_ProcessGENIE(pAdapter, |
| 2648 | &bSsid, // MAC address of assoc peer |
| 2649 | &RSNEncryptType, |
| 2650 | &mcRSNEncryptType, |
| 2651 | RSNAuthType, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2652 | #ifdef WLAN_FEATURE_11W |
| 2653 | &RSNMfpRequired, |
| 2654 | &RSNMfpCapable, |
| 2655 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2656 | pWextState->WPARSNIE[1]+2, |
| 2657 | pWextState->WPARSNIE); |
| 2658 | if (status == 0) |
| 2659 | { |
| 2660 | // Now copy over all the security attributes you have parsed out |
| 2661 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 2662 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 2663 | |
| 2664 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; // Use the cipher type in the RSN IE |
| 2665 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = mcRSNEncryptType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2666 | |
| 2667 | #ifdef WLAN_FEATURE_11W |
| 2668 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 2669 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 2670 | #endif |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2671 | hddLog( LOG1, "%s: CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", __func__, *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2672 | } |
| 2673 | return 0; |
| 2674 | } |
| 2675 | int hdd_set_csr_auth_type ( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 2676 | { |
| 2677 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2678 | tCsrRoamProfile* pRoamProfile = &(pWextState->roamProfile); |
| 2679 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2680 | ENTER(); |
| 2681 | |
| 2682 | pRoamProfile->AuthType.numEntries = 1; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2683 | hddLog( LOG1, "%s: pHddStaCtx->conn_info.authType = %d\n", __func__, pHddStaCtx->conn_info.authType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2684 | |
| 2685 | switch( pHddStaCtx->conn_info.authType) |
| 2686 | { |
| 2687 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2688 | #ifdef FEATURE_WLAN_CCX |
| 2689 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 2690 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 2691 | #endif |
| 2692 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 2693 | |
| 2694 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM ; |
| 2695 | } else |
| 2696 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 2697 | |
| 2698 | #ifdef FEATURE_WLAN_CCX |
| 2699 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 2700 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 2701 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2702 | hddLog( LOG1, "%s: set authType to CCKM WPA. AKM also 802.1X.\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2703 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
| 2704 | } else |
| 2705 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA)) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2706 | hddLog( LOG1, "%s: Last chance to set authType to CCKM WPA.\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2707 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_WPA; |
| 2708 | } else |
| 2709 | #endif |
| 2710 | if((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 2711 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 2712 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA; |
| 2713 | } else |
| 2714 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 2715 | == IW_AUTH_KEY_MGMT_PSK) { |
| 2716 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_PSK; |
| 2717 | } else { |
| 2718 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WPA_NONE; |
| 2719 | } |
| 2720 | } |
| 2721 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 2722 | #ifdef FEATURE_WLAN_CCX |
| 2723 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 2724 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 2725 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2726 | hddLog( LOG1, "%s: set authType to CCKM RSN. AKM also 802.1X.\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2727 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
| 2728 | } else |
| 2729 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN)) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2730 | hddLog( LOG1, "%s: Last chance to set authType to CCKM RSN.\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2731 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_CCKM_RSN; |
| 2732 | } else |
| 2733 | #endif |
| 2734 | |
| 2735 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2736 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 2737 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 2738 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 2739 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2740 | }else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2741 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) && |
| 2742 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 2743 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 2744 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 2745 | } else |
| 2746 | #endif |
| 2747 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 2748 | #ifdef WLAN_FEATURE_11W |
| 2749 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 2750 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 2751 | } else |
| 2752 | #endif |
| 2753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2754 | if( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 2755 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 2756 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN; |
| 2757 | } else |
| 2758 | if ( (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 2759 | == IW_AUTH_KEY_MGMT_PSK) { |
| 2760 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_RSN_PSK; |
| 2761 | } else { |
| 2762 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 2763 | } |
| 2764 | } |
| 2765 | break; |
| 2766 | |
| 2767 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2768 | |
| 2769 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 2770 | break; |
| 2771 | default: |
| 2772 | |
| 2773 | #ifdef FEATURE_WLAN_CCX |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2774 | hddLog( LOG1, "%s: In default, unknown auth type.\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2775 | #endif /* FEATURE_WLAN_CCX */ |
| 2776 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 2777 | break; |
| 2778 | } |
| 2779 | |
| 2780 | hddLog( LOG1, "%s Set roam Authtype to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2781 | __func__, pWextState->roamProfile.AuthType.authType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2782 | |
| 2783 | EXIT(); |
| 2784 | return 0; |
| 2785 | } |
| 2786 | |
| 2787 | /**--------------------------------------------------------------------------- |
| 2788 | |
| 2789 | \brief iw_set_essid() - |
| 2790 | This function sets the ssid received from wpa_supplicant |
| 2791 | to the CSR roam profile. |
| 2792 | |
| 2793 | \param - dev - Pointer to the net device. |
| 2794 | - info - Pointer to the iw_request_info. |
| 2795 | - wrqu - Pointer to the iwreq_data. |
| 2796 | - extra - Pointer to the data. |
| 2797 | \return - 0 for success, non zero for failure |
| 2798 | |
| 2799 | --------------------------------------------------------------------------*/ |
| 2800 | |
| 2801 | int iw_set_essid(struct net_device *dev, |
| 2802 | struct iw_request_info *info, |
| 2803 | union iwreq_data *wrqu, char *extra) |
| 2804 | { |
| 2805 | v_U32_t status = 0; |
| 2806 | hdd_wext_state_t *pWextState; |
| 2807 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2808 | v_U32_t roamId; |
| 2809 | tCsrRoamProfile *pRoamProfile; |
| 2810 | eMib_dot11DesiredBssType connectedBssType; |
| 2811 | eCsrAuthType RSNAuthType; |
| 2812 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2813 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2814 | |
| 2815 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2816 | |
| 2817 | ENTER(); |
| 2818 | |
| 2819 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2820 | { |
| 2821 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2822 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 2823 | return 0; |
| 2824 | } |
| 2825 | |
| 2826 | if(pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
| 2827 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s :Counter measure is in progress", __func__); |
| 2828 | return -EBUSY; |
| 2829 | } |
| 2830 | if( SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length ) |
| 2831 | return -EINVAL; |
| 2832 | pRoamProfile = &pWextState->roamProfile; |
| 2833 | if (pRoamProfile) |
| 2834 | { |
| 2835 | if ( hdd_connGetConnectedBssType( pHddStaCtx, &connectedBssType ) || |
| 2836 | ( eMib_dot11DesiredBssType_independent == pHddStaCtx->conn_info.connDot11DesiredBssType )) |
| 2837 | { |
| 2838 | VOS_STATUS vosStatus; |
| 2839 | // need to issue a disconnect to CSR. |
| 2840 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 2841 | vosStatus = sme_RoamDisconnect( hHal, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 2842 | |
| 2843 | if(VOS_STATUS_SUCCESS == vosStatus) |
| 2844 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 2845 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 2846 | } |
| 2847 | } |
| 2848 | /** wpa_supplicant 0.8.x, wext driver uses */ |
| 2849 | else |
| 2850 | { |
| 2851 | return -EINVAL; |
| 2852 | } |
| 2853 | /** wpa_supplicant 0.8.x, wext driver uses */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2854 | /** when cfg80211 defined, wpa_supplicant wext driver uses |
| 2855 | zero-length, null-string ssid for force disconnection. |
| 2856 | after disconnection (if previously connected) and cleaning ssid, |
| 2857 | driver MUST return success */ |
| 2858 | if ( 0 == wrqu->essid.length ) { |
| 2859 | return 0; |
| 2860 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2861 | |
| 2862 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 2863 | &pWextState->roamProfile.uapsd_mask); |
| 2864 | if (VOS_STATUS_SUCCESS != status) |
| 2865 | { |
| 2866 | pWextState->roamProfile.uapsd_mask = 0; |
| 2867 | } |
| 2868 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 2869 | |
| 2870 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = wrqu->essid.length; |
| 2871 | |
| 2872 | vos_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
| 2873 | vos_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId), extra, wrqu->essid.length); |
| 2874 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion || |
| 2875 | IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion ) { |
| 2876 | |
| 2877 | //set gen ie |
| 2878 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 2879 | |
| 2880 | //set auth |
| 2881 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 2882 | } |
| 2883 | #ifdef FEATURE_WLAN_WAPI |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2884 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2885 | if (pAdapter->wapi_info.nWapiMode) |
| 2886 | { |
| 2887 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 2888 | { |
| 2889 | case WAPI_AUTH_MODE_PSK: |
| 2890 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2891 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, pAdapter->wapi_info.wapiAuthMode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2892 | pRoamProfile->AuthType.numEntries = 1; |
| 2893 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 2894 | break; |
| 2895 | } |
| 2896 | case WAPI_AUTH_MODE_CERT: |
| 2897 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2898 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, pAdapter->wapi_info.wapiAuthMode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2899 | pRoamProfile->AuthType.numEntries = 1; |
| 2900 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 2901 | break; |
| 2902 | } |
| 2903 | } // End of switch |
| 2904 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 2905 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 2906 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2907 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2908 | pRoamProfile->EncryptionType.numEntries = 1; |
| 2909 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 2910 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 2911 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 2912 | } |
| 2913 | } |
| 2914 | #endif /* FEATURE_WLAN_WAPI */ |
| 2915 | /* if previous genIE is not NULL, update AssocIE */ |
| 2916 | if (0 != pWextState->genIE.length) |
| 2917 | { |
| 2918 | memset( &pWextState->assocAddIE, 0, sizeof(pWextState->assocAddIE) ); |
| 2919 | memcpy( pWextState->assocAddIE.addIEdata, pWextState->genIE.addIEdata, |
| 2920 | pWextState->genIE.length); |
| 2921 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 2922 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 2923 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 2924 | |
| 2925 | /* clear previous genIE after use it */ |
| 2926 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 2927 | } |
| 2928 | |
| 2929 | /* assumes it is not WPS Association by default, except when pAddIEAssoc has WPS IE */ |
| 2930 | pWextState->roamProfile.bWPSAssociation = FALSE; |
| 2931 | |
| 2932 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 2933 | pWextState->roamProfile.nAddIEAssocLength)) |
| 2934 | pWextState->roamProfile.bWPSAssociation = TRUE; |
| 2935 | |
| 2936 | |
| 2937 | // Disable auto BMPS entry by PMC until DHCP is done |
| 2938 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), TRUE); |
| 2939 | |
| 2940 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 2941 | (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE; |
| 2942 | status = sme_RoamConnect( hHal,pAdapter->sessionId, &(pWextState->roamProfile),&roamId); |
| 2943 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 2944 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 2945 | |
| 2946 | EXIT(); |
| 2947 | return status; |
| 2948 | } |
| 2949 | /**--------------------------------------------------------------------------- |
| 2950 | |
| 2951 | \brief iw_get_essid() - |
| 2952 | This function returns the essid to the wpa_supplicant. |
| 2953 | |
| 2954 | \param - dev - Pointer to the net device. |
| 2955 | - info - Pointer to the iw_request_info. |
| 2956 | - wrqu - Pointer to the iwreq_data. |
| 2957 | - extra - Pointer to the data. |
| 2958 | \return - 0 for success, non zero for failure |
| 2959 | |
| 2960 | --------------------------------------------------------------------------*/ |
| 2961 | int iw_get_essid(struct net_device *dev, |
| 2962 | struct iw_request_info *info, |
| 2963 | struct iw_point *dwrq, char *extra) |
| 2964 | { |
| 2965 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2966 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2967 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2968 | ENTER(); |
| 2969 | |
| 2970 | if((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 2971 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 2972 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected || |
| 2973 | pHddStaCtx->conn_info.connState == eConnectionState_IbssDisconnected) && |
| 2974 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) |
| 2975 | { |
| 2976 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 2977 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, dwrq->length); |
| 2978 | dwrq->flags = 1; |
| 2979 | } else { |
| 2980 | memset(extra, 0, dwrq->length); |
| 2981 | dwrq->length = 0; |
| 2982 | dwrq->flags = 0; |
| 2983 | } |
| 2984 | EXIT(); |
| 2985 | return 0; |
| 2986 | } |
| 2987 | /**--------------------------------------------------------------------------- |
| 2988 | |
| 2989 | \brief iw_set_auth() - |
| 2990 | This function sets the auth type received from the wpa_supplicant. |
| 2991 | |
| 2992 | \param - dev - Pointer to the net device. |
| 2993 | - info - Pointer to the iw_request_info. |
| 2994 | - wrqu - Pointer to the iwreq_data. |
| 2995 | - extra - Pointer to the data. |
| 2996 | \return - 0 for success, non zero for failure |
| 2997 | |
| 2998 | --------------------------------------------------------------------------*/ |
| 2999 | int iw_set_auth(struct net_device *dev,struct iw_request_info *info, |
| 3000 | union iwreq_data *wrqu,char *extra) |
| 3001 | { |
| 3002 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3003 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3004 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3005 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 3006 | eCsrEncryptionType mcEncryptionType; |
| 3007 | eCsrEncryptionType ucEncryptionType; |
| 3008 | |
| 3009 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3010 | |
| 3011 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3012 | { |
| 3013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3014 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3015 | return -EBUSY; |
| 3016 | } |
| 3017 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3018 | switch(wrqu->param.flags & IW_AUTH_INDEX) |
| 3019 | { |
| 3020 | case IW_AUTH_WPA_VERSION: |
| 3021 | |
| 3022 | pWextState->wpaVersion = wrqu->param.value; |
| 3023 | |
| 3024 | break; |
| 3025 | |
| 3026 | case IW_AUTH_CIPHER_PAIRWISE: |
| 3027 | { |
| 3028 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 3029 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3030 | } |
| 3031 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 3032 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 3033 | } |
| 3034 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 3035 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 3036 | } |
| 3037 | |
| 3038 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 3039 | |
| 3040 | if( (IW_AUTH_KEY_MGMT_802_1X |
| 3041 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
| 3042 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ) |
| 3043 | /*Dynamic WEP key*/ |
| 3044 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 3045 | else |
| 3046 | /*Static WEP key*/ |
| 3047 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3048 | } |
| 3049 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 3050 | |
| 3051 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 3052 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) ) |
| 3053 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3054 | /*Dynamic WEP key*/ |
| 3055 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 3056 | else |
| 3057 | /*Static WEP key*/ |
| 3058 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3059 | |
| 3060 | } |
| 3061 | else { |
| 3062 | |
| 3063 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3064 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3065 | return -EINVAL; |
| 3066 | } |
| 3067 | |
| 3068 | pRoamProfile->EncryptionType.numEntries = 1; |
| 3069 | pRoamProfile->EncryptionType.encryptionType[0] = ucEncryptionType; |
| 3070 | } |
| 3071 | break; |
| 3072 | case IW_AUTH_CIPHER_GROUP: |
| 3073 | { |
| 3074 | if(wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 3075 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3076 | } |
| 3077 | |
| 3078 | else if(wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 3079 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 3080 | } |
| 3081 | |
| 3082 | else if(wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 3083 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 3084 | } |
| 3085 | |
| 3086 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 3087 | |
| 3088 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 3089 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 3090 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3091 | |
| 3092 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 3093 | |
| 3094 | else |
| 3095 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3096 | } |
| 3097 | |
| 3098 | else if(wrqu->param.value & IW_AUTH_CIPHER_WEP104) |
| 3099 | { |
| 3100 | /*Dynamic WEP keys won't work with shared keys*/ |
| 3101 | if( ( IW_AUTH_KEY_MGMT_802_1X |
| 3102 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 3103 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3104 | { |
| 3105 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 3106 | } |
| 3107 | else |
| 3108 | { |
| 3109 | mcEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3110 | } |
| 3111 | } |
| 3112 | else { |
| 3113 | |
| 3114 | hddLog(LOGW, "%s value %d UNKNOWN IW_AUTH_CIPHER", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3115 | __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3116 | return -EINVAL; |
| 3117 | } |
| 3118 | |
| 3119 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 3120 | pRoamProfile->mcEncryptionType.encryptionType[0] = mcEncryptionType; |
| 3121 | } |
| 3122 | break; |
| 3123 | |
| 3124 | case IW_AUTH_80211_AUTH_ALG: |
| 3125 | { |
| 3126 | /*Save the auth algo here and set auth type to SME Roam profile |
| 3127 | in the iw_set_ap_address*/ |
| 3128 | if( wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 3129 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3130 | |
| 3131 | else if(wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 3132 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 3133 | |
| 3134 | else if(wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 3135 | /*Not supported*/ |
| 3136 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3137 | pWextState->roamProfile.AuthType.authType[0] = pHddStaCtx->conn_info.authType; |
| 3138 | } |
| 3139 | break; |
| 3140 | |
| 3141 | case IW_AUTH_KEY_MGMT: |
| 3142 | { |
| 3143 | #ifdef FEATURE_WLAN_CCX |
| 3144 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 3145 | /*Check for CCKM AKM type */ |
| 3146 | if ( wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3147 | //hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"%s: CCKM AKM Set %d\n", __func__, wrqu->param.value); |
| 3148 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: CCKM AKM Set %d\n", __func__, wrqu->param.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | /* Set the CCKM bit in authKeyMgmt */ |
| 3150 | /* Right now, this breaks all ref to authKeyMgmt because our |
| 3151 | * code doesn't realize it is a "bitfield" |
| 3152 | */ |
| 3153 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 3154 | /*Set the key management to 802.1X*/ |
| 3155 | //pWextState->authKeyMgmt = IW_AUTH_KEY_MGMT_802_1X; |
| 3156 | pWextState->isCCXConnection = eANI_BOOLEAN_TRUE; |
| 3157 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 3158 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_CCKM_RSN; |
| 3159 | } else if ( wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 3160 | /*Save the key management*/ |
| 3161 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 3162 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 3163 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 3164 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 3165 | } else if (!( wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
| 3166 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_NONE; //eCSR_AUTH_TYPE_WPA_NONE |
| 3167 | /*Save the key management anyway*/ |
| 3168 | pWextState->authKeyMgmt = wrqu->param.value; |
| 3169 | } else { // It must be IW_AUTH_KEY_MGMT_802_1X |
| 3170 | /*Save the key management*/ |
| 3171 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 3172 | //pWextState->authKeyMgmt = wrqu->param.value; |
| 3173 | //This is test code. I need to actually KNOW whether this is an RSN Assoc or WPA. |
| 3174 | pWextState->collectedAuthType = eCSR_AUTH_TYPE_RSN; |
| 3175 | } |
| 3176 | #else |
| 3177 | /*Save the key management*/ |
| 3178 | pWextState->authKeyMgmt = wrqu->param.value; |
| 3179 | #endif /* FEATURE_WLAN_CCX */ |
| 3180 | } |
| 3181 | break; |
| 3182 | |
| 3183 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 3184 | { |
| 3185 | if(wrqu->param.value) { |
| 3186 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 3187 | "Counter Measure started %d", wrqu->param.value); |
| 3188 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STARTED; |
| 3189 | } |
| 3190 | else { |
| 3191 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 3192 | "Counter Measure stopped=%d", wrqu->param.value); |
| 3193 | pWextState->mTKIPCounterMeasures = TKIP_COUNTER_MEASURE_STOPED; |
| 3194 | } |
| 3195 | } |
| 3196 | break; |
| 3197 | case IW_AUTH_DROP_UNENCRYPTED: |
| 3198 | case IW_AUTH_WPA_ENABLED: |
| 3199 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 3200 | case IW_AUTH_ROAMING_CONTROL: |
| 3201 | case IW_AUTH_PRIVACY_INVOKED: |
| 3202 | |
| 3203 | default: |
| 3204 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3205 | hddLog(LOGW, "%s called with unsupported auth type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3206 | wrqu->param.flags & IW_AUTH_INDEX); |
| 3207 | break; |
| 3208 | } |
| 3209 | |
| 3210 | EXIT(); |
| 3211 | return 0; |
| 3212 | } |
| 3213 | /**--------------------------------------------------------------------------- |
| 3214 | |
| 3215 | \brief iw_get_auth() - |
| 3216 | This function returns the auth type to the wpa_supplicant. |
| 3217 | |
| 3218 | \param - dev - Pointer to the net device. |
| 3219 | - info - Pointer to the iw_request_info. |
| 3220 | - wrqu - Pointer to the iwreq_data. |
| 3221 | - extra - Pointer to the data. |
| 3222 | \return - 0 for success, non zero for failure |
| 3223 | |
| 3224 | --------------------------------------------------------------------------*/ |
| 3225 | int iw_get_auth(struct net_device *dev,struct iw_request_info *info, |
| 3226 | union iwreq_data *wrqu,char *extra) |
| 3227 | { |
| 3228 | hdd_adapter_t* pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3229 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3230 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 3231 | ENTER(); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3232 | |
| 3233 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3234 | { |
| 3235 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3236 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3237 | return -EBUSY; |
| 3238 | } |
| 3239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3240 | switch(pRoamProfile->negotiatedAuthType) |
| 3241 | { |
| 3242 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3243 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 3244 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 3245 | break; |
| 3246 | case eCSR_AUTH_TYPE_WPA: |
| 3247 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 3248 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 3249 | break; |
| 3250 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3251 | case eCSR_AUTH_TYPE_FT_RSN: |
| 3252 | #endif |
| 3253 | case eCSR_AUTH_TYPE_RSN: |
| 3254 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 3255 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 3256 | break; |
| 3257 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3258 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 3259 | break; |
| 3260 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3261 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 3262 | break; |
| 3263 | case eCSR_AUTH_TYPE_UNKNOWN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3264 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3265 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 3266 | break; |
| 3267 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3268 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 3269 | break; |
| 3270 | case eCSR_AUTH_TYPE_WPA_PSK: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3271 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3272 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 3273 | return -EIO; |
| 3274 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3275 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 3276 | #endif |
| 3277 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 3278 | #ifdef WLAN_FEATURE_11W |
| 3279 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 3280 | #endif |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3281 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3282 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 3283 | return -EIO; |
| 3284 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3285 | hddLog(LOG1,"%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3286 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 3287 | return -EIO; |
| 3288 | } |
| 3289 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) |
| 3290 | { |
| 3291 | switch(pRoamProfile->negotiatedUCEncryptionType) |
| 3292 | { |
| 3293 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3294 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 3295 | break; |
| 3296 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 3297 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 3298 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 3299 | break; |
| 3300 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3301 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 3302 | break; |
| 3303 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 3304 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 3305 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 3306 | break; |
| 3307 | case eCSR_ENCRYPT_TYPE_AES: |
| 3308 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 3309 | break; |
| 3310 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3311 | hddLog(LOG1, "%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3312 | return -EIO; |
| 3313 | } |
| 3314 | } |
| 3315 | |
| 3316 | if(((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) |
| 3317 | { |
| 3318 | switch(pRoamProfile->negotiatedMCEncryptionType) |
| 3319 | { |
| 3320 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3321 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 3322 | break; |
| 3323 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 3324 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 3325 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 3326 | break; |
| 3327 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3328 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 3329 | break; |
| 3330 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 3331 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 3332 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 3333 | break; |
| 3334 | case eCSR_ENCRYPT_TYPE_AES: |
| 3335 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 3336 | break; |
| 3337 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3338 | hddLog(LOG1, "%s called with unknown auth type", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3339 | return -EIO; |
| 3340 | } |
| 3341 | } |
| 3342 | |
| 3343 | hddLog(LOG1, "%s called with auth type %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3344 | __func__, pRoamProfile->AuthType.authType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3345 | EXIT(); |
| 3346 | return 0; |
| 3347 | } |
| 3348 | /**--------------------------------------------------------------------------- |
| 3349 | |
| 3350 | \brief iw_set_ap_address() - |
| 3351 | This function calls the sme_RoamConnect function to associate |
| 3352 | to the AP with the specified BSSID received from the wpa_supplicant. |
| 3353 | |
| 3354 | \param - dev - Pointer to the net device. |
| 3355 | - info - Pointer to the iw_request_info. |
| 3356 | - wrqu - Pointer to the iwreq_data. |
| 3357 | - extra - Pointer to the data. |
| 3358 | \return - 0 for success, non zero for failure |
| 3359 | |
| 3360 | --------------------------------------------------------------------------*/ |
| 3361 | int iw_set_ap_address(struct net_device *dev, |
| 3362 | struct iw_request_info *info, |
| 3363 | union iwreq_data *wrqu, char *extra) |
| 3364 | { |
| 3365 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 3366 | v_U8_t *pMacAddress=NULL; |
| 3367 | ENTER(); |
| 3368 | pMacAddress = (v_U8_t*) wrqu->ap_addr.sa_data; |
| 3369 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%02x:%02x:%02x:%02x:%02x:%02x",pMacAddress[0],pMacAddress[1], |
| 3370 | pMacAddress[2],pMacAddress[3],pMacAddress[4],pMacAddress[5]); |
| 3371 | vos_mem_copy( pHddStaCtx->conn_info.bssId, pMacAddress, sizeof( tCsrBssid )); |
| 3372 | EXIT(); |
| 3373 | |
| 3374 | return 0; |
| 3375 | } |
| 3376 | /**--------------------------------------------------------------------------- |
| 3377 | |
| 3378 | \brief iw_get_ap_address() - |
| 3379 | This function returns the BSSID to the wpa_supplicant |
| 3380 | \param - dev - Pointer to the net device. |
| 3381 | - info - Pointer to the iw_request_info. |
| 3382 | - wrqu - Pointer to the iwreq_data. |
| 3383 | - extra - Pointer to the data. |
| 3384 | \return - 0 for success, non zero for failure |
| 3385 | |
| 3386 | --------------------------------------------------------------------------*/ |
| 3387 | int iw_get_ap_address(struct net_device *dev, |
| 3388 | struct iw_request_info *info, |
| 3389 | union iwreq_data *wrqu, char *extra) |
| 3390 | { |
| 3391 | //hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3392 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 3393 | |
| 3394 | ENTER(); |
| 3395 | |
| 3396 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 3397 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 3398 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 3399 | memcpy(wrqu->ap_addr.sa_data,pHddStaCtx->conn_info.bssId,ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3400 | } |
| 3401 | else |
| 3402 | { |
| 3403 | memset(wrqu->ap_addr.sa_data,0,sizeof(wrqu->ap_addr.sa_data)); |
| 3404 | } |
| 3405 | EXIT(); |
| 3406 | return 0; |
| 3407 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 3408 | |
| 3409 | |
| 3410 | /**--------------------------------------------------------------------------- |
| 3411 | |
| 3412 | \brief hdd_ResetCountryCodeAfterDisAssoc - |
| 3413 | This function reset the country code to default |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 3414 | \param - pAdapter - Pointer to HDD adapter |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 3415 | \return - nothing |
| 3416 | |
| 3417 | --------------------------------------------------------------------------*/ |
| 3418 | void hdd_ResetCountryCodeAfterDisAssoc(hdd_adapter_t *pAdapter) |
| 3419 | { |
| 3420 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
| 3421 | tSmeConfigParams smeConfig; |
| 3422 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3423 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 3424 | tANI_U8 currentCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 3425 | |
| 3426 | sme_GetConfigParam(pHddCtx->hHal, &smeConfig); |
| 3427 | |
| 3428 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 3429 | "%s: 11d is %s\n",__func__, |
| 3430 | smeConfig.csrConfig.Is11dSupportEnabled ? "Enabled" : "Disabled"); |
| 3431 | /* Reset country code only when 11d is enabled |
| 3432 | */ |
| 3433 | if (smeConfig.csrConfig.Is11dSupportEnabled) |
| 3434 | { |
| 3435 | sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, &defaultCountryCode[0]); |
| 3436 | sme_GetCurrentCountryCode(pHddCtx->hHal, ¤tCountryCode[0]); |
| 3437 | |
| 3438 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 3439 | "%s: Default country code: %c%c%c, Current Country code: %c%c%c \n", |
| 3440 | __func__, |
| 3441 | defaultCountryCode[0], defaultCountryCode[1], defaultCountryCode[2], |
| 3442 | currentCountryCode[0], currentCountryCode[1], currentCountryCode[2]); |
| 3443 | /* Reset country code only when there is a mismatch |
| 3444 | * between current country code and default country code |
| 3445 | */ |
| 3446 | if ((defaultCountryCode[0] != currentCountryCode[0]) || |
| 3447 | (defaultCountryCode[1] != currentCountryCode[1]) || |
| 3448 | (defaultCountryCode[2] != currentCountryCode[2])) |
| 3449 | { |
| 3450 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 3451 | "%s: Disconnected from the AP/Assoc failed and " |
| 3452 | "resetting the country code to default\n",__func__); |
| 3453 | /*reset the country code of previous connection*/ |
| 3454 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, NULL, |
| 3455 | &defaultCountryCode[0], pAdapter, |
| 3456 | pHddCtx->pvosContext |
| 3457 | ); |
| 3458 | if( 0 != status ) |
| 3459 | { |
| 3460 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 3461 | "%s: failed to Reset the Country Code\n",__func__); |
| 3462 | } |
| 3463 | } |
| 3464 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3465 | else if (smeConfig.csrConfig.Is11hSupportEnabled) |
| 3466 | { |
| 3467 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 3468 | "%s: Disconnected from the AP/Assoc failed and " |
| 3469 | "resetting the 5G power values to default", __func__); |
| 3470 | sme_ResetPowerValuesFor5G (pHddCtx->hHal); |
| 3471 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 3472 | } |
| 3473 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame^] | 3474 | #ifdef WLAN_FEATURE_11W |
| 3475 | /**--------------------------------------------------------------------------- |
| 3476 | |
| 3477 | \brief hdd_indicateUnprotMgmtFrame - |
| 3478 | This function forwards the unprotected management frame to the supplicant |
| 3479 | \param - pAdapter - Pointer to HDD adapter |
| 3480 | - nFrameLength - Length of the unprotected frame being passed |
| 3481 | - pbFrames - Pointer to the frame buffer |
| 3482 | - frameType - 802.11 frame type |
| 3483 | \return - nothing |
| 3484 | |
| 3485 | --------------------------------------------------------------------------*/ |
| 3486 | void hdd_indicateUnprotMgmtFrame( hdd_adapter_t *pAdapter, |
| 3487 | tANI_U32 nFrameLength, |
| 3488 | tANI_U8* pbFrames, |
| 3489 | tANI_U8 frameType ) |
| 3490 | { |
| 3491 | tANI_U8 type = 0; |
| 3492 | tANI_U8 subType = 0; |
| 3493 | |
| 3494 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d", |
| 3495 | __func__, frameType, nFrameLength); |
| 3496 | |
| 3497 | /* Sanity Checks */ |
| 3498 | if (NULL == pAdapter) |
| 3499 | { |
| 3500 | hddLog( LOGE, FL("pAdapter is NULL")); |
| 3501 | return; |
| 3502 | } |
| 3503 | |
| 3504 | if (NULL == pAdapter->dev) |
| 3505 | { |
| 3506 | hddLog( LOGE, FL("pAdapter->dev is NULL")); |
| 3507 | return; |
| 3508 | } |
| 3509 | |
| 3510 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 3511 | { |
| 3512 | hddLog( LOGE, FL("pAdapter has invalid magic")); |
| 3513 | return; |
| 3514 | } |
| 3515 | |
| 3516 | if( !nFrameLength ) |
| 3517 | { |
| 3518 | hddLog( LOGE, FL("Frame Length is Invalid ZERO")); |
| 3519 | return; |
| 3520 | } |
| 3521 | |
| 3522 | if (NULL == pbFrames) { |
| 3523 | hddLog( LOGE, FL("pbFrames is NULL")); |
| 3524 | return; |
| 3525 | } |
| 3526 | |
| 3527 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 3528 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 3529 | |
| 3530 | /* Get pAdapter from Destination mac address of the frame */ |
| 3531 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) |
| 3532 | { |
| 3533 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, nFrameLength); |
| 3534 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 3535 | } |
| 3536 | else if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DEAUTH) |
| 3537 | { |
| 3538 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, nFrameLength); |
| 3539 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 3540 | } |
| 3541 | else |
| 3542 | { |
| 3543 | hddLog( LOGE, FL("Frame type %d and subtype %d are not valid"), type, subType); |
| 3544 | return; |
| 3545 | } |
| 3546 | } |
| 3547 | #endif |