2 * wpa_supplicant - Internal driver interface wrappers
3 * Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "drivers/driver.h"
15 static inline void * wpa_drv_init(struct wpa_supplicant
*wpa_s
,
18 if (wpa_s
->driver
->init2
)
19 return wpa_s
->driver
->init2(wpa_s
, ifname
,
20 wpa_s
->global_drv_priv
);
21 if (wpa_s
->driver
->init
) {
22 return wpa_s
->driver
->init(wpa_s
, ifname
);
27 static inline void wpa_drv_deinit(struct wpa_supplicant
*wpa_s
)
29 if (wpa_s
->driver
->deinit
)
30 wpa_s
->driver
->deinit(wpa_s
->drv_priv
);
33 static inline int wpa_drv_set_param(struct wpa_supplicant
*wpa_s
,
36 if (wpa_s
->driver
->set_param
)
37 return wpa_s
->driver
->set_param(wpa_s
->drv_priv
, param
);
41 static inline int wpa_drv_set_countermeasures(struct wpa_supplicant
*wpa_s
,
44 if (wpa_s
->driver
->set_countermeasures
) {
45 return wpa_s
->driver
->set_countermeasures(wpa_s
->drv_priv
,
51 static inline int wpa_drv_authenticate(struct wpa_supplicant
*wpa_s
,
52 struct wpa_driver_auth_params
*params
)
54 if (wpa_s
->driver
->authenticate
)
55 return wpa_s
->driver
->authenticate(wpa_s
->drv_priv
, params
);
59 static inline int wpa_drv_associate(struct wpa_supplicant
*wpa_s
,
60 struct wpa_driver_associate_params
*params
)
62 if (wpa_s
->driver
->associate
) {
63 return wpa_s
->driver
->associate(wpa_s
->drv_priv
, params
);
68 static inline int wpa_drv_init_mesh(struct wpa_supplicant
*wpa_s
)
70 if (wpa_s
->driver
->init_mesh
)
71 return wpa_s
->driver
->init_mesh(wpa_s
->drv_priv
);
75 static inline int wpa_drv_join_mesh(struct wpa_supplicant
*wpa_s
,
76 struct wpa_driver_mesh_join_params
*params
)
78 if (wpa_s
->driver
->join_mesh
)
79 return wpa_s
->driver
->join_mesh(wpa_s
->drv_priv
, params
);
83 static inline int wpa_drv_leave_mesh(struct wpa_supplicant
*wpa_s
)
85 if (wpa_s
->driver
->leave_mesh
)
86 return wpa_s
->driver
->leave_mesh(wpa_s
->drv_priv
);
90 static inline int wpa_drv_mesh_link_probe(struct wpa_supplicant
*wpa_s
,
92 const u8
*eth
, size_t len
)
94 if (wpa_s
->driver
->probe_mesh_link
)
95 return wpa_s
->driver
->probe_mesh_link(wpa_s
->drv_priv
, addr
,
100 static inline int wpa_drv_scan(struct wpa_supplicant
*wpa_s
,
101 struct wpa_driver_scan_params
*params
)
103 #ifdef CONFIG_TESTING_OPTIONS
104 if (wpa_s
->test_failure
== WPAS_TEST_FAILURE_SCAN_TRIGGER
)
106 #endif /* CONFIG_TESTING_OPTIONS */
107 if (wpa_s
->driver
->scan2
)
108 return wpa_s
->driver
->scan2(wpa_s
->drv_priv
, params
);
112 static inline int wpa_drv_sched_scan(struct wpa_supplicant
*wpa_s
,
113 struct wpa_driver_scan_params
*params
)
115 if (wpa_s
->driver
->sched_scan
)
116 return wpa_s
->driver
->sched_scan(wpa_s
->drv_priv
, params
);
120 static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant
*wpa_s
)
122 if (wpa_s
->driver
->stop_sched_scan
)
123 return wpa_s
->driver
->stop_sched_scan(wpa_s
->drv_priv
);
127 struct wpa_scan_results
*
128 wpa_drv_get_scan_results2(struct wpa_supplicant
*wpa_s
);
130 static inline int wpa_drv_get_bssid(struct wpa_supplicant
*wpa_s
, u8
*bssid
)
132 if (wpa_s
->driver
->get_bssid
) {
133 return wpa_s
->driver
->get_bssid(wpa_s
->drv_priv
, bssid
);
138 static inline int wpa_drv_get_ssid(struct wpa_supplicant
*wpa_s
, u8
*ssid
)
140 if (wpa_s
->driver
->get_ssid
) {
141 return wpa_s
->driver
->get_ssid(wpa_s
->drv_priv
, ssid
);
146 static inline int wpa_drv_set_key(struct wpa_supplicant
*wpa_s
,
147 enum wpa_alg alg
, const u8
*addr
,
148 int key_idx
, int set_tx
,
149 const u8
*seq
, size_t seq_len
,
150 const u8
*key
, size_t key_len
,
151 enum key_flag key_flag
)
153 struct wpa_driver_set_key_params params
;
155 os_memset(¶ms
, 0, sizeof(params
));
156 params
.ifname
= wpa_s
->ifname
;
159 params
.key_idx
= key_idx
;
160 params
.set_tx
= set_tx
;
162 params
.seq_len
= seq_len
;
164 params
.key_len
= key_len
;
165 params
.key_flag
= key_flag
;
167 if (alg
!= WPA_ALG_NONE
) {
168 if (key_idx
>= 0 && key_idx
<= 6)
169 wpa_s
->keys_cleared
&= ~BIT(key_idx
);
171 wpa_s
->keys_cleared
= 0;
173 if (wpa_s
->driver
->set_key
) {
174 return wpa_s
->driver
->set_key(wpa_s
->drv_priv
, ¶ms
);
179 static inline int wpa_drv_get_seqnum(struct wpa_supplicant
*wpa_s
,
180 const u8
*addr
, int idx
, u8
*seq
)
182 if (wpa_s
->driver
->get_seqnum
)
183 return wpa_s
->driver
->get_seqnum(wpa_s
->ifname
, wpa_s
->drv_priv
,
188 static inline int wpa_drv_sta_deauth(struct wpa_supplicant
*wpa_s
,
189 const u8
*addr
, u16 reason_code
)
191 if (wpa_s
->driver
->sta_deauth
) {
192 return wpa_s
->driver
->sta_deauth(wpa_s
->drv_priv
,
193 wpa_s
->own_addr
, addr
,
199 static inline int wpa_drv_deauthenticate(struct wpa_supplicant
*wpa_s
,
200 const u8
*addr
, u16 reason_code
)
202 if (wpa_s
->driver
->deauthenticate
) {
203 return wpa_s
->driver
->deauthenticate(wpa_s
->drv_priv
, addr
,
209 static inline int wpa_drv_add_pmkid(struct wpa_supplicant
*wpa_s
,
210 struct wpa_pmkid_params
*params
)
212 if (wpa_s
->driver
->add_pmkid
) {
213 return wpa_s
->driver
->add_pmkid(wpa_s
->drv_priv
, params
);
218 static inline int wpa_drv_remove_pmkid(struct wpa_supplicant
*wpa_s
,
219 struct wpa_pmkid_params
*params
)
221 if (wpa_s
->driver
->remove_pmkid
) {
222 return wpa_s
->driver
->remove_pmkid(wpa_s
->drv_priv
, params
);
227 static inline int wpa_drv_flush_pmkid(struct wpa_supplicant
*wpa_s
)
229 if (wpa_s
->driver
->flush_pmkid
) {
230 return wpa_s
->driver
->flush_pmkid(wpa_s
->drv_priv
);
235 static inline int wpa_drv_get_capa(struct wpa_supplicant
*wpa_s
,
236 struct wpa_driver_capa
*capa
)
238 if (wpa_s
->driver
->get_capa
) {
239 return wpa_s
->driver
->get_capa(wpa_s
->drv_priv
, capa
);
244 static inline void wpa_drv_poll(struct wpa_supplicant
*wpa_s
)
246 if (wpa_s
->driver
->poll
) {
247 wpa_s
->driver
->poll(wpa_s
->drv_priv
);
251 static inline const char * wpa_drv_get_ifname(struct wpa_supplicant
*wpa_s
)
253 if (wpa_s
->driver
->get_ifname
) {
254 return wpa_s
->driver
->get_ifname(wpa_s
->drv_priv
);
259 static inline const char *
260 wpa_driver_get_radio_name(struct wpa_supplicant
*wpa_s
)
262 if (wpa_s
->driver
->get_radio_name
)
263 return wpa_s
->driver
->get_radio_name(wpa_s
->drv_priv
);
267 static inline const u8
* wpa_drv_get_mac_addr(struct wpa_supplicant
*wpa_s
)
269 if (wpa_s
->driver
->get_mac_addr
) {
270 return wpa_s
->driver
->get_mac_addr(wpa_s
->drv_priv
);
275 static inline int wpa_drv_set_operstate(struct wpa_supplicant
*wpa_s
,
278 if (wpa_s
->driver
->set_operstate
)
279 return wpa_s
->driver
->set_operstate(wpa_s
->drv_priv
, state
);
283 static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant
*wpa_s
,
284 const u8
*addr
, int protect_type
,
287 if (wpa_s
->driver
->mlme_setprotection
)
288 return wpa_s
->driver
->mlme_setprotection(wpa_s
->drv_priv
, addr
,
294 static inline struct hostapd_hw_modes
*
295 wpa_drv_get_hw_feature_data(struct wpa_supplicant
*wpa_s
, u16
*num_modes
,
296 u16
*flags
, u8
*dfs_domain
)
298 if (wpa_s
->driver
->get_hw_feature_data
)
299 return wpa_s
->driver
->get_hw_feature_data(wpa_s
->drv_priv
,
305 static inline int wpa_drv_set_country(struct wpa_supplicant
*wpa_s
,
308 if (wpa_s
->driver
->set_country
)
309 return wpa_s
->driver
->set_country(wpa_s
->drv_priv
, alpha2
);
313 static inline int wpa_drv_send_mlme(struct wpa_supplicant
*wpa_s
,
314 const u8
*data
, size_t data_len
, int noack
,
317 if (wpa_s
->driver
->send_mlme
)
318 return wpa_s
->driver
->send_mlme(wpa_s
->drv_priv
,
319 data
, data_len
, noack
,
324 static inline int wpa_drv_update_ft_ies(struct wpa_supplicant
*wpa_s
,
326 const u8
*ies
, size_t ies_len
)
328 if (wpa_s
->driver
->update_ft_ies
)
329 return wpa_s
->driver
->update_ft_ies(wpa_s
->drv_priv
, md
,
334 static inline int wpa_drv_set_ap(struct wpa_supplicant
*wpa_s
,
335 struct wpa_driver_ap_params
*params
)
337 if (wpa_s
->driver
->set_ap
)
338 return wpa_s
->driver
->set_ap(wpa_s
->drv_priv
, params
);
342 static inline int wpa_drv_sta_add(struct wpa_supplicant
*wpa_s
,
343 struct hostapd_sta_add_params
*params
)
345 if (wpa_s
->driver
->sta_add
)
346 return wpa_s
->driver
->sta_add(wpa_s
->drv_priv
, params
);
350 static inline int wpa_drv_sta_remove(struct wpa_supplicant
*wpa_s
,
353 if (wpa_s
->driver
->sta_remove
)
354 return wpa_s
->driver
->sta_remove(wpa_s
->drv_priv
, addr
);
358 static inline int wpa_drv_tx_control_port(struct wpa_supplicant
*wpa_s
,
359 const u8
*dest
, u16 proto
,
360 const u8
*buf
, size_t len
,
363 if (!wpa_s
->driver
->tx_control_port
)
365 return wpa_s
->driver
->tx_control_port(wpa_s
->drv_priv
, dest
, proto
,
366 buf
, len
, no_encrypt
);
369 static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant
*wpa_s
,
370 const u8
*addr
, const u8
*data
,
371 size_t data_len
, int encrypt
,
372 const u8
*own_addr
, u32 flags
)
374 if (wpa_s
->driver
->hapd_send_eapol
)
375 return wpa_s
->driver
->hapd_send_eapol(wpa_s
->drv_priv
, addr
,
376 data
, data_len
, encrypt
,
381 static inline int wpa_drv_sta_set_flags(struct wpa_supplicant
*wpa_s
,
382 const u8
*addr
, int total_flags
,
383 int flags_or
, int flags_and
)
385 if (wpa_s
->driver
->sta_set_flags
)
386 return wpa_s
->driver
->sta_set_flags(wpa_s
->drv_priv
, addr
,
387 total_flags
, flags_or
,
392 static inline int wpa_drv_set_supp_port(struct wpa_supplicant
*wpa_s
,
395 if (wpa_s
->driver
->set_supp_port
) {
396 return wpa_s
->driver
->set_supp_port(wpa_s
->drv_priv
,
402 static inline int wpa_drv_send_action(struct wpa_supplicant
*wpa_s
,
405 const u8
*dst
, const u8
*src
,
407 const u8
*data
, size_t data_len
,
410 if (wpa_s
->driver
->send_action
)
411 return wpa_s
->driver
->send_action(wpa_s
->drv_priv
, freq
,
412 wait
, dst
, src
, bssid
,
413 data
, data_len
, no_cck
);
417 static inline void wpa_drv_send_action_cancel_wait(struct wpa_supplicant
*wpa_s
)
419 if (wpa_s
->driver
->send_action_cancel_wait
)
420 wpa_s
->driver
->send_action_cancel_wait(wpa_s
->drv_priv
);
423 static inline int wpa_drv_set_freq(struct wpa_supplicant
*wpa_s
,
424 struct hostapd_freq_params
*freq
)
426 if (wpa_s
->driver
->set_freq
)
427 return wpa_s
->driver
->set_freq(wpa_s
->drv_priv
, freq
);
431 static inline int wpa_drv_if_add(struct wpa_supplicant
*wpa_s
,
432 enum wpa_driver_if_type type
,
433 const char *ifname
, const u8
*addr
,
434 void *bss_ctx
, char *force_ifname
,
435 u8
*if_addr
, const char *bridge
)
437 if (wpa_s
->driver
->if_add
)
438 return wpa_s
->driver
->if_add(wpa_s
->drv_priv
, type
, ifname
,
439 addr
, bss_ctx
, NULL
, force_ifname
,
440 if_addr
, bridge
, 0, 0);
444 static inline int wpa_drv_if_remove(struct wpa_supplicant
*wpa_s
,
445 enum wpa_driver_if_type type
,
448 if (wpa_s
->driver
->if_remove
)
449 return wpa_s
->driver
->if_remove(wpa_s
->drv_priv
, type
, ifname
);
453 static inline int wpa_drv_remain_on_channel(struct wpa_supplicant
*wpa_s
,
455 unsigned int duration
)
457 if (wpa_s
->driver
->remain_on_channel
)
458 return wpa_s
->driver
->remain_on_channel(wpa_s
->drv_priv
, freq
,
463 static inline int wpa_drv_cancel_remain_on_channel(
464 struct wpa_supplicant
*wpa_s
)
466 if (wpa_s
->driver
->cancel_remain_on_channel
)
467 return wpa_s
->driver
->cancel_remain_on_channel(
472 static inline int wpa_drv_probe_req_report(struct wpa_supplicant
*wpa_s
,
475 if (wpa_s
->driver
->probe_req_report
)
476 return wpa_s
->driver
->probe_req_report(wpa_s
->drv_priv
,
481 static inline int wpa_drv_deinit_ap(struct wpa_supplicant
*wpa_s
)
483 if (wpa_s
->driver
->deinit_ap
)
484 return wpa_s
->driver
->deinit_ap(wpa_s
->drv_priv
);
488 static inline int wpa_drv_deinit_p2p_cli(struct wpa_supplicant
*wpa_s
)
490 if (wpa_s
->driver
->deinit_p2p_cli
)
491 return wpa_s
->driver
->deinit_p2p_cli(wpa_s
->drv_priv
);
495 static inline void wpa_drv_suspend(struct wpa_supplicant
*wpa_s
)
497 if (wpa_s
->driver
->suspend
)
498 wpa_s
->driver
->suspend(wpa_s
->drv_priv
);
501 static inline void wpa_drv_resume(struct wpa_supplicant
*wpa_s
)
503 if (wpa_s
->driver
->resume
)
504 wpa_s
->driver
->resume(wpa_s
->drv_priv
);
507 static inline int wpa_drv_signal_monitor(struct wpa_supplicant
*wpa_s
,
508 int threshold
, int hysteresis
)
510 if (wpa_s
->driver
->signal_monitor
)
511 return wpa_s
->driver
->signal_monitor(wpa_s
->drv_priv
,
512 threshold
, hysteresis
);
516 int wpa_drv_signal_poll(struct wpa_supplicant
*wpa_s
,
517 struct wpa_signal_info
*si
);
519 static inline int wpa_drv_channel_info(struct wpa_supplicant
*wpa_s
,
520 struct wpa_channel_info
*ci
)
522 if (wpa_s
->driver
->channel_info
)
523 return wpa_s
->driver
->channel_info(wpa_s
->drv_priv
, ci
);
527 static inline int wpa_drv_pktcnt_poll(struct wpa_supplicant
*wpa_s
,
528 struct hostap_sta_driver_data
*sta
)
530 if (wpa_s
->driver
->read_sta_data
)
531 return wpa_s
->driver
->read_sta_data(wpa_s
->drv_priv
, sta
,
536 static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant
*wpa_s
,
537 const struct wpabuf
*beacon
,
538 const struct wpabuf
*proberesp
,
539 const struct wpabuf
*assocresp
)
541 if (!wpa_s
->driver
->set_ap_wps_ie
)
543 return wpa_s
->driver
->set_ap_wps_ie(wpa_s
->drv_priv
, beacon
,
544 proberesp
, assocresp
);
547 static inline int wpa_drv_get_noa(struct wpa_supplicant
*wpa_s
,
548 u8
*buf
, size_t buf_len
)
550 if (!wpa_s
->driver
->get_noa
)
552 return wpa_s
->driver
->get_noa(wpa_s
->drv_priv
, buf
, buf_len
);
555 static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant
*wpa_s
,
556 int legacy_ps
, int opp_ps
,
559 if (!wpa_s
->driver
->set_p2p_powersave
)
561 return wpa_s
->driver
->set_p2p_powersave(wpa_s
->drv_priv
, legacy_ps
,
565 static inline int wpa_drv_ampdu(struct wpa_supplicant
*wpa_s
, int ampdu
)
567 if (!wpa_s
->driver
->ampdu
)
569 return wpa_s
->driver
->ampdu(wpa_s
->drv_priv
, ampdu
);
572 static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant
*wpa_s
,
573 const u8
*dst
, u8 action_code
,
574 u8 dialog_token
, u16 status_code
,
575 u32 peer_capab
, int initiator
,
576 const u8
*buf
, size_t len
)
578 if (wpa_s
->driver
->send_tdls_mgmt
) {
579 return wpa_s
->driver
->send_tdls_mgmt(wpa_s
->drv_priv
, dst
,
580 action_code
, dialog_token
,
581 status_code
, peer_capab
,
582 initiator
, buf
, len
);
587 static inline int wpa_drv_tdls_oper(struct wpa_supplicant
*wpa_s
,
588 enum tdls_oper oper
, const u8
*peer
)
590 if (!wpa_s
->driver
->tdls_oper
)
592 return wpa_s
->driver
->tdls_oper(wpa_s
->drv_priv
, oper
, peer
);
596 static inline int wpa_drv_driver_cmd(struct wpa_supplicant
*wpa_s
,
597 char *cmd
, char *buf
, size_t buf_len
)
599 if (!wpa_s
->driver
->driver_cmd
)
601 return wpa_s
->driver
->driver_cmd(wpa_s
->drv_priv
, cmd
, buf
, buf_len
);
605 static inline void wpa_drv_set_rekey_info(struct wpa_supplicant
*wpa_s
,
606 const u8
*kek
, size_t kek_len
,
607 const u8
*kck
, size_t kck_len
,
608 const u8
*replay_ctr
)
610 if (!wpa_s
->driver
->set_rekey_info
)
612 wpa_s
->driver
->set_rekey_info(wpa_s
->drv_priv
, kek
, kek_len
,
613 kck
, kck_len
, replay_ctr
);
616 static inline int wpa_drv_radio_disable(struct wpa_supplicant
*wpa_s
,
619 if (!wpa_s
->driver
->radio_disable
)
621 return wpa_s
->driver
->radio_disable(wpa_s
->drv_priv
, disabled
);
624 static inline int wpa_drv_switch_channel(struct wpa_supplicant
*wpa_s
,
625 struct csa_settings
*settings
)
627 if (!wpa_s
->driver
->switch_channel
)
629 return wpa_s
->driver
->switch_channel(wpa_s
->drv_priv
, settings
);
632 static inline int wpa_drv_add_ts(struct wpa_supplicant
*wpa_s
, u8 tsid
,
633 const u8
*address
, u8 user_priority
,
636 if (!wpa_s
->driver
->add_tx_ts
)
638 return wpa_s
->driver
->add_tx_ts(wpa_s
->drv_priv
, tsid
, address
,
639 user_priority
, admitted_time
);
642 static inline int wpa_drv_del_ts(struct wpa_supplicant
*wpa_s
, u8 tid
,
645 if (!wpa_s
->driver
->del_tx_ts
)
647 return wpa_s
->driver
->del_tx_ts(wpa_s
->drv_priv
, tid
, address
);
650 static inline int wpa_drv_tdls_enable_channel_switch(
651 struct wpa_supplicant
*wpa_s
, const u8
*addr
, u8 oper_class
,
652 const struct hostapd_freq_params
*freq_params
)
654 if (!wpa_s
->driver
->tdls_enable_channel_switch
)
656 return wpa_s
->driver
->tdls_enable_channel_switch(wpa_s
->drv_priv
, addr
,
662 wpa_drv_tdls_disable_channel_switch(struct wpa_supplicant
*wpa_s
,
665 if (!wpa_s
->driver
->tdls_disable_channel_switch
)
667 return wpa_s
->driver
->tdls_disable_channel_switch(wpa_s
->drv_priv
,
671 static inline int wpa_drv_wnm_oper(struct wpa_supplicant
*wpa_s
,
672 enum wnm_oper oper
, const u8
*peer
,
673 u8
*buf
, u16
*buf_len
)
675 if (!wpa_s
->driver
->wnm_oper
)
677 return wpa_s
->driver
->wnm_oper(wpa_s
->drv_priv
, oper
, peer
, buf
,
681 static inline int wpa_drv_status(struct wpa_supplicant
*wpa_s
,
682 char *buf
, size_t buflen
)
684 if (!wpa_s
->driver
->status
)
686 return wpa_s
->driver
->status(wpa_s
->drv_priv
, buf
, buflen
);
689 static inline int wpa_drv_set_qos_map(struct wpa_supplicant
*wpa_s
,
690 const u8
*qos_map_set
, u8 qos_map_set_len
)
692 if (!wpa_s
->driver
->set_qos_map
)
694 return wpa_s
->driver
->set_qos_map(wpa_s
->drv_priv
, qos_map_set
,
698 static inline int wpa_drv_get_wowlan(struct wpa_supplicant
*wpa_s
)
700 if (!wpa_s
->driver
->get_wowlan
)
702 return wpa_s
->driver
->get_wowlan(wpa_s
->drv_priv
);
705 static inline int wpa_drv_wowlan(struct wpa_supplicant
*wpa_s
,
706 const struct wowlan_triggers
*triggers
)
708 if (!wpa_s
->driver
->set_wowlan
)
710 return wpa_s
->driver
->set_wowlan(wpa_s
->drv_priv
, triggers
);
713 static inline int wpa_drv_vendor_cmd(struct wpa_supplicant
*wpa_s
,
714 int vendor_id
, int subcmd
, const u8
*data
,
715 size_t data_len
, struct wpabuf
*buf
)
717 if (!wpa_s
->driver
->vendor_cmd
)
719 return wpa_s
->driver
->vendor_cmd(wpa_s
->drv_priv
, vendor_id
, subcmd
,
720 data
, data_len
, buf
);
723 static inline int wpa_drv_roaming(struct wpa_supplicant
*wpa_s
, int allowed
,
726 if (!wpa_s
->driver
->roaming
)
728 return wpa_s
->driver
->roaming(wpa_s
->drv_priv
, allowed
, bssid
);
731 static inline int wpa_drv_disable_fils(struct wpa_supplicant
*wpa_s
,
734 if (!wpa_s
->driver
->disable_fils
)
736 return wpa_s
->driver
->disable_fils(wpa_s
->drv_priv
, disable
);
739 static inline int wpa_drv_set_mac_addr(struct wpa_supplicant
*wpa_s
,
742 if (!wpa_s
->driver
->set_mac_addr
)
744 return wpa_s
->driver
->set_mac_addr(wpa_s
->drv_priv
, addr
);
750 static inline int wpa_drv_macsec_init(struct wpa_supplicant
*wpa_s
,
751 struct macsec_init_params
*params
)
753 if (!wpa_s
->driver
->macsec_init
)
755 return wpa_s
->driver
->macsec_init(wpa_s
->drv_priv
, params
);
758 static inline int wpa_drv_macsec_deinit(struct wpa_supplicant
*wpa_s
)
760 if (!wpa_s
->driver
->macsec_deinit
)
762 return wpa_s
->driver
->macsec_deinit(wpa_s
->drv_priv
);
765 static inline int wpa_drv_macsec_get_capability(struct wpa_supplicant
*wpa_s
,
766 enum macsec_cap
*cap
)
768 if (!wpa_s
->driver
->macsec_get_capability
)
770 return wpa_s
->driver
->macsec_get_capability(wpa_s
->drv_priv
, cap
);
773 static inline int wpa_drv_enable_protect_frames(struct wpa_supplicant
*wpa_s
,
776 if (!wpa_s
->driver
->enable_protect_frames
)
778 return wpa_s
->driver
->enable_protect_frames(wpa_s
->drv_priv
, enabled
);
781 static inline int wpa_drv_enable_encrypt(struct wpa_supplicant
*wpa_s
,
784 if (!wpa_s
->driver
->enable_encrypt
)
786 return wpa_s
->driver
->enable_encrypt(wpa_s
->drv_priv
, enabled
);
789 static inline int wpa_drv_set_replay_protect(struct wpa_supplicant
*wpa_s
,
790 Boolean enabled
, u32 window
)
792 if (!wpa_s
->driver
->set_replay_protect
)
794 return wpa_s
->driver
->set_replay_protect(wpa_s
->drv_priv
, enabled
,
798 static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant
*wpa_s
,
801 if (!wpa_s
->driver
->set_current_cipher_suite
)
803 return wpa_s
->driver
->set_current_cipher_suite(wpa_s
->drv_priv
, cs
);
806 static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant
*wpa_s
,
809 if (!wpa_s
->driver
->enable_controlled_port
)
811 return wpa_s
->driver
->enable_controlled_port(wpa_s
->drv_priv
, enabled
);
814 static inline int wpa_drv_get_receive_lowest_pn(struct wpa_supplicant
*wpa_s
,
815 struct receive_sa
*sa
)
817 if (!wpa_s
->driver
->get_receive_lowest_pn
)
819 return wpa_s
->driver
->get_receive_lowest_pn(wpa_s
->drv_priv
, sa
);
822 static inline int wpa_drv_get_transmit_next_pn(struct wpa_supplicant
*wpa_s
,
823 struct transmit_sa
*sa
)
825 if (!wpa_s
->driver
->get_transmit_next_pn
)
827 return wpa_s
->driver
->get_transmit_next_pn(wpa_s
->drv_priv
, sa
);
830 static inline int wpa_drv_set_transmit_next_pn(struct wpa_supplicant
*wpa_s
,
831 struct transmit_sa
*sa
)
833 if (!wpa_s
->driver
->set_transmit_next_pn
)
835 return wpa_s
->driver
->set_transmit_next_pn(wpa_s
->drv_priv
, sa
);
838 static inline int wpa_drv_set_receive_lowest_pn(struct wpa_supplicant
*wpa_s
,
839 struct receive_sa
*sa
)
841 if (!wpa_s
->driver
->set_receive_lowest_pn
)
843 return wpa_s
->driver
->set_receive_lowest_pn(wpa_s
->drv_priv
, sa
);
847 wpa_drv_create_receive_sc(struct wpa_supplicant
*wpa_s
, struct receive_sc
*sc
,
848 unsigned int conf_offset
, int validation
)
850 if (!wpa_s
->driver
->create_receive_sc
)
852 return wpa_s
->driver
->create_receive_sc(wpa_s
->drv_priv
, sc
,
853 conf_offset
, validation
);
856 static inline int wpa_drv_delete_receive_sc(struct wpa_supplicant
*wpa_s
,
857 struct receive_sc
*sc
)
859 if (!wpa_s
->driver
->delete_receive_sc
)
861 return wpa_s
->driver
->delete_receive_sc(wpa_s
->drv_priv
, sc
);
864 static inline int wpa_drv_create_receive_sa(struct wpa_supplicant
*wpa_s
,
865 struct receive_sa
*sa
)
867 if (!wpa_s
->driver
->create_receive_sa
)
869 return wpa_s
->driver
->create_receive_sa(wpa_s
->drv_priv
, sa
);
872 static inline int wpa_drv_delete_receive_sa(struct wpa_supplicant
*wpa_s
,
873 struct receive_sa
*sa
)
875 if (!wpa_s
->driver
->delete_receive_sa
)
877 return wpa_s
->driver
->delete_receive_sa(wpa_s
->drv_priv
, sa
);
880 static inline int wpa_drv_enable_receive_sa(struct wpa_supplicant
*wpa_s
,
881 struct receive_sa
*sa
)
883 if (!wpa_s
->driver
->enable_receive_sa
)
885 return wpa_s
->driver
->enable_receive_sa(wpa_s
->drv_priv
, sa
);
888 static inline int wpa_drv_disable_receive_sa(struct wpa_supplicant
*wpa_s
,
889 struct receive_sa
*sa
)
891 if (!wpa_s
->driver
->disable_receive_sa
)
893 return wpa_s
->driver
->disable_receive_sa(wpa_s
->drv_priv
, sa
);
897 wpa_drv_create_transmit_sc(struct wpa_supplicant
*wpa_s
, struct transmit_sc
*sc
,
898 unsigned int conf_offset
)
900 if (!wpa_s
->driver
->create_transmit_sc
)
902 return wpa_s
->driver
->create_transmit_sc(wpa_s
->drv_priv
, sc
,
906 static inline int wpa_drv_delete_transmit_sc(struct wpa_supplicant
*wpa_s
,
907 struct transmit_sc
*sc
)
909 if (!wpa_s
->driver
->delete_transmit_sc
)
911 return wpa_s
->driver
->delete_transmit_sc(wpa_s
->drv_priv
, sc
);
914 static inline int wpa_drv_create_transmit_sa(struct wpa_supplicant
*wpa_s
,
915 struct transmit_sa
*sa
)
917 if (!wpa_s
->driver
->create_transmit_sa
)
919 return wpa_s
->driver
->create_transmit_sa(wpa_s
->drv_priv
, sa
);
922 static inline int wpa_drv_delete_transmit_sa(struct wpa_supplicant
*wpa_s
,
923 struct transmit_sa
*sa
)
925 if (!wpa_s
->driver
->delete_transmit_sa
)
927 return wpa_s
->driver
->delete_transmit_sa(wpa_s
->drv_priv
, sa
);
930 static inline int wpa_drv_enable_transmit_sa(struct wpa_supplicant
*wpa_s
,
931 struct transmit_sa
*sa
)
933 if (!wpa_s
->driver
->enable_transmit_sa
)
935 return wpa_s
->driver
->enable_transmit_sa(wpa_s
->drv_priv
, sa
);
938 static inline int wpa_drv_disable_transmit_sa(struct wpa_supplicant
*wpa_s
,
939 struct transmit_sa
*sa
)
941 if (!wpa_s
->driver
->disable_transmit_sa
)
943 return wpa_s
->driver
->disable_transmit_sa(wpa_s
->drv_priv
, sa
);
945 #endif /* CONFIG_MACSEC */
947 static inline int wpa_drv_setband(struct wpa_supplicant
*wpa_s
,
950 if (!wpa_s
->driver
->set_band
)
952 return wpa_s
->driver
->set_band(wpa_s
->drv_priv
, band
);
955 static inline int wpa_drv_get_pref_freq_list(struct wpa_supplicant
*wpa_s
,
956 enum wpa_driver_if_type if_type
,
958 unsigned int *freq_list
)
960 #ifdef CONFIG_TESTING_OPTIONS
961 if (wpa_s
->get_pref_freq_list_override
)
962 return wpas_ctrl_iface_get_pref_freq_list_override(
963 wpa_s
, if_type
, num
, freq_list
);
964 #endif /* CONFIG_TESTING_OPTIONS */
965 if (!wpa_s
->driver
->get_pref_freq_list
)
967 return wpa_s
->driver
->get_pref_freq_list(wpa_s
->drv_priv
, if_type
,
971 static inline int wpa_drv_set_prob_oper_freq(struct wpa_supplicant
*wpa_s
,
974 if (!wpa_s
->driver
->set_prob_oper_freq
)
976 return wpa_s
->driver
->set_prob_oper_freq(wpa_s
->drv_priv
, freq
);
979 static inline int wpa_drv_abort_scan(struct wpa_supplicant
*wpa_s
,
982 if (!wpa_s
->driver
->abort_scan
)
984 return wpa_s
->driver
->abort_scan(wpa_s
->drv_priv
, scan_cookie
);
987 static inline int wpa_drv_configure_frame_filters(struct wpa_supplicant
*wpa_s
,
990 if (!wpa_s
->driver
->configure_data_frame_filters
)
992 return wpa_s
->driver
->configure_data_frame_filters(wpa_s
->drv_priv
,
996 static inline int wpa_drv_get_ext_capa(struct wpa_supplicant
*wpa_s
,
997 enum wpa_driver_if_type type
)
999 if (!wpa_s
->driver
->get_ext_capab
)
1001 return wpa_s
->driver
->get_ext_capab(wpa_s
->drv_priv
, type
,
1002 &wpa_s
->extended_capa
,
1003 &wpa_s
->extended_capa_mask
,
1004 &wpa_s
->extended_capa_len
);
1007 static inline int wpa_drv_p2p_lo_start(struct wpa_supplicant
*wpa_s
,
1008 unsigned int channel
,
1009 unsigned int period
,
1010 unsigned int interval
,
1012 const u8
*device_types
,
1013 size_t dev_types_len
,
1014 const u8
*ies
, size_t ies_len
)
1016 if (!wpa_s
->driver
->p2p_lo_start
)
1018 return wpa_s
->driver
->p2p_lo_start(wpa_s
->drv_priv
, channel
, period
,
1019 interval
, count
, device_types
,
1020 dev_types_len
, ies
, ies_len
);
1023 static inline int wpa_drv_p2p_lo_stop(struct wpa_supplicant
*wpa_s
)
1025 if (!wpa_s
->driver
->p2p_lo_stop
)
1027 return wpa_s
->driver
->p2p_lo_stop(wpa_s
->drv_priv
);
1030 static inline int wpa_drv_set_default_scan_ies(struct wpa_supplicant
*wpa_s
,
1031 const u8
*ies
, size_t len
)
1033 if (!wpa_s
->driver
->set_default_scan_ies
)
1035 return wpa_s
->driver
->set_default_scan_ies(wpa_s
->drv_priv
, ies
, len
);
1038 static inline int wpa_drv_set_tdls_mode(struct wpa_supplicant
*wpa_s
,
1039 int tdls_external_control
)
1041 if (!wpa_s
->driver
->set_tdls_mode
)
1043 return wpa_s
->driver
->set_tdls_mode(wpa_s
->drv_priv
,
1044 tdls_external_control
);
1047 static inline struct wpa_bss_candidate_info
*
1048 wpa_drv_get_bss_trans_status(struct wpa_supplicant
*wpa_s
,
1049 struct wpa_bss_trans_info
*params
)
1051 if (!wpa_s
->driver
->get_bss_transition_status
)
1053 return wpa_s
->driver
->get_bss_transition_status(wpa_s
->drv_priv
,
1057 static inline int wpa_drv_ignore_assoc_disallow(struct wpa_supplicant
*wpa_s
,
1060 if (!wpa_s
->driver
->ignore_assoc_disallow
)
1062 return wpa_s
->driver
->ignore_assoc_disallow(wpa_s
->drv_priv
, val
);
1065 static inline int wpa_drv_set_bssid_blacklist(struct wpa_supplicant
*wpa_s
,
1066 unsigned int num_bssid
,
1069 if (!wpa_s
->driver
->set_bssid_blacklist
)
1071 return wpa_s
->driver
->set_bssid_blacklist(wpa_s
->drv_priv
, num_bssid
,
1075 static inline int wpa_drv_update_connect_params(
1076 struct wpa_supplicant
*wpa_s
,
1077 struct wpa_driver_associate_params
*params
,
1078 enum wpa_drv_update_connect_params_mask mask
)
1080 if (!wpa_s
->driver
->update_connect_params
)
1082 return wpa_s
->driver
->update_connect_params(wpa_s
->drv_priv
, params
,
1087 wpa_drv_send_external_auth_status(struct wpa_supplicant
*wpa_s
,
1088 struct external_auth
*params
)
1090 if (!wpa_s
->driver
->send_external_auth_status
)
1092 return wpa_s
->driver
->send_external_auth_status(wpa_s
->drv_priv
,
1096 static inline int wpa_drv_set_4addr_mode(struct wpa_supplicant
*wpa_s
, int val
)
1098 if (!wpa_s
->driver
->set_4addr_mode
)
1100 return wpa_s
->driver
->set_4addr_mode(wpa_s
->drv_priv
,
1101 wpa_s
->bridge_ifname
, val
);
1104 #endif /* DRIVER_I_H */