1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 ******************************************************************************/
16 #define _MLME_OSDEP_C_
18 #include <osdep_service.h>
19 #include <drv_types.h>
20 #include <mlme_osdep.h>
21 #include <rtw_ioctl_set.h>
23 static struct rt_pmkid_list backupPMKIDList[NUM_PMKID_CACHE];
25 void rtw_reset_securitypriv23a(struct rtw_adapter *adapter)
27 u8 backupPMKIDIndex = 0;
28 u8 backupTKIPCountermeasure = 0x00;
29 unsigned long backupTKIPcountermeasure_time = 0;
31 if (adapter->securitypriv.dot11AuthAlgrthm ==
32 dot11AuthAlgrthm_8021X) { /* 802.1x */
33 /* We have to backup the PMK information for WiFi PMK
35 * Backup the btkip_countermeasure information.
36 * When the countermeasure is trigger, the driver have to
37 * disconnect with AP for 60 seconds.
39 memcpy(&backupPMKIDList[0], &adapter->securitypriv.PMKIDList[0],
40 sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
41 backupPMKIDIndex = adapter->securitypriv.PMKIDIndex;
42 backupTKIPCountermeasure = adapter->securitypriv.btkip_countermeasure;
43 backupTKIPcountermeasure_time = adapter->securitypriv.btkip_countermeasure_time;
45 memset((unsigned char *)&adapter->securitypriv, 0,
46 sizeof (struct security_priv));
47 /* Restore the PMK information to securitypriv structure
48 * for the following connection.
50 memcpy(&adapter->securitypriv.PMKIDList[0], &backupPMKIDList[0],
51 sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
52 adapter->securitypriv.PMKIDIndex = backupPMKIDIndex;
53 adapter->securitypriv.btkip_countermeasure = backupTKIPCountermeasure;
54 adapter->securitypriv.btkip_countermeasure_time = backupTKIPcountermeasure_time;
56 adapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
57 adapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;
58 } else { /* reset values in securitypriv */
59 struct security_priv *psec_priv = &adapter->securitypriv;
62 psec_priv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
63 psec_priv->dot11PrivacyAlgrthm = 0;
64 psec_priv->dot11PrivacyKeyIndex = 0;
66 psec_priv->dot118021XGrpPrivacy = 0;
67 psec_priv->dot118021XGrpKeyid = 1;
69 psec_priv->ndisauthtype = Ndis802_11AuthModeOpen;
70 psec_priv->ndisencryptstatus = Ndis802_11WEPDisabled;
74 void rtw_os_indicate_disconnect23a(struct rtw_adapter *adapter)
76 /* Do it first for tx broadcast pkt after disconnection issue! */
77 netif_carrier_off(adapter->pnetdev);
79 rtw_cfg80211_indicate_disconnect(adapter);
81 rtw_reset_securitypriv23a(adapter);