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