This source file includes following definitions.
- sitesurvey_ctrl_handler
- join_timeout_handler
- _scan_timeout_handler
- dhcp_timeout_handler
- wdg_timeout_handler
- r8712_init_mlme_timer
- r8712_os_indicate_connect
- r8712_os_indicate_disconnect
- r8712_report_sec_ie
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #define _MLME_OSDEP_C_
18
19 #include "osdep_service.h"
20 #include "drv_types.h"
21 #include "mlme_osdep.h"
22
23 static void sitesurvey_ctrl_handler(struct timer_list *t)
24 {
25 struct _adapter *adapter =
26 from_timer(adapter, t,
27 mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer);
28
29 _r8712_sitesurvey_ctrl_handler(adapter);
30 mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
31 jiffies + msecs_to_jiffies(3000));
32 }
33
34 static void join_timeout_handler (struct timer_list *t)
35 {
36 struct _adapter *adapter =
37 from_timer(adapter, t, mlmepriv.assoc_timer);
38
39 _r8712_join_timeout_handler(adapter);
40 }
41
42 static void _scan_timeout_handler (struct timer_list *t)
43 {
44 struct _adapter *adapter =
45 from_timer(adapter, t, mlmepriv.scan_to_timer);
46
47 r8712_scan_timeout_handler(adapter);
48 }
49
50 static void dhcp_timeout_handler (struct timer_list *t)
51 {
52 struct _adapter *adapter =
53 from_timer(adapter, t, mlmepriv.dhcp_timer);
54
55 _r8712_dhcp_timeout_handler(adapter);
56 }
57
58 static void wdg_timeout_handler (struct timer_list *t)
59 {
60 struct _adapter *adapter =
61 from_timer(adapter, t, mlmepriv.wdg_timer);
62
63 r8712_wdg_wk_cmd(adapter);
64
65 mod_timer(&adapter->mlmepriv.wdg_timer,
66 jiffies + msecs_to_jiffies(2000));
67 }
68
69 void r8712_init_mlme_timer(struct _adapter *adapter)
70 {
71 struct mlme_priv *mlmepriv = &adapter->mlmepriv;
72
73 timer_setup(&mlmepriv->assoc_timer, join_timeout_handler, 0);
74 timer_setup(&mlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer,
75 sitesurvey_ctrl_handler, 0);
76 timer_setup(&mlmepriv->scan_to_timer, _scan_timeout_handler, 0);
77 timer_setup(&mlmepriv->dhcp_timer, dhcp_timeout_handler, 0);
78 timer_setup(&mlmepriv->wdg_timer, wdg_timeout_handler, 0);
79 }
80
81 void r8712_os_indicate_connect(struct _adapter *adapter)
82 {
83 r8712_indicate_wx_assoc_event(adapter);
84 netif_carrier_on(adapter->pnetdev);
85 }
86
87 static struct RT_PMKID_LIST backupPMKIDList[NUM_PMKID_CACHE];
88 void r8712_os_indicate_disconnect(struct _adapter *adapter)
89 {
90 u8 backupPMKIDIndex = 0;
91 u8 backupTKIPCountermeasure = 0x00;
92
93 r8712_indicate_wx_disassoc_event(adapter);
94 netif_carrier_off(adapter->pnetdev);
95 if (adapter->securitypriv.AuthAlgrthm == 2) {
96
97
98
99
100
101
102 memcpy(&backupPMKIDList[0],
103 &adapter->securitypriv.PMKIDList[0],
104 sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE);
105 backupPMKIDIndex = adapter->securitypriv.PMKIDIndex;
106 backupTKIPCountermeasure =
107 adapter->securitypriv.btkip_countermeasure;
108 memset((unsigned char *)&adapter->securitypriv, 0,
109 sizeof(struct security_priv));
110 timer_setup(&adapter->securitypriv.tkip_timer,
111 r8712_use_tkipkey_handler, 0);
112
113
114
115 memcpy(&adapter->securitypriv.PMKIDList[0],
116 &backupPMKIDList[0],
117 sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE);
118 adapter->securitypriv.PMKIDIndex = backupPMKIDIndex;
119 adapter->securitypriv.btkip_countermeasure =
120 backupTKIPCountermeasure;
121 } else {
122 struct security_priv *sec_priv = &adapter->securitypriv;
123
124 sec_priv->AuthAlgrthm = 0;
125 sec_priv->PrivacyAlgrthm = _NO_PRIVACY_;
126 sec_priv->PrivacyKeyIndex = 0;
127 sec_priv->XGrpPrivacy = _NO_PRIVACY_;
128 sec_priv->XGrpKeyid = 1;
129 sec_priv->ndisauthtype = Ndis802_11AuthModeOpen;
130 sec_priv->ndisencryptstatus = Ndis802_11WEPDisabled;
131 sec_priv->wps_phase = false;
132 }
133 }
134
135 void r8712_report_sec_ie(struct _adapter *adapter, u8 authmode, u8 *sec_ie)
136 {
137 uint len;
138 u8 *buff, *p, i;
139 union iwreq_data wrqu;
140
141 buff = NULL;
142 if (authmode == _WPA_IE_ID_) {
143 buff = kzalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
144 if (!buff)
145 return;
146 p = buff;
147 p += sprintf(p, "ASSOCINFO(ReqIEs=");
148 len = sec_ie[1] + 2;
149 len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX;
150 for (i = 0; i < len; i++)
151 p += sprintf(p, "%02x", sec_ie[i]);
152 p += sprintf(p, ")");
153 memset(&wrqu, 0, sizeof(wrqu));
154 wrqu.data.length = p - buff;
155 wrqu.data.length = (wrqu.data.length < IW_CUSTOM_MAX) ?
156 wrqu.data.length : IW_CUSTOM_MAX;
157 wireless_send_event(adapter->pnetdev, IWEVCUSTOM, &wrqu, buff);
158 kfree(buff);
159 }
160 }