1 /** @file hostsa_init.c
2 *
3 * @brief This file defines the initialize /free APIs for authenticator and supplicant.
4 *
5 * Copyright (C) 2014-2017, Marvell International Ltd.
6 *
7 * This software file (the "File") is distributed by Marvell International
8 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
9 * (the "License"). You may use, redistribute and/or modify this File in
10 * accordance with the terms and conditions of the License, a copy of which
11 * is available by writing to the Free Software Foundation, Inc.,
12 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
13 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14 *
15 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
18 * this warranty disclaimer.
19 */
20
21 /******************************************************
22 Change log:
23 03/07/2014: Initial version
24 ******************************************************/
25 #include "mlan.h"
26 #ifdef STA_SUPPORT
27 #include "mlan_join.h"
28 #endif
29 #include "mlan_ioctl.h"
30 #include "mlan_util.h"
31 #include "mlan_fw.h"
32 #include "mlan_main.h"
33 #include "mlan_init.h"
34 #include "mlan_wmm.h"
35 #include "hostsa_def.h"
36
37 #include "authenticator_api.h"
38
39 /*********************
40 Local Variables
41 *********************/
42
43 /*********************
44 Global Variables
45 *********************/
46
47 /*********************
48 Local Functions
49 *********************/
50
51 /*********************
52 Global Functions
53 *********************/
54
55 /*********************
56 Utility Handler
57 *********************/
58
59 /**
60 * @brief alloc mlan buffer
61 *
62 * @param pmlan_adapter A void pointer
63 * @param data_len request buffer len
64 * @param head_room head room len
65 * @param malloc_flag flag for mlan buffer
66
67 * @return pointer to mlan buffer
68 */
69 pmlan_buffer
hostsa_alloc_mlan_buffer(t_void * pmlan_adapter,t_u32 data_len,t_u32 head_room,t_u32 malloc_flag)70 hostsa_alloc_mlan_buffer(t_void *pmlan_adapter,
71 t_u32 data_len, t_u32 head_room, t_u32 malloc_flag)
72 {
73 mlan_adapter *pmadapter = (mlan_adapter *)pmlan_adapter;
74 pmlan_buffer newbuf = MNULL;
75
76 newbuf = wlan_alloc_mlan_buffer(pmadapter, data_len, head_room,
77 malloc_flag);
78
79 return newbuf;
80 }
81
82 /**
83 * @brief free mlan buffer
84 *
85 * @param pmlan_adapter A void pointer
86 * @param pmbuf a pointer to mlan buffer
87 *
88 * @return
89 */
90 void
hostsa_free_mlan_buffer(t_void * pmlan_adapter,mlan_buffer * pmbuf)91 hostsa_free_mlan_buffer(t_void *pmlan_adapter, mlan_buffer *pmbuf)
92 {
93 mlan_adapter *pmadapter = (mlan_adapter *)pmlan_adapter;
94
95 ENTER();
96
97 wlan_free_mlan_buffer(pmadapter, pmbuf);
98
99 LEAVE();
100 }
101
102 /**
103 * @brief send packet
104 *
105 * @param pmlan_private A void pointer
106 * @param pmbuf a pointer to mlan buffer
107 * @param frameLen paket len
108 *
109 * @return
110 */
111 void
hostsa_tx_packet(t_void * pmlan_private,pmlan_buffer pmbuf,t_u16 frameLen)112 hostsa_tx_packet(t_void *pmlan_private, pmlan_buffer pmbuf, t_u16 frameLen)
113 {
114 mlan_private *pmpriv = (mlan_private *)pmlan_private;
115 mlan_adapter *pmadapter = pmpriv->adapter;
116
117 ENTER();
118
119 pmbuf->bss_index = pmpriv->bss_index;
120 pmbuf->data_len = frameLen;
121
122 wlan_add_buf_bypass_txqueue(pmadapter, pmbuf);
123 wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL);
124
125 LEAVE();
126 }
127
128 /**
129 * @brief set key to fw
130 *
131 * @param pmlan_private A void pointer
132 * @param encrypt_key key structure
133 *
134 * @return
135 */
136 void
wlan_set_encrypt_key(t_void * pmlan_private,mlan_ds_encrypt_key * encrypt_key)137 wlan_set_encrypt_key(t_void *pmlan_private, mlan_ds_encrypt_key *encrypt_key)
138 {
139 mlan_private *priv = (mlan_private *)pmlan_private;
140 mlan_status ret = MLAN_STATUS_SUCCESS;
141
142 ENTER();
143
144 if (!encrypt_key->key_len) {
145 PRINTM(MCMND, "Skip set key with key_len = 0\n");
146 LEAVE();
147 return;
148 }
149
150 ret = wlan_prepare_cmd(priv,
151 HostCmd_CMD_802_11_KEY_MATERIAL,
152 HostCmd_ACT_GEN_SET,
153 KEY_INFO_ENABLED, MNULL, encrypt_key);
154
155 if (ret == MLAN_STATUS_SUCCESS)
156 wlan_recv_event(priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL);
157
158 LEAVE();
159
160 }
161
162 /**
163 * @brief clear key to fw
164 *
165 * @param pmlan_private A void pointer
166 *
167 * @return
168 */
169 void
wlan_clr_encrypt_key(t_void * pmlan_private)170 wlan_clr_encrypt_key(t_void *pmlan_private)
171 {
172 mlan_private *priv = (mlan_private *)pmlan_private;
173 mlan_status ret = MLAN_STATUS_SUCCESS;
174 mlan_ds_encrypt_key encrypt_key;
175
176 ENTER();
177
178 memset(priv->adapter, &encrypt_key, 0, sizeof(mlan_ds_encrypt_key));
179 encrypt_key.key_disable = MTRUE;
180 encrypt_key.key_flags = KEY_FLAG_REMOVE_KEY;
181
182 ret = wlan_prepare_cmd(priv,
183 HostCmd_CMD_802_11_KEY_MATERIAL,
184 HostCmd_ACT_GEN_SET,
185 KEY_INFO_ENABLED, MNULL, &encrypt_key);
186
187 if (ret == MLAN_STATUS_SUCCESS)
188 wlan_recv_event(priv, MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL);
189
190 LEAVE();
191
192 }
193
194 /**
195 * @brief send deauth frame
196 *
197 * @param pmlan_private A void pointer
198 * @param addr destination mac address
199 * @param reason deauth reason
200 *
201 * @return
202 */
203 void
hostsa_SendDeauth(t_void * pmlan_private,t_u8 * addr,t_u16 reason)204 hostsa_SendDeauth(t_void *pmlan_private, t_u8 *addr, t_u16 reason)
205 {
206 mlan_private *pmpriv = (mlan_private *)pmlan_private;
207 mlan_adapter *pmadapter = pmpriv->adapter;
208 mlan_status ret = MLAN_STATUS_SUCCESS;
209 mlan_deauth_param deauth;
210
211 ENTER();
212
213 memcpy(pmadapter, deauth.mac_addr, addr, MLAN_MAC_ADDR_LENGTH);
214 deauth.reason_code = reason;
215
216 ret = wlan_prepare_cmd(pmpriv,
217 HOST_CMD_APCMD_STA_DEAUTH,
218 HostCmd_ACT_GEN_SET,
219 0, MNULL, (t_void *)&deauth);
220 if (ret == MLAN_STATUS_SUCCESS)
221 wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
222 MNULL);
223
224 LEAVE();
225 }
226
227 /**
228 * @brief deauth all connected stations
229 *
230 * @param pmlan_private A void pointer
231 * @param reason deauth reason
232 *
233 * @return
234 */
235 void
ApDisAssocAllSta(void * pmlan_private,t_u16 reason)236 ApDisAssocAllSta(void *pmlan_private, t_u16 reason)
237 {
238 mlan_private *pmpriv = (mlan_private *)pmlan_private;
239 mlan_adapter *pmadapter = pmpriv->adapter;
240 sta_node *sta_ptr;
241
242 ENTER();
243
244 sta_ptr = (sta_node *)util_peek_list(pmadapter->pmoal_handle,
245 &pmpriv->sta_list,
246 pmadapter->callbacks.
247 moal_spin_lock,
248 pmadapter->callbacks.
249 moal_spin_unlock);
250
251 if (!sta_ptr) {
252 LEAVE();
253 return;
254 }
255
256 while (sta_ptr != (sta_node *)&pmpriv->sta_list) {
257 hostsa_SendDeauth((t_void *)pmpriv, sta_ptr->mac_addr, reason);
258 sta_ptr = sta_ptr->pnext;
259 }
260
261 LEAVE();
262 }
263
264 /**
265 * @brief get station entry
266 *
267 * @param pmlan_private A void pointer
268 * @param mac pointer to station mac address
269 * @param ppconPtr pointer to pointer to connection
270 *
271 * @return
272 */
273 void
Hostsa_get_station_entry(t_void * pmlan_private,t_u8 * mac,t_void ** ppconPtr)274 Hostsa_get_station_entry(t_void *pmlan_private, t_u8 *mac, t_void **ppconPtr)
275 {
276 mlan_private *priv = (mlan_private *)pmlan_private;
277 sta_node *sta_ptr = MNULL;
278
279 ENTER();
280
281 sta_ptr = wlan_get_station_entry(priv, mac);
282 if (sta_ptr)
283 *ppconPtr = sta_ptr->cm_connectioninfo;
284 else
285 *ppconPtr = MNULL;
286
287 LEAVE();
288 }
289
290 /**
291 * @brief find a connection
292 *
293 * @param pmlan_private A void pointer
294 * @param ppconPtr a pointer to pointer to connection
295 * @param ppsta_node a pointer to pointer to sta node
296 *
297 * @return
298 */
299 void
Hostsa_find_connection(t_void * pmlan_private,t_void ** ppconPtr,t_void ** ppsta_node)300 Hostsa_find_connection(t_void *pmlan_private, t_void **ppconPtr,
301 t_void **ppsta_node)
302 {
303 mlan_private *priv = (mlan_private *)pmlan_private;
304 sta_node *sta_ptr = MNULL;
305
306 ENTER();
307
308 sta_ptr = (sta_node *)util_peek_list(priv->adapter->pmoal_handle,
309 &priv->sta_list,
310 priv->adapter->callbacks.
311 moal_spin_lock,
312 priv->adapter->callbacks.
313 moal_spin_unlock);
314
315 if (!sta_ptr) {
316 LEAVE();
317 return;
318 }
319
320 *ppsta_node = (t_void *)sta_ptr;
321 *ppconPtr = sta_ptr->cm_connectioninfo;
322
323 LEAVE();
324 }
325
326 /**
327 * @brief find next connection
328 *
329 * @param pmlan_private A void pointer
330 * @param ppconPtr a pointer to pointer to connection
331 * @param ppsta_node a pointer to pointer to sta node
332 *
333 * @return
334 */
335 void
Hostsa_find_next_connection(t_void * pmlan_private,t_void ** ppconPtr,t_void ** ppsta_node)336 Hostsa_find_next_connection(t_void *pmlan_private, t_void **ppconPtr,
337 t_void **ppsta_node)
338 {
339 mlan_private *priv = (mlan_private *)pmlan_private;
340 sta_node *sta_ptr = (sta_node *)*ppsta_node;
341
342 ENTER();
343 if (sta_ptr != (sta_node *)&priv->sta_list)
344 sta_ptr = sta_ptr->pnext;
345
346 *ppsta_node = MNULL;
347 *ppconPtr = MNULL;
348 if ((sta_ptr != MNULL) && (sta_ptr != (sta_node *)&priv->sta_list)) {
349 *ppsta_node = (t_void *)sta_ptr;
350 *ppconPtr = sta_ptr->cm_connectioninfo;
351 }
352 LEAVE();
353 }
354
355 /**
356 * @brief set management ie for beacon or probe response
357 *
358 * @param pmlan_private A void pointer
359 * @param pbuf ie buf
360 * @param len ie len
361 * @param clearIE clear ie
362 *
363 * @return
364 */
365 void
Hostsa_set_mgmt_ie(t_void * pmlan_private,t_u8 * pbuf,t_u16 len,t_u8 clearIE)366 Hostsa_set_mgmt_ie(t_void *pmlan_private, t_u8 *pbuf, t_u16 len, t_u8 clearIE)
367 {
368 mlan_private *priv = (mlan_private *)pmlan_private;
369 mlan_adapter *pmadapter = priv->adapter;
370 mlan_ioctl_req *pioctl_req = MNULL;
371 mlan_ds_misc_cfg *pds_misc_cfg = MNULL;
372 custom_ie *pmgmt_ie = MNULL;
373 mlan_status ret = MLAN_STATUS_SUCCESS;
374
375 ENTER();
376
377 if (pmadapter == MNULL) {
378 LEAVE();
379 return;
380 }
381
382 /* allocate buffer for mlan_ioctl_req and mlan_ds_misc_cfg */
383 /* FYI - will be freed as part of cmd_response handler */
384 ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle,
385 sizeof(mlan_ioctl_req) +
386 sizeof(mlan_ds_misc_cfg),
387 MLAN_MEM_DEF,
388 (t_u8 **)&pioctl_req);
389 if ((ret != MLAN_STATUS_SUCCESS) || !pioctl_req) {
390 PRINTM(MERROR, "%s(): Could not allocate ioctl req\n",
391 __func__);
392 LEAVE();
393 return;
394 }
395 pds_misc_cfg = (mlan_ds_misc_cfg *)((t_u8 *)pioctl_req +
396 sizeof(mlan_ioctl_req));
397
398 /* prepare mlan_ioctl_req */
399 memset(pmadapter, pioctl_req, 0x00, sizeof(mlan_ioctl_req));
400 pioctl_req->req_id = MLAN_IOCTL_MISC_CFG;
401 pioctl_req->action = MLAN_ACT_SET;
402 pioctl_req->bss_index = priv->bss_index;
403 pioctl_req->pbuf = (t_u8 *)pds_misc_cfg;
404 pioctl_req->buf_len = sizeof(mlan_ds_misc_cfg);
405
406 /* prepare mlan_ds_misc_cfg */
407 memset(pmadapter, pds_misc_cfg, 0x00, sizeof(mlan_ds_misc_cfg));
408 pds_misc_cfg->sub_command = MLAN_OID_MISC_CUSTOM_IE;
409 pds_misc_cfg->param.cust_ie.type = TLV_TYPE_MGMT_IE;
410 pds_misc_cfg->param.cust_ie.len = (sizeof(custom_ie) - MAX_IE_SIZE);
411
412 /* configure custom_ie api settings */
413 pmgmt_ie = (custom_ie *)&pds_misc_cfg->param.cust_ie.ie_data_list[0];
414 pmgmt_ie->ie_index = 0xffff; /* Auto index */
415 pmgmt_ie->ie_length = len;
416 pmgmt_ie->mgmt_subtype_mask = MBIT(8) | MBIT(5); /* add IE for BEACON | PROBE_RSP */
417 if (clearIE)
418 pmgmt_ie->mgmt_subtype_mask = 0;
419 memcpy(pmadapter, pmgmt_ie->ie_buffer, pbuf, len);
420
421 pds_misc_cfg->param.cust_ie.len += pmgmt_ie->ie_length;
422
423 DBG_HEXDUMP(MCMD_D, "authenticator: RSN or WPA IE",
424 (t_u8 *)pmgmt_ie, pds_misc_cfg->param.cust_ie.len);
425
426 ret = wlan_misc_ioctl_custom_ie_list(pmadapter, pioctl_req, MFALSE);
427
428 if (ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING) {
429 PRINTM(MERROR,
430 "%s(): Could not set IE for priv=%p [priv_bss_idx=%d]!\n",
431 __func__, priv, priv->bss_index);
432 /* TODO: how to handle this error case?? ignore & continue? */
433 }
434 /* free ioctl buffer memory before we leave */
435 pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle,
436 (t_u8 *)pioctl_req);
437
438 }
439
440 t_void
StaControlledPortOpen(t_void * pmlan_private)441 StaControlledPortOpen(t_void *pmlan_private)
442 {
443 mlan_private *priv = (mlan_private *)pmlan_private;
444
445 PRINTM(MERROR, "StaControlledPortOpen\n");
446 if (priv->port_ctrl_mode == MTRUE) {
447 PRINTM(MINFO, "PORT_REL: port_status = OPEN\n");
448 priv->port_open = MTRUE;
449 }
450 priv->adapter->scan_block = MFALSE;
451 wlan_recv_event(priv, MLAN_EVENT_ID_FW_PORT_RELEASE, MNULL);
452 }
453
454 void
hostsa_StaSendDeauth(t_void * pmlan_private,t_u8 * addr,t_u16 reason)455 hostsa_StaSendDeauth(t_void *pmlan_private, t_u8 *addr, t_u16 reason)
456 {
457 mlan_private *pmpriv = (mlan_private *)pmlan_private;
458 mlan_adapter *pmadapter = pmpriv->adapter;
459 mlan_status ret = MLAN_STATUS_SUCCESS;
460 mlan_deauth_param deauth;
461
462 ENTER();
463
464 memcpy(pmadapter, deauth.mac_addr, addr, MLAN_MAC_ADDR_LENGTH);
465 deauth.reason_code = reason;
466
467 ret = wlan_prepare_cmd(pmpriv,
468 HostCmd_CMD_802_11_DEAUTHENTICATE,
469 HostCmd_ACT_GEN_SET,
470 0, MNULL, (t_void *)&deauth);
471 if (ret == MLAN_STATUS_SUCCESS)
472 wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DEFER_HANDLING,
473 MNULL);
474
475 LEAVE();
476 }
477
478 t_u8
Hostsa_get_bss_role(t_void * pmlan_private)479 Hostsa_get_bss_role(t_void *pmlan_private)
480 {
481 mlan_private *pmpriv = (mlan_private *)pmlan_private;
482
483 return GET_BSS_ROLE(pmpriv);
484 }
485
486 t_u8
Hostsa_get_intf_hr_len(t_void * pmlan_private)487 Hostsa_get_intf_hr_len(t_void *pmlan_private)
488 {
489 mlan_private *pmpriv = (mlan_private *)pmlan_private;
490
491 return pmpriv->intf_hr_len;
492 }
493
494 /**
495 * @brief send event to moal to notice that 4 way handshake complete
496 *
497 * @param pmlan_private A void pointer
498 * @param addr pointer to station mac address
499 *
500 * @return
501 */
502 t_void
Hostsa_sendEventRsnConnect(t_void * pmlan_private,t_u8 * addr)503 Hostsa_sendEventRsnConnect(t_void *pmlan_private, t_u8 *addr)
504 {
505 mlan_private *pmpriv = (mlan_private *)pmlan_private;
506 mlan_adapter *pmadapter = pmpriv->adapter;
507 t_u8 *event_buf = MNULL, *pos = MNULL;
508 t_u32 event_cause = 0;
509 mlan_event *pevent = MNULL;
510 mlan_status ret = MLAN_STATUS_SUCCESS;
511
512 ENTER();
513
514 ret = pmadapter->callbacks.moal_malloc(pmadapter->pmoal_handle,
515 MAX_EVENT_SIZE, MLAN_MEM_DEF,
516 &event_buf);
517 if ((ret != MLAN_STATUS_SUCCESS) || !event_buf) {
518 PRINTM(MERROR, "Could not allocate buffer for event buf\n");
519 goto done;
520 }
521 pevent = (pmlan_event)event_buf;
522 memset(pmadapter, event_buf, 0, MAX_EVENT_SIZE);
523
524 pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU;
525 pevent->bss_index = pmpriv->bss_index;
526 event_cause = wlan_cpu_to_le32(0x51); /*MICRO_AP_EV_ID_RSN_CONNECT */
527 memcpy(pmadapter, (t_u8 *)pevent->event_buf,
528 (t_u8 *)&event_cause, sizeof(event_cause));
529 pos = pevent->event_buf + sizeof(event_cause) + 2; /*reserved 2 byte */
530 memcpy(pmadapter, (t_u8 *)pos, addr, MLAN_MAC_ADDR_LENGTH);
531
532 pevent->event_len = MLAN_MAC_ADDR_LENGTH + sizeof(event_cause) + 2;
533 wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_PASSTHRU, event_buf);
534
535 done:
536 if (event_buf)
537 pmadapter->callbacks.moal_mfree(pmadapter->pmoal_handle,
538 event_buf);
539
540 LEAVE();
541 }
542
543 /**
544 * @brief This function initializes callbacks that hostsa interface uses.
545 *
546 * @param pmpriv A pointer to mlan_private structure
547 * @param putil_fns A pointer to hostsa_util_fns structure
548 * @param pmlan_fns A pointer to hostsa_mlan_fns structure
549 *
550 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
551 */
552 static t_void
hostsa_mlan_callbacks(IN pmlan_private pmpriv,IN hostsa_util_fns * putil_fns,IN hostsa_mlan_fns * pmlan_fns)553 hostsa_mlan_callbacks(IN pmlan_private pmpriv,
554 IN hostsa_util_fns *putil_fns,
555 IN hostsa_mlan_fns *pmlan_fns)
556 {
557 pmlan_adapter pmadapter = pmpriv->adapter;
558 pmlan_callbacks pcb = &pmadapter->callbacks;
559
560 putil_fns->pmoal_handle = pmadapter->pmoal_handle;
561 putil_fns->moal_malloc = pcb->moal_malloc;
562 putil_fns->moal_mfree = pcb->moal_mfree;
563 putil_fns->moal_memset = pcb->moal_memset;
564 putil_fns->moal_memcpy = pcb->moal_memcpy;
565 putil_fns->moal_memmove = pcb->moal_memmove;
566 putil_fns->moal_memcmp = pcb->moal_memcmp;
567 putil_fns->moal_udelay = pcb->moal_udelay;
568 putil_fns->moal_get_system_time = pcb->moal_get_system_time;
569 putil_fns->moal_init_timer = pcb->moal_init_timer;
570 putil_fns->moal_free_timer = pcb->moal_free_timer;
571 putil_fns->moal_start_timer = pcb->moal_start_timer;
572 putil_fns->moal_stop_timer = pcb->moal_stop_timer;
573 putil_fns->moal_init_lock = pcb->moal_init_lock;
574 putil_fns->moal_free_lock = pcb->moal_free_lock;
575 putil_fns->moal_spin_lock = pcb->moal_spin_lock;
576 putil_fns->moal_spin_unlock = pcb->moal_spin_unlock;
577 putil_fns->moal_print = pcb->moal_print;
578 putil_fns->moal_print_netintf = pcb->moal_print_netintf;
579
580 pmlan_fns->pmlan_private = pmpriv;
581 pmlan_fns->pmlan_adapter = pmpriv->adapter;
582 pmlan_fns->bss_index = pmpriv->bss_index;
583 pmlan_fns->bss_type = pmpriv->bss_type;
584 #if 0
585 pmlan_fns->mlan_add_buf_txqueue = mlan_add_buf_txqueue;
586 pmlan_fns->mlan_select_wmm_queue = mlan_select_wmm_queue;
587 pmlan_fns->mlan_write_data_complete = mlan_write_data_complete;
588 #endif
589 pmlan_fns->hostsa_alloc_mlan_buffer = hostsa_alloc_mlan_buffer;
590 pmlan_fns->hostsa_tx_packet = hostsa_tx_packet;
591 pmlan_fns->hostsa_set_encrypt_key = wlan_set_encrypt_key;
592 pmlan_fns->hostsa_clr_encrypt_key = wlan_clr_encrypt_key;
593 pmlan_fns->hostsa_SendDeauth = hostsa_SendDeauth;
594 pmlan_fns->Hostsa_DisAssocAllSta = ApDisAssocAllSta;
595 pmlan_fns->hostsa_free_mlan_buffer = hostsa_free_mlan_buffer;
596 pmlan_fns->Hostsa_get_station_entry = Hostsa_get_station_entry;
597 pmlan_fns->Hostsa_set_mgmt_ie = Hostsa_set_mgmt_ie;
598 pmlan_fns->Hostsa_find_connection = Hostsa_find_connection;
599 pmlan_fns->Hostsa_find_next_connection = Hostsa_find_next_connection;
600 pmlan_fns->Hostsa_StaControlledPortOpen = StaControlledPortOpen;
601 pmlan_fns->hostsa_StaSendDeauth = hostsa_StaSendDeauth;
602 pmlan_fns->Hostsa_get_bss_role = Hostsa_get_bss_role;
603 pmlan_fns->Hostsa_get_intf_hr_len = Hostsa_get_intf_hr_len;
604 pmlan_fns->Hostsa_sendEventRsnConnect = Hostsa_sendEventRsnConnect;
605 };
606
607 /**
608 * @brief Init hostsa data
609 *
610 * @param pmpriv A pointer to mlan_private structure
611 *
612 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
613 */
614 mlan_status
hostsa_init(pmlan_private pmpriv)615 hostsa_init(pmlan_private pmpriv)
616 {
617 hostsa_util_fns util_fns;
618 hostsa_mlan_fns mlan_fns;
619 mlan_status ret = MLAN_STATUS_SUCCESS;
620
621 ENTER();
622
623 hostsa_mlan_callbacks(pmpriv, &util_fns, &mlan_fns);
624 ret = supplicant_authenticator_init(&pmpriv->psapriv, &util_fns,
625 &mlan_fns, pmpriv->curr_addr);
626
627 LEAVE();
628 return ret;
629 }
630
631 /**
632 * @brief Cleanup hostsa data
633 *
634 * @param pmpriv A pointer to mlan_private structure
635 *
636 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
637 */
638 mlan_status
hostsa_cleanup(pmlan_private pmpriv)639 hostsa_cleanup(pmlan_private pmpriv)
640 {
641 mlan_status ret = MLAN_STATUS_SUCCESS;
642
643 ENTER();
644
645 supplicant_authenticator_free(pmpriv->psapriv);
646
647 LEAVE();
648 return ret;
649 }
650