From 7983af64591876cd839568b4a58946336bc608cb Mon Sep 17 00:00:00 2001 From: Ajit Pal Singh Date: Tue, 18 Apr 2017 16:54:09 +0530 Subject: [PATCH] qcacld-3.0: Reject STA assoc on non-AP chan if DNSC enabled It might happen that the STA-interface is in the process of associating and before association is complete, "Do_Not_Switch_Channel" is enabled on the AP-interface. Reject STA association if "Do_Not_Switch_Channel" is enabled. A check is performed in hdd_association_completion_handler() for "Do_Not_Switch_Channel" in AP/GO vdev and STA association is rejected accordingly. Change-Id: I3f319a9e14c28add68f9809eeb86e782e58e72de CRs-Fixed: 2036942 --- core/hdd/src/wlan_hdd_assoc.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 35522e0c5055..fe4b735b26da 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -2394,6 +2394,7 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, bool hddDisconInProgress = false; unsigned long rc; tSirResultCodes timeout_reason = 0; + bool ok; if (!pHddCtx) { hdd_err("HDD context is NULL"); @@ -2513,6 +2514,31 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, wlan_hdd_auto_shutdown_enable(pHddCtx, false); #endif + hdd_debug("check if STA chan ok for DNBS"); + if (policy_mgr_is_chan_ok_for_dnbs(pHddCtx->hdd_psoc, + pHddStaCtx->conn_info.operationChannel, + &ok)) { + hdd_err("Unable to check DNBS eligibility for chan:%d", + pHddStaCtx->conn_info.operationChannel); + return QDF_STATUS_E_FAILURE; + } + + if (!ok) { + hdd_err("Chan:%d not suitable for DNBS", + pHddStaCtx->conn_info.operationChannel); + wlan_hdd_netif_queue_control(pAdapter, + WLAN_NETIF_CARRIER_OFF, + WLAN_CONTROL_PATH); + if (!hddDisconInProgress) { + hdd_err("Disconnecting..."); + sme_roam_disconnect( + WLAN_HDD_GET_HAL_CTX(pAdapter), + pAdapter->sessionId, + eCSR_DISCONNECT_REASON_UNSPECIFIED); + } + return QDF_STATUS_E_FAILURE; + } + hdd_debug("check for SAP restart"); policy_mgr_check_concurrent_intf_and_restart_sap( pHddCtx->hdd_psoc);