wlan: Delete any associated STAs on AP/P2P GO teardown.
Delete any associated STAs entry and send deauth to each
associated STA on removing or tearing down AP/P2P GO.
Change-Id: I217c66b52ce186836fddba3e7cda4c1c0f7e9c9d
CRs-Fixed: 710966
diff --git a/CORE/HDD/inc/wlan_hdd_hostapd.h b/CORE/HDD/inc/wlan_hdd_hostapd.h
index 8d519f3..ca2889b 100644
--- a/CORE/HDD/inc/wlan_hdd_hostapd.h
+++ b/CORE/HDD/inc/wlan_hdd_hostapd.h
@@ -97,4 +97,5 @@
#ifdef FEATURE_WLAN_CH_AVOID
void hdd_hostapd_ch_avoid_cb(void *pAdapter, void *indParam);
#endif /* FEATURE_WLAN_CH_AVOID */
+int hdd_del_all_sta(hdd_adapter_t *pAdapter);
#endif // end #if !defined( WLAN_HDD_HOSTAPD_H )
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 03f8b41..d8351e2 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -6329,6 +6329,8 @@
VOS_ASSERT(pScanInfo->mScanPending);
}
+ /* Delete all associated STAs before stopping AP/P2P GO */
+ hdd_del_all_sta(pAdapter);
hdd_hostapd_stop(dev);
if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index f807119..807690c 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -9692,6 +9692,52 @@
/**---------------------------------------------------------------------------
+ \brief hdd_del_all_sta() - function
+
+ This function removes all the stations associated on stopping AP/P2P GO.
+
+ \param - pAdapter - Pointer to the HDD
+
+ \return - None
+
+ --------------------------------------------------------------------------*/
+
+int hdd_del_all_sta(hdd_adapter_t *pAdapter)
+{
+ v_U16_t i;
+ VOS_STATUS vos_status;
+
+ ENTER();
+
+ hddLog(VOS_TRACE_LEVEL_INFO,
+ "%s: Delete all STAs associated.",__func__);
+ if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
+ || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
+ )
+ {
+ for(i = 0; i < WLAN_MAX_STA_COUNT; i++)
+ {
+ if ((pAdapter->aStaInfo[i].isUsed) &&
+ (!pAdapter->aStaInfo[i].isDeauthInProgress))
+ {
+ u8 *macAddr = pAdapter->aStaInfo[i].macAddrSTA.bytes;
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ "%s: Delete STA with staid = %d and MAC::"
+ MAC_ADDRESS_STR,
+ __func__, i, MAC_ADDR_ARRAY(macAddr));
+ vos_status = hdd_softap_sta_deauth(pAdapter, macAddr);
+ if (VOS_IS_STATUS_SUCCESS(vos_status))
+ pAdapter->aStaInfo[i].isDeauthInProgress = TRUE;
+ }
+ }
+ }
+
+ EXIT();
+ return 0;
+}
+
+/**---------------------------------------------------------------------------
+
\brief hdd_softap_sta_disassoc() - function
This to take counter measure to handle deauth req from HDD