summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilson Yang <c_yangw@qca.qualcomm.com>2013-10-01 20:11:19 -0700
committerMadan Mohan Koyyalamudi <mkoyyala@qca.qualcomm.com>2013-11-14 20:12:08 -0800
commite32cfb93fbc2fc5d97a339cd7b54467b8730d8f2 (patch)
treefceea33493bed3100ea16c3bbf707229d732c224
parentd8d5563b3ae488f7a875134517bea8ed4dca89e0 (diff)
cld: Cached PMK ID still included after forget AP
Implement _del_pmksa/_flush_pmksa in wlan_hdd_cfg80211.c to support deleting PMKID from the cache when forgetting the AP from GUI Change-Id: I06bbc7ed5396ee1cf8dc22a0b8f484efe4a59300 CRs-Fixed: 553806
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c173
1 files changed, 155 insertions, 18 deletions
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 551e19539a88..f07032cef71e 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -6921,12 +6921,15 @@ static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy,
#ifdef FEATURE_WLAN_LFR
+#define MAX_PMKSAIDS_IN_CACHE 8
+
+static tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; // HDD local cache
+static tANI_U32 PMKIDCacheIndex; // HDD local Cache index
+
+
static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_pmksa *pmksa)
{
-#define MAX_PMKSAIDS_IN_CACHE 8
- static tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; // HDD Local cache
- static tANI_U32 i; // HDD Local Cache index
tANI_U32 j=0;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
tHalHandle halHandle;
@@ -6959,7 +6962,7 @@ static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *d
// Retrieve halHandle
halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
- for (j = 0; j < i; j++)
+ for (j = 0; j < PMKIDCacheIndex; j++)
{
if(vos_mem_compare(PMKIDCache[j].BSSID,
pmksa->bssid, WNI_CFG_BSSID_LEN))
@@ -6980,23 +6983,23 @@ static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *d
}
/* Check we compared all entries,if then take the first slot now */
- if(j == MAX_PMKSAIDS_IN_CACHE) i=0;
+ if(j == MAX_PMKSAIDS_IN_CACHE) PMKIDCacheIndex=0;
if (!BSSIDMatched)
{
// Now, we DON'T have a BSSID match, so take a new entry in the cache.
- vos_mem_copy(PMKIDCache[i].BSSID,
+ vos_mem_copy(PMKIDCache[PMKIDCacheIndex].BSSID,
pmksa->bssid, ETHER_ADDR_LEN);
- vos_mem_copy(PMKIDCache[i].PMKID,
+ vos_mem_copy(PMKIDCache[PMKIDCacheIndex].PMKID,
pmksa->pmkid,
CSR_RSN_PMKID_SIZE);
hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Adding a new cache entry %d.",
- __func__, i );
+ __func__, PMKIDCacheIndex );
dump_bssid(pmksa->bssid);
dump_pmkid(halHandle, pmksa->pmkid);
// Increment the HDD Local Cache index
// The "i=0" doesn't work for the call to sme_RoamSetPMKIDCache() - LFR FIXME
- if (i<=(MAX_PMKSAIDS_IN_CACHE-1)) i++; else i=0;
+ if (PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) PMKIDCacheIndex++; else PMKIDCacheIndex = 0;
}
@@ -7004,28 +7007,162 @@ static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *d
//hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with %d cache entries."),
// __func__, i );
hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.",
- __func__, i );
+ __func__, PMKIDCacheIndex );
// Finally set the PMKSA ID Cache in CSR
result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId,
PMKIDCache,
- i );
+ PMKIDCacheIndex);
return 0;
}
+
static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
- struct cfg80211_pmksa *pmksa)
+ struct cfg80211_pmksa *pmksa)
{
- ENTER();
- // TODO: Implement this later.
- return 0;
+ tANI_U32 j=0;
+ hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+ tHalHandle halHandle;
+ tANI_U8 BSSIDMatched = 0;
+ tANI_U8 *pBSSId;
+ hdd_context_t *pHddCtx;
+ int result = 0;
+
+ hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA with PMKSA_ID %d .",
+ __func__,pmksa->pmkid);
+
+ /* Validate pAdapter */
+ if (NULL == pAdapter)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__);
+ return -EINVAL;
+ }
+
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+ /*Retrieve halHandle*/
+ halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+ /*in case index is 0,no entry to delete*/
+ if (0 == PMKIDCacheIndex)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid entry to delete" ,
+ __func__);
+ return -EINVAL;
+ }
+
+ /*find the matching PMKSA entry from j=0 to (index-1),
+ * and delete the matched one
+ */
+ for (j = 0; j<PMKIDCacheIndex; j++)
+ {
+ if (vos_mem_compare(PMKIDCache[j].BSSID,
+ pmksa->bssid,
+ WNI_CFG_BSSID_LEN))
+ {
+ /* BSSID matched entry */
+ BSSIDMatched = 1;
+
+ if (j<PMKIDCacheIndex-1)
+ {
+ /*replace the matching entry with the last entry in HDD local cache*/
+ vos_mem_copy(PMKIDCache[j].BSSID,
+ PMKIDCache[PMKIDCacheIndex-1].BSSID,
+ WNI_CFG_BSSID_LEN);
+ vos_mem_copy(PMKIDCache[j].PMKID,
+ PMKIDCache[PMKIDCacheIndex-1].PMKID,
+ CSR_RSN_PMKID_SIZE);
+ }
+
+ /*clear the last entry in HDD cache ---[index-1]*/
+ pBSSId =(tANI_U8 *)(PMKIDCache[PMKIDCacheIndex-1].BSSID);
+ vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].BSSID, WNI_CFG_BSSID_LEN);
+ vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].PMKID, CSR_RSN_PMKID_SIZE);
+
+ /*reduce the PMKID array index*/
+ PMKIDCacheIndex--;
+
+ /*delete the last PMKID cache in CSR*/
+ result = sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pBSSId);
+ if (0 != result)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cannot delete PMKSA %d CONTENT.",
+ __func__,PMKIDCacheIndex);
+ }
+
+ dump_bssid(pmksa->bssid);
+ dump_pmkid(halHandle,pmksa->pmkid);
+
+ break;
+ }
+ }
+
+ /* we compare all entries,but cannot find matching entry */
+ if (j == MAX_PMKSAIDS_IN_CACHE && !BSSIDMatched)
+ {
+ hddLog(VOS_TRACE_LEVEL_FATAL, "%s: No such PMKSA entry existed %d.",
+ __func__,pmksa->bssid);
+ dump_bssid(pmksa->bssid);
+ dump_pmkid(halHandle, pmksa->pmkid);
+ return -EINVAL;
+ }
+ return result;
}
+
+
static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev)
{
- ENTER();
- // TODO: Implement this later.
- return 0;
+ tANI_U32 j=0;
+ hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+ tHalHandle halHandle;
+ hdd_context_t *pHddCtx;
+ tANI_U8 *pBSSId;
+ int result;
+
+ hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__);
+
+ /* Validate pAdapter */
+ if (NULL == pAdapter)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ "%s: Invalid Adapter" ,__func__);
+ return -EINVAL;
+ }
+
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+ /*Retrieve halHandle*/
+ halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter);
+
+ /*in case index is 0,no entry to delete*/
+ if (0 == PMKIDCacheIndex)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid entry to delete" ,
+ __func__);
+ return -EINVAL;
+ }
+
+ /*delete all the PMKSA one by one */
+ for (j = 0; j<PMKIDCacheIndex; j++)
+ {
+ /*clear the entry in HDD cache 0--index-1 */
+ pBSSId =(tANI_U8 *)(PMKIDCache[j].BSSID);
+ vos_mem_zero(PMKIDCache[j].BSSID, WNI_CFG_BSSID_LEN);
+ vos_mem_zero(PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE);
+
+ /*delete the PMKID in CSR*/
+ result = sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pBSSId);
+
+ if (0!= result)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR ,"%s cannot flush PMKIDCache %d.",
+ __func__,j);
+ }
+ }
+
+ PMKIDCacheIndex = 0;
+ return result;
}
#endif