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