From fbdb24390872ec1456ff04351664d3819ede3f2d Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Fri, 4 Dec 2015 13:43:16 -0800 Subject: [PATCH] qcacld-3.0: Replace tSirMacAddr with cdf_mac_addr in sSirSmeSetContext Req/Rsp Replace tSirMacAddr with cdf_mac_addr in struct sSirSmeSetContext Req/Rsp. Change-Id: If4f75c162dbb4156d462a927033f94b9170a518f CRs-Fixed: 898864 --- core/mac/inc/sir_api.h | 6 +-- core/mac/src/pe/lim/lim_ft.c | 6 +-- .../src/pe/lim/lim_process_mlm_req_messages.c | 25 +++++----- .../src/pe/lim/lim_process_mlm_rsp_messages.c | 14 +++--- .../src/pe/lim/lim_process_sme_req_messages.c | 13 +++-- core/mac/src/pe/lim/lim_security_utils.c | 15 ++---- .../src/pe/lim/lim_send_sme_rsp_messages.c | 9 +--- .../src/pe/lim/lim_send_sme_rsp_messages.h | 2 +- core/mac/src/pe/lim/lim_types.h | 2 +- core/sme/inc/csr_internal.h | 2 +- core/sme/src/csr/csr_api_roam.c | 48 +++++++++---------- core/wma/inc/wma_if.h | 4 +- core/wma/src/wma_dev_if.c | 2 +- core/wma/src/wma_mgmt.c | 14 +++--- 14 files changed, 77 insertions(+), 85 deletions(-) diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index b505277d5ad6..8ad8c1f61da6 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -1467,8 +1467,8 @@ typedef struct sSirSmeSetContextReq { uint16_t length; uint8_t sessionId; /* Session ID */ uint16_t transactionId; /* Transaction ID for cmd */ - tSirMacAddr peerMacAddr; - tSirMacAddr bssId; /* BSSID */ + struct cdf_mac_addr peer_macaddr; + struct cdf_mac_addr bssid; /* BSSID */ tSirKeyMaterial keyMaterial; } tSirSmeSetContextReq, *tpSirSmeSetContextReq; @@ -1480,7 +1480,7 @@ typedef struct sSirSmeSetContextRsp { uint8_t sessionId; /* Session ID */ uint16_t transactionId; /* Transaction ID for cmd */ tSirResultCodes statusCode; - tSirMacAddr peerMacAddr; + struct cdf_mac_addr peer_macaddr; } tSirSmeSetContextRsp, *tpSirSmeSetContextRsp; /* / Statistic definitions */ diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index c7d7f6ab53a7..09575f762364 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -1635,8 +1635,8 @@ bool lim_process_ft_update_key(tpAniSirGlobal pMac, uint32_t *pMsgBuf) extSetStaKeyParam; cdf_mem_zero(pMlmSetKeysReq, sizeof(tLimMlmSetKeysReq)); - cdf_mem_copy(pMlmSetKeysReq->peerMacAddr, pKeyInfo->bssId, - sizeof(tSirMacAddr)); + cdf_mem_copy(pMlmSetKeysReq->peer_macaddr.bytes, + pKeyInfo->bssId, CDF_MAC_ADDR_SIZE); pMlmSetKeysReq->sessionId = psessionEntry->peSessionId; pMlmSetKeysReq->smesessionId = psessionEntry->smeSessionId; pMlmSetKeysReq->edType = pKeyInfo->keyMaterial.edType; @@ -1687,7 +1687,7 @@ bool lim_process_ft_update_key(tpAniSirGlobal pMac, uint32_t *pMsgBuf) MAC_ADDR_ARRAY(pKeyInfo->bssId)); ) - sir_copy_mac_addr(pAddBssParams->extSetStaKeyParam.peerMacAddr, + sir_copy_mac_addr(pAddBssParams->extSetStaKeyParam.peer_macaddr.bytes, pKeyInfo->bssId); pAddBssParams->extSetStaKeyParam.sendRsp = false; diff --git a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c index c1761c855218..11561472d032 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c @@ -2209,7 +2209,7 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) uint16_t aid; uint16_t sta_idx = 0; uint32_t default_key_id = 0; - tSirMacAddr curr_bssid; + struct cdf_mac_addr curr_bssid; tpDphHashNode sta_ds; tLimMlmSetKeysReq *mlm_set_keys_req; tLimMlmSetKeysCnf mlm_set_keys_cnf; @@ -2236,8 +2236,8 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) "AID [%d], ED Type [%d], # Keys [%d] & Peer MAC Addr - "), mlm_set_keys_req->aid, mlm_set_keys_req->edType, mlm_set_keys_req->numKeys); - lim_print_mac_addr(mac_ctx, mlm_set_keys_req->peerMacAddr, LOGW); - sir_copy_mac_addr(curr_bssid, session->bssId); + lim_print_mac_addr(mac_ctx, mlm_set_keys_req->peer_macaddr.bytes, LOGW); + cdf_mem_copy(curr_bssid.bytes, session->bssId, CDF_MAC_ADDR_SIZE); switch (GET_LIM_SYSTEM_ROLE(session)) { case eLIM_STA_ROLE: @@ -2247,13 +2247,15 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) * check if TDLS is enabled. */ #ifndef FEATURE_WLAN_TDLS - if ((!lim_is_addr_bc(mlm_set_keys_req->peerMacAddr)) && - (!cdf_mem_compare(mlm_set_keys_req->peerMacAddr, - curr_bssid, sizeof(tSirMacAddr)))) { + if ((!cdf_is_macaddr_broadcast( + &mlm_set_keys_req->peer_macaddr)) && + (!cdf_is_macaddr_equal(&mlm_set_keys_req->peer_macaddr, + &curr_bssid))) { lim_log(mac_ctx, LOGW, FL("Received MLM_SETKEYS_REQ with invalid BSSID" MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(mlm_set_keys_req->peerMacAddr)); + MAC_ADDR_ARRAY(mlm_set_keys_req-> + peer_macaddr.bytes)); /* * Prepare and Send LIM_MLM_SETKEYS_CNF with error code */ @@ -2280,7 +2282,7 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) * mlm_set_keys_req->key.unicast = 0 -> Multicast/broadcast * mlm_set_keys_req->key.unicast - 1 -> Unicast keys are being set */ - if (lim_is_addr_bc(mlm_set_keys_req->peerMacAddr)) { + if (cdf_is_macaddr_broadcast(&mlm_set_keys_req->peer_macaddr)) { lim_log(mac_ctx, LOG1, FL("Trying to set Group Keys...%d "), mlm_set_keys_req->sessionId); /* @@ -2304,7 +2306,7 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) * peer entity for which keys need to be set. */ sta_ds = dph_lookup_hash_entry(mac_ctx, - mlm_set_keys_req->peerMacAddr, &aid, + mlm_set_keys_req->peer_macaddr.bytes, &aid, &session->dph.dphHashTable); if ((sta_ds == NULL) || ((sta_ds->mlmStaContext.mlmState != @@ -2317,7 +2319,8 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) lim_log(mac_ctx, LOG1, FL("Invalid MLM_SETKEYS_REQ, Addr = " MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(mlm_set_keys_req->peerMacAddr)); + MAC_ADDR_ARRAY(mlm_set_keys_req-> + peer_macaddr.bytes)); /* Prepare and Send LIM_MLM_SETKEYS_CNF */ mlm_set_keys_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; @@ -2352,7 +2355,7 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) FL("Trying to set keys for STA Index [%d], using default_key_id [%d]"), sta_idx, default_key_id); - if (lim_is_addr_bc(mlm_set_keys_req->peerMacAddr)) { + if (cdf_is_macaddr_broadcast(&mlm_set_keys_req->peer_macaddr)) { session->limPrevMlmState = session->limMlmState; session->limMlmState = eLIM_MLM_WT_SET_BSS_KEY_STATE; MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c index 4f5c5d6148f2..af40676794fd 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c @@ -1482,14 +1482,14 @@ void lim_process_mlm_set_keys_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) if (LIM_IS_AP_ROLE(psessionEntry) || LIM_IS_BT_AMP_AP_ROLE(psessionEntry)) { sta_ds = dph_lookup_hash_entry(pMac, - pMlmSetKeysCnf->peerMacAddr, + pMlmSetKeysCnf->peer_macaddr.bytes, &aid, &psessionEntry->dph.dphHashTable); if (sta_ds != NULL) sta_ds->is_key_installed = 1; } } lim_send_sme_set_context_rsp(pMac, - pMlmSetKeysCnf->peerMacAddr, + pMlmSetKeysCnf->peer_macaddr, 1, (tSirResultCodes) pMlmSetKeysCnf->resultCode, psessionEntry, psessionEntry->smeSessionId, @@ -3270,9 +3270,8 @@ void lim_process_mlm_set_sta_key_rsp(tpAniSirGlobal mac_ctx, (tpLimMlmSetKeysReq) mac_ctx->lim.gpLimMlmSetKeysReq; /* Prepare and Send LIM_MLM_SETKEYS_CNF */ if (NULL != lpLimMlmSetKeysReq) { - cdf_mem_copy((uint8_t *) &mlm_set_key_cnf.peerMacAddr, - (uint8_t *) lpLimMlmSetKeysReq->peerMacAddr, - sizeof(tSirMacAddr)); + cdf_copy_macaddr(&mlm_set_key_cnf.peer_macaddr, + &lpLimMlmSetKeysReq->peer_macaddr); /* * Free the buffer cached for the global * mac_ctx->lim.gpLimMlmSetKeysReq @@ -3359,9 +3358,8 @@ void lim_process_mlm_set_bss_key_rsp(tpAniSirGlobal mac_ctx, /* Prepare and Send LIM_MLM_SETKEYS_CNF */ if (NULL != set_key_req) { - cdf_mem_copy((uint8_t *) &set_key_cnf.peerMacAddr, - (uint8_t *) set_key_req->peerMacAddr, - sizeof(tSirMacAddr)); + cdf_copy_macaddr(&set_key_cnf.peer_macaddr, + &set_key_req->peer_macaddr); /* * Free the buffer cached for the * global mac_ctx->lim.gpLimMlmSetKeysReq diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index f1d42dcb5daf..d9858920dc14 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -3003,19 +3003,19 @@ __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) "numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS"), set_context_req->keyMaterial.numKeys); lim_send_sme_set_context_rsp(mac_ctx, - set_context_req->peerMacAddr, 1, + set_context_req->peer_macaddr, 1, eSIR_SME_INVALID_PARAMETERS, NULL, sme_session_id, sme_transaction_id); goto end; } session_entry = pe_find_session_by_bssid(mac_ctx, - set_context_req->bssId, &session_id); + set_context_req->bssid.bytes, &session_id); if (session_entry == NULL) { lim_log(mac_ctx, LOGW, FL("Session does not exist for given BSSID")); lim_send_sme_set_context_rsp(mac_ctx, - set_context_req->peerMacAddr, 1, + set_context_req->peer_macaddr, 1, eSIR_SME_INVALID_PARAMETERS, NULL, sme_session_id, sme_transaction_id); goto end; @@ -3048,9 +3048,8 @@ __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) "no.of keys exceeded max num of default keys limit")); goto end; } - cdf_mem_copy((uint8_t *) &mlm_set_key_req->peerMacAddr, - (uint8_t *) &set_context_req->peerMacAddr, - sizeof(tSirMacAddr)); + cdf_copy_macaddr(&mlm_set_key_req->peer_macaddr, + &set_context_req->peer_macaddr); cdf_mem_copy((uint8_t *) &mlm_set_key_req->key, (uint8_t *) &set_context_req->keyMaterial.key, @@ -3098,7 +3097,7 @@ __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) lim_print_sme_state(mac_ctx, LOGE, session_entry->limSmeState); lim_send_sme_set_context_rsp(mac_ctx, - set_context_req->peerMacAddr, 1, + set_context_req->peer_macaddr, 1, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, session_entry, sme_session_id, sme_transaction_id); diff --git a/core/mac/src/pe/lim/lim_security_utils.c b/core/mac/src/pe/lim/lim_security_utils.c index ae0a42224d06..40d51323688b 100644 --- a/core/mac/src/pe/lim/lim_security_utils.c +++ b/core/mac/src/pe/lim/lim_security_utils.c @@ -775,15 +775,10 @@ void lim_post_sme_set_keys_cnf(tpAniSirGlobal pMac, tLimMlmSetKeysCnf *mlmSetKeysCnf) { /* Prepare and Send LIM_MLM_SETKEYS_CNF */ - cdf_mem_copy((uint8_t *) &mlmSetKeysCnf->peerMacAddr, - (uint8_t *) pMlmSetKeysReq->peerMacAddr, - sizeof(tSirMacAddr)); + cdf_copy_macaddr(&mlmSetKeysCnf->peer_macaddr, + &pMlmSetKeysReq->peer_macaddr); - cdf_mem_copy((uint8_t *) &mlmSetKeysCnf->peerMacAddr, - (uint8_t *) pMlmSetKeysReq->peerMacAddr, - sizeof(tSirMacAddr)); - - /* / Free up buffer allocated for mlmSetKeysReq */ + /* Free up buffer allocated for mlmSetKeysReq */ cdf_mem_free(pMlmSetKeysReq); pMac->lim.gpLimMlmSetKeysReq = NULL; @@ -969,8 +964,8 @@ void lim_send_set_sta_key_req(tpAniSirGlobal pMac, pSetStaKeyParams->defWEPIdx = defWEPIdx; pSetStaKeyParams->smesessionId = pMlmSetKeysReq->smesessionId; - cdf_mem_copy(pSetStaKeyParams->peerMacAddr, - pMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr)); + cdf_copy_macaddr(&pSetStaKeyParams->peer_macaddr, + &pMlmSetKeysReq->peer_macaddr); if (sendRsp == true) { /** Store the Previous MlmState*/ diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 1af8bad7d681..1eab1eccb9a1 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -1568,13 +1568,11 @@ lim_send_sme_wm_status_change_ntf(tpAniSirGlobal mac_ctx, */ void lim_send_sme_set_context_rsp(tpAniSirGlobal pMac, - tSirMacAddr peerMacAddr, uint16_t aid, + struct cdf_mac_addr peer_macaddr, uint16_t aid, tSirResultCodes resultCode, tpPESession psessionEntry, uint8_t smesessionId, uint16_t smetransactionId) { - - uint8_t *pBuf; tSirMsgQ mmhMsg; tSirSmeSetContextRsp *pSirSmeSetContextRsp; @@ -1592,10 +1590,7 @@ lim_send_sme_set_context_rsp(tpAniSirGlobal pMac, pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp); pSirSmeSetContextRsp->statusCode = resultCode; - pBuf = pSirSmeSetContextRsp->peerMacAddr; - - cdf_mem_copy(pBuf, (uint8_t *) peerMacAddr, sizeof(tSirMacAddr)); - pBuf += sizeof(tSirMacAddr); + cdf_copy_macaddr(&pSirSmeSetContextRsp->peer_macaddr, &peer_macaddr); /* Update SME session and transaction Id */ pSirSmeSetContextRsp->sessionId = smesessionId; diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h index 260b128e9b47..e4ec6ea2a793 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h @@ -67,7 +67,7 @@ void lim_send_sme_deauth_ind(tpAniSirGlobal, tpDphHashNode, tpPESession psessionEntry); void lim_send_sme_wm_status_change_ntf(tpAniSirGlobal, tSirSmeStatusChangeCode, uint32_t *, uint16_t, uint8_t); -void lim_send_sme_set_context_rsp(tpAniSirGlobal, tSirMacAddr, uint16_t, +void lim_send_sme_set_context_rsp(tpAniSirGlobal, struct cdf_mac_addr, uint16_t, tSirResultCodes, tpPESession, uint8_t, uint16_t); void lim_send_sme_neighbor_bss_ind(tpAniSirGlobal, tLimScanResultNode *); void lim_handle_delete_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ MsgQ); diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index 55f02fa66f22..d10bcccb88d2 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -371,7 +371,7 @@ typedef struct sLimMlmPurgeStaInd { } tLimMlmPurgeStaInd, *tpLimMlmPurgeStaInd; typedef struct sLimMlmSetKeysCnf { - tSirMacAddr peerMacAddr; + struct cdf_mac_addr peer_macaddr; uint16_t resultCode; uint16_t aid; uint8_t sessionId; diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index d18fc3d8d994..89abb9d49482 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -409,7 +409,7 @@ typedef struct tagSetKeyCmd { eCsrEncryptionType encType; eCsrAuthType authType; tAniKeyDirection keyDirection; /* Tx, Rx or Tx-and-Rx */ - tSirMacAddr peerMac; /* Peer's MAC address. ALL 1's for group key */ + struct cdf_mac_addr peermac; /* Peer's MAC address. ALL 1's for group key */ uint8_t paeRole; /* 0 for supplicant */ uint8_t keyId; /* Kye index */ uint8_t keyLength; /* Number of bytes containing the key in pKey */ diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 230ad1b927a5..b9a5e0d94ea9 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -213,7 +213,8 @@ static CDF_STATUS csr_roam_free_connected_info(tpAniSirGlobal pMac, tCsrRoamConnectedInfo * pConnectedInfo); CDF_STATUS csr_send_mb_set_context_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, - tSirMacAddr peerMacAddr, uint8_t numKeys, + struct cdf_mac_addr peer_macaddr, + uint8_t numKeys, tAniEdType edType, bool fUnicast, tAniKeyDirection aniKeyDirection, uint8_t keyId, uint8_t keyLength, @@ -9423,8 +9424,8 @@ static CDF_STATUS csr_roam_issue_set_key_command(tpAniSirGlobal pMac, pCommand->u.setKeyCmd.roamId = roamId; pCommand->u.setKeyCmd.encType = pSetKey->encType; pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; - cdf_mem_copy(&pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, - sizeof(struct cdf_mac_addr)); + cdf_copy_macaddr(&pCommand->u.setKeyCmd.peermac, + &pSetKey->peerMac); /* 0 for supplicant */ pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; pCommand->u.setKeyCmd.keyId = pSetKey->keyId; @@ -9463,7 +9464,7 @@ CDF_STATUS csr_roam_process_set_key_command(tpAniSirGlobal pMac, tSmeCmd *pComma tAniEdType edType = csr_translate_encrypt_type_to_ed_type(pCommand->u.setKeyCmd.encType); bool fUnicast = - (pCommand->u.setKeyCmd.peerMac[0] == 0xFF) ? false : true; + (pCommand->u.setKeyCmd.peermac.bytes[0] == 0xFF) ? false : true; uint32_t sessionId = pCommand->sessionId; #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); @@ -9478,7 +9479,7 @@ CDF_STATUS csr_roam_process_set_key_command(tpAniSirGlobal pMac, tSmeCmd *pComma if (eSIR_ED_NONE != edType) { cdf_mem_set(&setKeyEvent, sizeof(host_event_wlan_security_payload_type), 0); - if (*((uint8_t *) &pCommand->u.setKeyCmd.peerMac) & 0x01) { + if (cdf_is_macaddr_group(&pCommand->u.setKeyCmd.peermac)) { setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; setKeyEvent.encryptionModeMulticast = (uint8_t) diag_enc_type_from_csr_type(pCommand->u. @@ -9520,8 +9521,9 @@ CDF_STATUS csr_roam_process_set_key_command(tpAniSirGlobal pMac, tSmeCmd *pComma #endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */ if (csr_is_set_key_allowed(pMac, sessionId)) { status = csr_send_mb_set_context_req_msg(pMac, sessionId, - (uint8_t *) &pCommand->u. - setKeyCmd.peerMac, numKeys, + pCommand->u. + setKeyCmd.peermac, + numKeys, edType, fUnicast, pCommand->u.setKeyCmd. keyDirection, @@ -9546,8 +9548,8 @@ CDF_STATUS csr_roam_process_set_key_command(tpAniSirGlobal pMac, tSmeCmd *pComma eCSR_ROAM_RESULT_FAILURE); #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR if (eSIR_ED_NONE != edType) { - if (*((uint8_t *) &pCommand->u.setKeyCmd.peerMac) & - 0x01) { + if (cdf_is_macaddr_group( + &pCommand->u.setKeyCmd.peermac)) { setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; } else { @@ -10748,7 +10750,7 @@ csr_roam_diag_set_ctx_rsp(tpAniSirGlobal mac_ctx, return; cdf_mem_set(&setKeyEvent, sizeof(host_event_wlan_security_payload_type), 0); - if (pRsp->peerMacAddr[0] & 0x01) + if (cdf_is_macaddr_group(&pRsp->peer_macaddr)) setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; else setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; @@ -10781,7 +10783,6 @@ csr_roam_chk_lnk_set_ctx_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *) msg_ptr; tListElem *entry; - tSirMacAddr Broadcastaddr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; cdf_mem_set(&roam_info, sizeof(roam_info), 0); entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList, @@ -10818,14 +10819,12 @@ csr_roam_chk_lnk_set_ctx_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) session->connectedProfile.bssid); } if (eSIR_SME_SUCCESS == pRsp->statusCode) { - cdf_mem_copy(&roam_info.peerMac, &pRsp->peerMacAddr, - sizeof(struct cdf_mac_addr)); + cdf_copy_macaddr(&roam_info.peerMac, &pRsp->peer_macaddr); /* Make sure we install the GTK before indicating to HDD as * authenticated. This is to prevent broadcast packets go out * after PTK and before GTK. */ - if (cdf_mem_compare(&Broadcastaddr, pRsp->peerMacAddr, - sizeof(tSirMacAddr))) { + if (cdf_is_macaddr_broadcast(&pRsp->peer_macaddr)) { tpSirSetActiveModeSetBncFilterReq pMsg; pMsg = cdf_mem_malloc( sizeof(tSirSetActiveModeSetBncFilterReq)); @@ -10841,9 +10840,10 @@ csr_roam_chk_lnk_set_ctx_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) } else { result = eCSR_ROAM_RESULT_FAILURE; sms_log(mac_ctx, LOGE, - FL("CSR: setkey command failed(%d) PeerMac " + FL("CSR: setkey command failed(err=%d) PeerMac " MAC_ADDRESS_STR), - pRsp->statusCode, MAC_ADDR_ARRAY(pRsp->peerMacAddr)); + pRsp->statusCode, + MAC_ADDR_ARRAY(pRsp->peer_macaddr.bytes)); } csr_roam_call_callback(mac_ctx, sessionId, &roam_info, cmd->u.setKeyCmd.roamId, @@ -14445,8 +14445,10 @@ CDF_STATUS csr_send_assoc_ind_to_upper_layer_cnf_msg(tpAniSirGlobal pMac, return CDF_STATUS_SUCCESS; } -CDF_STATUS csr_send_mb_set_context_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, - tSirMacAddr peerMacAddr, uint8_t numKeys, +CDF_STATUS csr_send_mb_set_context_req_msg(tpAniSirGlobal pMac, + uint32_t sessionId, + struct cdf_mac_addr peer_macaddr, + uint8_t numKeys, tAniEdType edType, bool fUnicast, tAniKeyDirection aniKeyDirection, uint8_t keyId, uint8_t keyLength, @@ -14477,11 +14479,9 @@ CDF_STATUS csr_send_mb_set_context_req_msg(tpAniSirGlobal pMac, uint32_t session pMsg->length = msgLen; pMsg->sessionId = (uint8_t) sessionId; pMsg->transactionId = 0; - cdf_mem_copy(pMsg->peerMacAddr, peerMacAddr, - sizeof(tSirMacAddr)); - cdf_mem_copy(pMsg->bssId, - pSession->connectedProfile.bssid.bytes, - sizeof(tSirMacAddr)); + cdf_copy_macaddr(&pMsg->peer_macaddr, &peer_macaddr); + cdf_copy_macaddr(&pMsg->bssid, + &pSession->connectedProfile.bssid); /** * Set the pMsg->keyMaterial.length field diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index f5875316f781..3428297832b1 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -373,7 +373,7 @@ typedef struct { tSirKeys key[SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS]; uint8_t singleTidRc; uint8_t smesessionId; - tSirMacAddr peerMacAddr; + struct cdf_mac_addr peer_macaddr; CDF_STATUS status; uint8_t sessionId; uint8_t sendRsp; @@ -390,7 +390,7 @@ typedef struct { * @key: key data */ typedef struct sLimMlmSetKeysReq { - tSirMacAddr peerMacAddr; + struct cdf_mac_addr peer_macaddr; uint8_t sessionId; /* Added For BT-AMP Support */ uint8_t smesessionId; /* Added for drivers based on wmi interface */ uint16_t aid; diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 6876ffa240b3..27993c16f62d 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -1190,7 +1190,7 @@ CDF_STATUS wma_create_peer(tp_wma_handle wma, ol_txrx_pdev_handle pdev, peer_addr); cdf_mem_set(&key_info, sizeof(key_info), 0); key_info.smesessionId = vdev_id; - cdf_mem_copy(key_info.peerMacAddr, peer_addr, + cdf_mem_copy(key_info.peer_macaddr.bytes, peer_addr, IEEE80211_ADDR_LEN); key_info.sendRsp = false; diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 84ffc0eb64ac..2373f92a8a13 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -1808,7 +1808,7 @@ void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma, */ static void wma_set_ibsskey_helper(tp_wma_handle wma_handle, tpSetBssKeyParams key_info, - uint8_t *peerMacAddr) + struct cdf_mac_addr peer_macaddr) { struct wma_set_key_params key_params; wmi_buf_t buf; @@ -1818,7 +1818,6 @@ static void wma_set_ibsskey_helper(tp_wma_handle wma_handle, ol_txrx_vdev_handle txrx_vdev; WMA_LOGD("BSS key setup for peer"); - ASSERT(NULL != peerMacAddr); txrx_vdev = wma_find_vdev_by_id(wma_handle, key_info->smesessionId); if (!txrx_vdev) { WMA_LOGE("%s:Invalid vdev handle", __func__); @@ -1833,7 +1832,8 @@ static void wma_set_ibsskey_helper(tp_wma_handle wma_handle, key_params.unicast = false; ASSERT(wlan_op_mode_ibss == txrx_vdev->opmode); - cdf_mem_copy(key_params.peer_mac, peerMacAddr, IEEE80211_ADDR_LEN); + cdf_mem_copy(key_params.peer_mac, peer_macaddr.bytes, + IEEE80211_ADDR_LEN); if (key_info->numKeys == 0 && (key_info->encType == eSIR_ED_WEP40 || @@ -1913,7 +1913,8 @@ void wma_set_stakey(tp_wma_handle wma_handle, tpSetStaKeyParams key_info) goto out; } - peer = ol_txrx_find_peer_by_addr(txrx_pdev, key_info->peerMacAddr, + peer = ol_txrx_find_peer_by_addr(txrx_pdev, + key_info->peer_macaddr.bytes, &peer_id); if (!peer) { WMA_LOGE("%s:Invalid peer for key setting", __func__); @@ -1954,7 +1955,8 @@ void wma_set_stakey(tp_wma_handle wma_handle, tpSetStaKeyParams key_info) key_params.unicast = true; key_params.def_key_idx = key_info->defWEPIdx; cdf_mem_copy((void *)key_params.peer_mac, - (const void *)key_info->peerMacAddr, IEEE80211_ADDR_LEN); + (const void *)key_info->peer_macaddr.bytes, + IEEE80211_ADDR_LEN); for (i = 0; i < num_keys; i++) { if (key_params.key_type != eSIR_ED_NONE && !key_info->key[i].keyLength) @@ -2004,7 +2006,7 @@ void wma_set_stakey(tp_wma_handle wma_handle, tpSetStaKeyParams key_info) */ if (wlan_op_mode_ibss == txrx_vdev->opmode) { wma_set_ibsskey_helper(wma_handle, &wma_handle->ibsskey_info, - key_info->peerMacAddr); + key_info->peer_macaddr); } /* TODO: Should we wait till we get HTT_T2H_MSG_TYPE_SEC_IND? */