From 7eed440897387069fa88089af38cee8a763f1906 Mon Sep 17 00:00:00 2001 From: Nitesh Shah Date: Mon, 27 Mar 2017 19:42:15 +0530 Subject: qcacld-2.0: Show peer in getTdlsPeers only if STA is associated If the STA is previously associated with AP and has TDLS peers, then getTdlsPeers will show the peers even after STA is disassociated. Thus, the fix is to show the peers only if the STA is in connected state. Change-Id: I8686ae3b8bb007b58942cdbd8873e48f227fe443 CRs-Fixed: 2025462 --- CORE/HDD/src/wlan_hdd_tdls.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CORE/HDD/src/wlan_hdd_tdls.c b/CORE/HDD/src/wlan_hdd_tdls.c index dc3171c4cc89..76fbe93ed58d 100644 --- a/CORE/HDD/src/wlan_hdd_tdls.c +++ b/CORE/HDD/src/wlan_hdd_tdls.c @@ -2303,12 +2303,25 @@ int wlan_hdd_tdls_get_all_peers(hdd_adapter_t *pAdapter, char *buf, int buflen) hddTdlsPeer_t *curr_peer; tdlsCtx_t *pHddTdlsCtx; hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); + hdd_station_ctx_t *hdd_sta_ctx; ENTER(); if (0 != (wlan_hdd_validate_context(pHddCtx))) return 0; + if ((WLAN_HDD_INFRA_STATION != pAdapter->device_mode) + && (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode)) { + len = scnprintf(buf, buflen, "\nNo TDLS support for this adapter"); + return len; + } + + hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); + if (eConnectionState_Associated != hdd_sta_ctx->conn_info.connState) { + len = scnprintf(buf, buflen, "\nSTA is not associated\n"); + return len; + } + init_len = buflen; len = scnprintf(buf, buflen, "\n%-18s%-3s%-4s%-3s%-5s\n", "MAC", "Id", "cap", "up", "RSSI"); -- cgit v1.2.3