diff options
| -rw-r--r-- | core/hdd/src/wlan_hdd_tdls.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index 7c7a8a70a9e2..786b6723187f 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -3877,6 +3877,7 @@ int wlan_hdd_tdls_add_station(struct wiphy *wiphy, unsigned long rc; int ret; int rate_idx; + hdd_station_ctx_t *hdd_sta_ctx; ENTER(); @@ -3895,6 +3896,26 @@ int wlan_hdd_tdls_add_station(struct wiphy *wiphy, return -ENOTSUPP; } + hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); + + /* + * STA or P2P client should be connected and authenticated before + * adding TDLS STA. + */ + if ((eConnectionState_Associated != + hdd_sta_ctx->conn_info.connState) || + (false == hdd_sta_ctx->conn_info.uIsAuthenticated)) { + hdd_debug("STA is not connected or not authenticated. connState %u, uIsAuthenticated %u", + hdd_sta_ctx->conn_info.connState, + hdd_sta_ctx->conn_info.uIsAuthenticated); + return -EAGAIN; + } + + if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { + hdd_debug("TDLS not allowed, reject TDLS add station"); + return -EPERM; + } + mutex_lock(&pHddCtx->tdls_lock); pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
