From 1850d9ca8048663080520514dfd53a4bf2948e61 Mon Sep 17 00:00:00 2001 From: Jinwei Chen Date: Mon, 20 Aug 2018 15:59:06 +0800 Subject: [PATCH] qcacld-3.0: send deauth if recevie data from non-assoc STA If SAP receive unicast data from a non-assoc STA, SAP should send deauth mgmt frame to this STA, add this part logic to serve data path. Change-Id: I47346e751b89eda77f6d6450218e2b70fe6b4953 CRs-Fixed: 2298550 --- core/cds/src/cds_api.c | 3 +- core/mac/src/include/sir_params.h | 2 ++ .../mac/src/pe/lim/lim_link_monitoring_algo.c | 36 +++++++++++++++++++ .../src/pe/lim/lim_process_message_queue.c | 3 ++ core/mac/src/pe/lim/lim_utils.h | 13 +++++++ core/wma/inc/wma.h | 11 ++++++ core/wma/src/wma_data.c | 30 ++++++++++++++++ 7 files changed, 97 insertions(+), 1 deletion(-) diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index ff4bf24edf7a..233b16533b44 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -87,7 +87,8 @@ static struct ol_if_ops dp_ol_if_ops = { .peer_rx_reorder_queue_remove = target_if_peer_rx_reorder_queue_remove, .is_hw_dbs_2x2_capable = policy_mgr_is_hw_dbs_2x2_capable, .lro_hash_config = target_if_lro_hash_config, - .rx_mic_error = wma_rx_mic_error_ind + .rx_mic_error = wma_rx_mic_error_ind, + .rx_invalid_peer = wma_rx_invalid_peer_ind /* TODO: Add any other control path calls required to OL_IF/WMA layer */ }; #else diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 604e06bcad0e..67f93a26c9c1 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -727,6 +727,8 @@ struct sir_mgmt_msg { #define SIR_LIM_DELETE_STA_CONTEXT_IND (SIR_LIM_ITC_MSG_TYPES_BEGIN + 0x11) /* Indication from HAL to delete BA */ #define SIR_LIM_UPDATE_BEACON (SIR_LIM_ITC_MSG_TYPES_BEGIN + 0x13) +/* Indication from HAL to handle RX invalid peer */ +#define SIR_LIM_RX_INVALID_PEER (SIR_LIM_ITC_MSG_TYPES_BEGIN + 0x15) /* LIM Timeout messages */ #define SIR_LIM_TIMEOUT_MSG_START ((SIR_LIM_MODULE_ID << 8) + 0xD0) diff --git a/core/mac/src/pe/lim/lim_link_monitoring_algo.c b/core/mac/src/pe/lim/lim_link_monitoring_algo.c index a54215fbbd1b..8e48076c1a39 100644 --- a/core/mac/src/pe/lim/lim_link_monitoring_algo.c +++ b/core/mac/src/pe/lim/lim_link_monitoring_algo.c @@ -561,3 +561,39 @@ hb_handler_fail: WLAN_WAKE_ALL_NETIF_QUEUE, WLAN_CONTROL_PATH); } + +void lim_rx_invalid_peer_process(tpAniSirGlobal mac_ctx, + struct scheduler_msg *lim_msg) +{ + struct ol_rx_inv_peer_params *msg = + (struct ol_rx_inv_peer_params *)lim_msg->bodyptr; + tpPESession session_entry; + uint16_t reason_code = + eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON; + + if (NULL == msg) { + pe_err("Invalid body pointer in message"); + return; + } + + session_entry = pe_find_session_by_sme_session_id(mac_ctx, + msg->vdev_id); + if (NULL == session_entry) { + pe_err("session not found for given sme session"); + qdf_mem_free(msg); + return; + } + + /* only if SAP mode */ + if (session_entry->operMode == BSS_OPERATIONAL_MODE_AP) { + pe_debug("send deauth frame to non-assoc STA"); + lim_send_deauth_mgmt_frame(mac_ctx, + reason_code, + msg->ta, + session_entry, + false); + } + + qdf_mem_free(msg); + lim_msg->bodyptr = NULL; +} diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index 52826dbbb715..8e7a1e912f16 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -1786,6 +1786,9 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, case SIR_LIM_DELETE_STA_CONTEXT_IND: lim_delete_sta_context(mac_ctx, msg); break; + case SIR_LIM_RX_INVALID_PEER: + lim_rx_invalid_peer_process(mac_ctx, msg); + break; case SIR_LIM_JOIN_FAIL_TIMEOUT: case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT: case SIR_LIM_AUTH_FAIL_TIMEOUT: diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 310d23da92ca..fd3f3d784809 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -1442,4 +1442,17 @@ static inline void lim_set_peer_twt_cap(tpPESession session, } #endif +/** + * lim_rx_invalid_peer_process() - process rx invalid peer indication + * @mac_ctx: Pointer to Global MAC structure + * @lim_msg: Pointer to scheduler message + * + * This function will process the rx data invalid peer indication, + * if the vdev operation mode is SAP, then send the deauth mgmt frame + * to STA. + * + * Return: None + */ +void lim_rx_invalid_peer_process(tpAniSirGlobal mac_ctx, + struct scheduler_msg *lim_msg); #endif /* __LIM_UTILS_H */ diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 28fabc774578..3474f5c7618e 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -2542,4 +2542,15 @@ QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt, */ void wma_check_and_set_wake_timer(uint32_t time); +/** + * wma_rx_invalid_peer_ind(): the callback for DP to notify WMA layer + * invalid peer data is received, this function will send message to + * lim module. + * @vdev_id: virtual device ID + * @wh: Pointer to 802.11 frame header + * + * Return: 0 for success or non-zero on failure + */ +uint8_t wma_rx_invalid_peer_ind(uint8_t vdev_id, void *wh); + #endif diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c index a177953fc433..1dcafa35cf65 100644 --- a/core/wma/src/wma_data.c +++ b/core/wma/src/wma_data.c @@ -3194,3 +3194,33 @@ void wma_rx_mic_error_ind(void *scn_handle, uint16_t vdev_id, void *wh) wma_indicate_err(OL_RX_ERR_TKIP_MIC, &err_info); } + +uint8_t wma_rx_invalid_peer_ind(uint8_t vdev_id, void *wh) +{ + struct ol_rx_inv_peer_params *rx_inv_msg; + struct ieee80211_frame *wh_l = (struct ieee80211_frame *)wh; + tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); + + rx_inv_msg = (struct ol_rx_inv_peer_params *) + qdf_mem_malloc(sizeof(struct ol_rx_inv_peer_params)); + if (NULL == rx_inv_msg) { + WMA_LOGE("%s: mem alloc failed for rx_data_msg", __func__); + return -ENOMEM; + } + + rx_inv_msg->vdev_id = vdev_id; + qdf_mem_copy(rx_inv_msg->ra, wh_l->i_addr1, OL_TXRX_MAC_ADDR_LEN); + qdf_mem_copy(rx_inv_msg->ta, wh_l->i_addr2, OL_TXRX_MAC_ADDR_LEN); + + WMA_LOGD("%s: vdev_id %d", __func__, vdev_id); + WMA_LOGD("%s: RA:" MAC_ADDRESS_STR, + __func__, + MAC_ADDR_ARRAY(rx_inv_msg->ra)); + WMA_LOGD("%s: TA:" MAC_ADDRESS_STR, + __func__, + MAC_ADDR_ARRAY(rx_inv_msg->ta)); + + wma_send_msg(wma, SIR_LIM_RX_INVALID_PEER, (void *)rx_inv_msg, 0); + + return 0; +}