2009-03-26 19:37:05 +01:00
|
|
|
/*
|
|
|
|
* wpa_supplicant - Internal driver interface wrappers
|
2015-01-25 15:49:18 +01:00
|
|
|
* Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
|
2009-03-26 19:37:05 +01:00
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2009-03-26 19:37:05 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DRIVER_I_H
|
|
|
|
#define DRIVER_I_H
|
|
|
|
|
|
|
|
#include "drivers/driver.h"
|
|
|
|
|
|
|
|
/* driver_ops */
|
|
|
|
static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *ifname)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->init2)
|
2009-11-28 17:11:16 +01:00
|
|
|
return wpa_s->driver->init2(wpa_s, ifname,
|
|
|
|
wpa_s->global_drv_priv);
|
2009-03-26 19:37:05 +01:00
|
|
|
if (wpa_s->driver->init) {
|
|
|
|
return wpa_s->driver->init(wpa_s, ifname);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->deinit)
|
|
|
|
wpa_s->driver->deinit(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *param)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->set_param)
|
|
|
|
return wpa_s->driver->set_param(wpa_s->drv_priv, param);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
|
|
|
|
int enabled)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->set_countermeasures) {
|
|
|
|
return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
|
|
|
|
enabled);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_driver_auth_params *params)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->authenticate)
|
|
|
|
return wpa_s->driver->authenticate(wpa_s->drv_priv, params);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_driver_associate_params *params)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->associate) {
|
|
|
|
return wpa_s->driver->associate(wpa_s->drv_priv, params);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2014-09-01 06:23:23 +02:00
|
|
|
static inline int wpa_drv_init_mesh(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->init_mesh)
|
|
|
|
return wpa_s->driver->init_mesh(wpa_s->drv_priv);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_join_mesh(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_driver_mesh_join_params *params)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->join_mesh)
|
|
|
|
return wpa_s->driver->join_mesh(wpa_s->drv_priv, params);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_leave_mesh(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->leave_mesh)
|
|
|
|
return wpa_s->driver->leave_mesh(wpa_s->drv_priv);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-04-29 20:42:58 +02:00
|
|
|
static inline int wpa_drv_mesh_link_probe(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr,
|
|
|
|
const u8 *eth, size_t len)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->probe_mesh_link)
|
|
|
|
return wpa_s->driver->probe_mesh_link(wpa_s->drv_priv, addr,
|
|
|
|
eth, len);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-03-26 19:37:05 +01:00
|
|
|
static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_driver_scan_params *params)
|
|
|
|
{
|
2015-01-19 18:34:00 +01:00
|
|
|
#ifdef CONFIG_TESTING_OPTIONS
|
|
|
|
if (wpa_s->test_failure == WPAS_TEST_FAILURE_SCAN_TRIGGER)
|
|
|
|
return -EBUSY;
|
|
|
|
#endif /* CONFIG_TESTING_OPTIONS */
|
2009-03-26 19:37:05 +01:00
|
|
|
if (wpa_s->driver->scan2)
|
|
|
|
return wpa_s->driver->scan2(wpa_s->drv_priv, params);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-09-27 21:21:29 +02:00
|
|
|
static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s,
|
2015-11-17 14:08:23 +01:00
|
|
|
struct wpa_driver_scan_params *params)
|
2011-09-27 21:21:29 +02:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->sched_scan)
|
2015-11-17 14:08:23 +01:00
|
|
|
return wpa_s->driver->sched_scan(wpa_s->drv_priv, params);
|
2011-09-27 21:21:29 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->stop_sched_scan)
|
|
|
|
return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-01-02 19:29:24 +01:00
|
|
|
struct wpa_scan_results *
|
|
|
|
wpa_drv_get_scan_results2(struct wpa_supplicant *wpa_s);
|
2009-03-26 19:37:05 +01:00
|
|
|
|
|
|
|
static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_bssid) {
|
|
|
|
return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_ssid) {
|
|
|
|
return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2022-11-03 09:08:49 +01:00
|
|
|
static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, int link_id,
|
2009-12-26 09:35:08 +01:00
|
|
|
enum wpa_alg alg, const u8 *addr,
|
|
|
|
int key_idx, int set_tx,
|
2014-01-02 22:46:21 +01:00
|
|
|
const u8 *seq, size_t seq_len,
|
2020-01-04 23:10:04 +01:00
|
|
|
const u8 *key, size_t key_len,
|
|
|
|
enum key_flag key_flag)
|
2009-03-26 19:37:05 +01:00
|
|
|
{
|
2020-01-08 21:15:18 +01:00
|
|
|
struct wpa_driver_set_key_params params;
|
|
|
|
|
|
|
|
os_memset(¶ms, 0, sizeof(params));
|
|
|
|
params.ifname = wpa_s->ifname;
|
|
|
|
params.alg = alg;
|
|
|
|
params.addr = addr;
|
|
|
|
params.key_idx = key_idx;
|
|
|
|
params.set_tx = set_tx;
|
|
|
|
params.seq = seq;
|
|
|
|
params.seq_len = seq_len;
|
|
|
|
params.key = key;
|
|
|
|
params.key_len = key_len;
|
2020-01-04 23:10:04 +01:00
|
|
|
params.key_flag = key_flag;
|
2022-11-03 09:08:49 +01:00
|
|
|
params.link_id = link_id;
|
2020-01-08 21:15:18 +01:00
|
|
|
|
2014-01-02 22:46:21 +01:00
|
|
|
if (alg != WPA_ALG_NONE) {
|
2020-03-20 20:04:32 +01:00
|
|
|
/* keyidx = 1 can be either a broadcast or--with
|
|
|
|
* Extended Key ID--a unicast key. Use bit 15 for
|
|
|
|
* the pairwise keyidx 1 which is hopefully high enough
|
|
|
|
* to not clash with future extensions.
|
|
|
|
*/
|
|
|
|
if (key_idx == 1 && (key_flag & KEY_FLAG_PAIRWISE))
|
|
|
|
wpa_s->keys_cleared &= ~BIT(15);
|
|
|
|
else if (key_idx >= 0 && key_idx <= 5)
|
2014-01-02 22:46:21 +01:00
|
|
|
wpa_s->keys_cleared &= ~BIT(key_idx);
|
|
|
|
else
|
|
|
|
wpa_s->keys_cleared = 0;
|
|
|
|
}
|
2009-03-26 19:37:05 +01:00
|
|
|
if (wpa_s->driver->set_key) {
|
2020-01-08 21:15:18 +01:00
|
|
|
return wpa_s->driver->set_key(wpa_s->drv_priv, ¶ms);
|
2009-03-26 19:37:05 +01:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-06-18 13:11:23 +02:00
|
|
|
static inline int wpa_drv_get_seqnum(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr, int idx, u8 *seq)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_seqnum)
|
|
|
|
return wpa_s->driver->get_seqnum(wpa_s->ifname, wpa_s->drv_priv,
|
|
|
|
addr, idx, seq);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-06-07 12:07:17 +02:00
|
|
|
static inline int wpa_drv_sta_deauth(struct wpa_supplicant *wpa_s,
|
2019-04-22 19:17:38 +02:00
|
|
|
const u8 *addr, u16 reason_code)
|
2013-06-07 12:07:17 +02:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->sta_deauth) {
|
2013-07-21 14:21:38 +02:00
|
|
|
return wpa_s->driver->sta_deauth(wpa_s->drv_priv,
|
|
|
|
wpa_s->own_addr, addr,
|
2013-06-07 12:07:17 +02:00
|
|
|
reason_code);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-03-26 19:37:05 +01:00
|
|
|
static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
|
2019-04-22 19:17:38 +02:00
|
|
|
const u8 *addr, u16 reason_code)
|
2009-03-26 19:37:05 +01:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->deauthenticate) {
|
|
|
|
return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
|
|
|
|
reason_code);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
|
2017-03-30 15:57:15 +02:00
|
|
|
struct wpa_pmkid_params *params)
|
2009-03-26 19:37:05 +01:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->add_pmkid) {
|
2017-03-30 15:57:15 +02:00
|
|
|
return wpa_s->driver->add_pmkid(wpa_s->drv_priv, params);
|
2009-03-26 19:37:05 +01:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
|
2017-03-30 15:57:15 +02:00
|
|
|
struct wpa_pmkid_params *params)
|
2009-03-26 19:37:05 +01:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->remove_pmkid) {
|
2017-03-30 15:57:15 +02:00
|
|
|
return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, params);
|
2009-03-26 19:37:05 +01:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->flush_pmkid) {
|
|
|
|
return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_driver_capa *capa)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_capa) {
|
|
|
|
return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->poll) {
|
|
|
|
wpa_s->driver->poll(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_ifname) {
|
|
|
|
return wpa_s->driver->get_ifname(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-03-18 13:05:22 +01:00
|
|
|
static inline const char *
|
|
|
|
wpa_driver_get_radio_name(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_radio_name)
|
|
|
|
return wpa_s->driver->get_radio_name(wpa_s->drv_priv);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-03-26 19:37:05 +01:00
|
|
|
static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_mac_addr) {
|
|
|
|
return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
|
|
|
|
int state)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->set_operstate)
|
|
|
|
return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr, int protect_type,
|
|
|
|
int key_type)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->mlme_setprotection)
|
|
|
|
return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
|
|
|
|
protect_type,
|
|
|
|
key_type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-04-03 18:04:20 +02:00
|
|
|
static inline struct hostapd_hw_modes *
|
2009-03-26 19:37:05 +01:00
|
|
|
wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
|
2017-05-12 09:48:00 +02:00
|
|
|
u16 *flags, u8 *dfs_domain)
|
2009-03-26 19:37:05 +01:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->get_hw_feature_data)
|
|
|
|
return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
|
2017-05-12 09:48:00 +02:00
|
|
|
num_modes, flags,
|
|
|
|
dfs_domain);
|
2009-03-26 19:37:05 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
|
|
|
|
const char *alpha2)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->set_country)
|
|
|
|
return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
|
2015-06-10 10:43:35 +02:00
|
|
|
const u8 *data, size_t data_len, int noack,
|
2020-02-24 10:14:27 +01:00
|
|
|
unsigned int freq, unsigned int wait)
|
2009-03-26 19:37:05 +01:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->send_mlme)
|
|
|
|
return wpa_s->driver->send_mlme(wpa_s->drv_priv,
|
2015-06-10 10:43:35 +02:00
|
|
|
data, data_len, noack,
|
2020-02-24 10:14:27 +01:00
|
|
|
freq, NULL, 0, 0, wait);
|
2009-03-26 19:37:05 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *md,
|
|
|
|
const u8 *ies, size_t ies_len)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->update_ft_ies)
|
|
|
|
return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
|
|
|
|
ies, ies_len);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-08-10 12:22:37 +02:00
|
|
|
static inline int wpa_drv_set_ap(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_driver_ap_params *params)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->set_ap)
|
|
|
|
return wpa_s->driver->set_ap(wpa_s->drv_priv, params);
|
2009-04-02 15:09:48 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-04-17 19:09:20 +02:00
|
|
|
static inline int wpa_drv_sta_add(struct wpa_supplicant *wpa_s,
|
|
|
|
struct hostapd_sta_add_params *params)
|
|
|
|
{
|
2023-02-16 00:08:26 +01:00
|
|
|
if (wpa_s->driver->sta_add) {
|
|
|
|
/* Set link_id to -1 as it's needed for AP only */
|
|
|
|
params->mld_link_id = -1;
|
2010-03-07 10:42:41 +01:00
|
|
|
return wpa_s->driver->sta_add(wpa_s->drv_priv, params);
|
2023-02-16 00:08:26 +01:00
|
|
|
}
|
2009-04-17 19:09:20 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_sta_remove(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->sta_remove)
|
|
|
|
return wpa_s->driver->sta_remove(wpa_s->drv_priv, addr);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-01-03 16:17:41 +01:00
|
|
|
static inline int wpa_drv_tx_control_port(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dest, u16 proto,
|
2020-01-03 16:17:42 +01:00
|
|
|
const u8 *buf, size_t len,
|
|
|
|
int no_encrypt)
|
2020-01-03 16:17:41 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->tx_control_port)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->tx_control_port(wpa_s->drv_priv, dest, proto,
|
2020-01-03 16:17:42 +01:00
|
|
|
buf, len, no_encrypt);
|
2020-01-03 16:17:41 +01:00
|
|
|
}
|
|
|
|
|
2009-04-20 15:27:45 +02:00
|
|
|
static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr, const u8 *data,
|
|
|
|
size_t data_len, int encrypt,
|
2011-04-02 21:03:05 +02:00
|
|
|
const u8 *own_addr, u32 flags)
|
2009-04-20 15:27:45 +02:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->hapd_send_eapol)
|
|
|
|
return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr,
|
|
|
|
data, data_len, encrypt,
|
2011-04-02 21:03:05 +02:00
|
|
|
own_addr, flags);
|
2009-04-20 15:27:45 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-04-20 15:33:13 +02:00
|
|
|
static inline int wpa_drv_sta_set_flags(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr, int total_flags,
|
|
|
|
int flags_or, int flags_and)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->sta_set_flags)
|
2010-03-07 10:45:41 +01:00
|
|
|
return wpa_s->driver->sta_set_flags(wpa_s->drv_priv, addr,
|
2009-04-20 15:33:13 +02:00
|
|
|
total_flags, flags_or,
|
|
|
|
flags_and);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-04-22 15:01:37 +02:00
|
|
|
static inline int wpa_drv_set_supp_port(struct wpa_supplicant *wpa_s,
|
|
|
|
int authorized)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->set_supp_port) {
|
|
|
|
return wpa_s->driver->set_supp_port(wpa_s->drv_priv,
|
|
|
|
authorized);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-10-19 16:14:09 +02:00
|
|
|
int wpa_drv_send_action(struct wpa_supplicant *wpa_s, unsigned int freq,
|
|
|
|
unsigned int wait, const u8 *dst, const u8 *src,
|
|
|
|
const u8 *bssid, const u8 *data, size_t data_len,
|
|
|
|
int no_cck);
|
2010-01-03 12:57:51 +01:00
|
|
|
|
2010-12-29 12:59:17 +01:00
|
|
|
static inline void wpa_drv_send_action_cancel_wait(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->send_action_cancel_wait)
|
|
|
|
wpa_s->driver->send_action_cancel_wait(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
|
2010-07-18 23:30:24 +02:00
|
|
|
static inline int wpa_drv_set_freq(struct wpa_supplicant *wpa_s,
|
|
|
|
struct hostapd_freq_params *freq)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->set_freq)
|
|
|
|
return wpa_s->driver->set_freq(wpa_s->drv_priv, freq);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-04-11 18:23:09 +02:00
|
|
|
static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wpa_driver_if_type type,
|
|
|
|
const char *ifname, const u8 *addr,
|
|
|
|
void *bss_ctx, char *force_ifname,
|
2011-03-15 12:02:49 +01:00
|
|
|
u8 *if_addr, const char *bridge)
|
2010-04-11 18:23:09 +02:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->if_add)
|
|
|
|
return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
|
|
|
|
addr, bss_ctx, NULL, force_ifname,
|
2015-11-03 15:30:09 +01:00
|
|
|
if_addr, bridge, 0, 0);
|
2010-01-03 12:42:06 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-04-11 18:23:09 +02:00
|
|
|
static inline int wpa_drv_if_remove(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wpa_driver_if_type type,
|
|
|
|
const char *ifname)
|
2010-01-03 12:42:06 +01:00
|
|
|
{
|
2010-04-11 18:23:09 +02:00
|
|
|
if (wpa_s->driver->if_remove)
|
|
|
|
return wpa_s->driver->if_remove(wpa_s->drv_priv, type, ifname);
|
|
|
|
return -1;
|
2010-01-03 12:42:06 +01:00
|
|
|
}
|
|
|
|
|
2010-01-03 12:57:51 +01:00
|
|
|
static inline int wpa_drv_remain_on_channel(struct wpa_supplicant *wpa_s,
|
|
|
|
unsigned int freq,
|
|
|
|
unsigned int duration)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->remain_on_channel)
|
|
|
|
return wpa_s->driver->remain_on_channel(wpa_s->drv_priv, freq,
|
|
|
|
duration);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_cancel_remain_on_channel(
|
|
|
|
struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->cancel_remain_on_channel)
|
|
|
|
return wpa_s->driver->cancel_remain_on_channel(
|
|
|
|
wpa_s->drv_priv);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-01-03 12:30:22 +01:00
|
|
|
static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s,
|
|
|
|
int report)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->probe_req_report)
|
|
|
|
return wpa_s->driver->probe_req_report(wpa_s->drv_priv,
|
|
|
|
report);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-01-16 11:20:51 +01:00
|
|
|
static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->deinit_ap)
|
|
|
|
return wpa_s->driver->deinit_ap(wpa_s->drv_priv);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-04-01 20:41:23 +02:00
|
|
|
static inline int wpa_drv_deinit_p2p_cli(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->deinit_p2p_cli)
|
|
|
|
return wpa_s->driver->deinit_p2p_cli(wpa_s->drv_priv);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-02-27 17:46:02 +01:00
|
|
|
static inline void wpa_drv_suspend(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->suspend)
|
|
|
|
wpa_s->driver->suspend(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void wpa_drv_resume(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->resume)
|
|
|
|
wpa_s->driver->resume(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
|
2010-03-29 00:31:04 +02:00
|
|
|
static inline int wpa_drv_signal_monitor(struct wpa_supplicant *wpa_s,
|
|
|
|
int threshold, int hysteresis)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->signal_monitor)
|
|
|
|
return wpa_s->driver->signal_monitor(wpa_s->drv_priv,
|
|
|
|
threshold, hysteresis);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-01-02 19:29:24 +01:00
|
|
|
int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_signal_info *si);
|
2011-03-31 16:56:48 +02:00
|
|
|
|
2022-09-08 16:44:21 +02:00
|
|
|
static inline int wpa_drv_mlo_signal_poll(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_mlo_signal_info *mlo_si)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->mlo_signal_poll)
|
|
|
|
return wpa_s->driver->mlo_signal_poll(wpa_s->drv_priv, mlo_si);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-08-06 21:46:19 +02:00
|
|
|
static inline int wpa_drv_channel_info(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_channel_info *ci)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->channel_info)
|
|
|
|
return wpa_s->driver->channel_info(wpa_s->drv_priv, ci);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-09-05 16:02:02 +02:00
|
|
|
static inline int wpa_drv_pktcnt_poll(struct wpa_supplicant *wpa_s,
|
|
|
|
struct hostap_sta_driver_data *sta)
|
|
|
|
{
|
|
|
|
if (wpa_s->driver->read_sta_data)
|
|
|
|
return wpa_s->driver->read_sta_data(wpa_s->drv_priv, sta,
|
|
|
|
wpa_s->bssid);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-04-11 19:16:43 +02:00
|
|
|
static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s,
|
|
|
|
const struct wpabuf *beacon,
|
2010-09-22 19:46:44 +02:00
|
|
|
const struct wpabuf *proberesp,
|
|
|
|
const struct wpabuf *assocresp)
|
2010-04-11 19:16:43 +02:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_ap_wps_ie)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_ap_wps_ie(wpa_s->drv_priv, beacon,
|
2010-09-22 19:46:44 +02:00
|
|
|
proberesp, assocresp);
|
2010-04-11 19:16:43 +02:00
|
|
|
}
|
|
|
|
|
2010-07-18 23:30:24 +02:00
|
|
|
static inline int wpa_drv_get_noa(struct wpa_supplicant *wpa_s,
|
|
|
|
u8 *buf, size_t buf_len)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->get_noa)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->get_noa(wpa_s->drv_priv, buf, buf_len);
|
|
|
|
}
|
|
|
|
|
2010-06-24 08:04:21 +02:00
|
|
|
static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s,
|
|
|
|
int legacy_ps, int opp_ps,
|
|
|
|
int ctwindow)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_p2p_powersave)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_p2p_powersave(wpa_s->drv_priv, legacy_ps,
|
|
|
|
opp_ps, ctwindow);
|
|
|
|
}
|
|
|
|
|
2010-08-02 01:19:31 +02:00
|
|
|
static inline int wpa_drv_ampdu(struct wpa_supplicant *wpa_s, int ampdu)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->ampdu)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->ampdu(wpa_s->drv_priv, ampdu);
|
|
|
|
}
|
|
|
|
|
2010-10-07 09:26:56 +02:00
|
|
|
static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *dst, u8 action_code,
|
|
|
|
u8 dialog_token, u16 status_code,
|
2014-09-29 20:47:51 +02:00
|
|
|
u32 peer_capab, int initiator,
|
|
|
|
const u8 *buf, size_t len)
|
2010-10-07 09:26:56 +02:00
|
|
|
{
|
|
|
|
if (wpa_s->driver->send_tdls_mgmt) {
|
|
|
|
return wpa_s->driver->send_tdls_mgmt(wpa_s->drv_priv, dst,
|
|
|
|
action_code, dialog_token,
|
2014-03-26 17:04:50 +01:00
|
|
|
status_code, peer_capab,
|
2014-09-29 20:47:51 +02:00
|
|
|
initiator, buf, len);
|
2010-10-07 09:26:56 +02:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s,
|
|
|
|
enum tdls_oper oper, const u8 *peer)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->tdls_oper)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer);
|
|
|
|
}
|
2010-12-30 11:48:55 +01:00
|
|
|
|
2013-11-07 15:16:15 +01:00
|
|
|
#ifdef ANDROID
|
|
|
|
static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s,
|
|
|
|
char *cmd, char *buf, size_t buf_len)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->driver_cmd)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len);
|
|
|
|
}
|
|
|
|
#endif /* ANDROID */
|
|
|
|
|
2011-07-12 20:22:51 +02:00
|
|
|
static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
|
2015-01-25 15:49:18 +01:00
|
|
|
const u8 *kek, size_t kek_len,
|
|
|
|
const u8 *kck, size_t kck_len,
|
2011-07-12 20:22:51 +02:00
|
|
|
const u8 *replay_ctr)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_rekey_info)
|
|
|
|
return;
|
2015-01-25 15:49:18 +01:00
|
|
|
wpa_s->driver->set_rekey_info(wpa_s->drv_priv, kek, kek_len,
|
|
|
|
kck, kck_len, replay_ctr);
|
2011-07-12 20:22:51 +02:00
|
|
|
}
|
|
|
|
|
2012-02-16 15:26:44 +01:00
|
|
|
static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s,
|
|
|
|
int disabled)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->radio_disable)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->radio_disable(wpa_s->drv_priv, disabled);
|
|
|
|
}
|
|
|
|
|
2012-06-10 19:54:31 +02:00
|
|
|
static inline int wpa_drv_switch_channel(struct wpa_supplicant *wpa_s,
|
2013-11-14 11:28:29 +01:00
|
|
|
struct csa_settings *settings)
|
2012-06-10 19:54:31 +02:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->switch_channel)
|
|
|
|
return -1;
|
2013-11-14 11:28:29 +01:00
|
|
|
return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings);
|
2012-06-10 19:54:31 +02:00
|
|
|
}
|
|
|
|
|
2014-10-22 14:03:55 +02:00
|
|
|
static inline int wpa_drv_add_ts(struct wpa_supplicant *wpa_s, u8 tsid,
|
|
|
|
const u8 *address, u8 user_priority,
|
|
|
|
u16 admitted_time)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->add_tx_ts)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->add_tx_ts(wpa_s->drv_priv, tsid, address,
|
|
|
|
user_priority, admitted_time);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_del_ts(struct wpa_supplicant *wpa_s, u8 tid,
|
|
|
|
const u8 *address)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->del_tx_ts)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->del_tx_ts(wpa_s->drv_priv, tid, address);
|
|
|
|
}
|
|
|
|
|
2014-12-29 06:20:51 +01:00
|
|
|
static inline int wpa_drv_tdls_enable_channel_switch(
|
|
|
|
struct wpa_supplicant *wpa_s, const u8 *addr, u8 oper_class,
|
|
|
|
const struct hostapd_freq_params *freq_params)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->tdls_enable_channel_switch)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->tdls_enable_channel_switch(wpa_s->drv_priv, addr,
|
|
|
|
oper_class,
|
|
|
|
freq_params);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
wpa_drv_tdls_disable_channel_switch(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->tdls_disable_channel_switch)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->tdls_disable_channel_switch(wpa_s->drv_priv,
|
|
|
|
addr);
|
|
|
|
}
|
|
|
|
|
2012-02-26 16:22:02 +01:00
|
|
|
static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wnm_oper oper, const u8 *peer,
|
|
|
|
u8 *buf, u16 *buf_len)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->wnm_oper)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->wnm_oper(wpa_s->drv_priv, oper, peer, buf,
|
|
|
|
buf_len);
|
|
|
|
}
|
|
|
|
|
2013-09-28 16:19:30 +02:00
|
|
|
static inline int wpa_drv_status(struct wpa_supplicant *wpa_s,
|
|
|
|
char *buf, size_t buflen)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->status)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->status(wpa_s->drv_priv, buf, buflen);
|
|
|
|
}
|
|
|
|
|
2013-07-24 12:17:56 +02:00
|
|
|
static inline int wpa_drv_set_qos_map(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *qos_map_set, u8 qos_map_set_len)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_qos_map)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_qos_map(wpa_s->drv_priv, qos_map_set,
|
|
|
|
qos_map_set_len);
|
|
|
|
}
|
|
|
|
|
2018-06-14 11:00:43 +02:00
|
|
|
static inline int wpa_drv_get_wowlan(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->get_wowlan)
|
|
|
|
return 0;
|
|
|
|
return wpa_s->driver->get_wowlan(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
|
2014-04-24 07:45:39 +02:00
|
|
|
static inline int wpa_drv_wowlan(struct wpa_supplicant *wpa_s,
|
|
|
|
const struct wowlan_triggers *triggers)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_wowlan)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_wowlan(wpa_s->drv_priv, triggers);
|
|
|
|
}
|
|
|
|
|
2014-03-03 12:09:50 +01:00
|
|
|
static inline int wpa_drv_vendor_cmd(struct wpa_supplicant *wpa_s,
|
|
|
|
int vendor_id, int subcmd, const u8 *data,
|
2020-10-27 19:03:59 +01:00
|
|
|
size_t data_len,
|
|
|
|
enum nested_attr nested_attr_flag,
|
|
|
|
struct wpabuf *buf)
|
2014-03-03 12:09:50 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->vendor_cmd)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->vendor_cmd(wpa_s->drv_priv, vendor_id, subcmd,
|
2020-10-27 19:03:59 +01:00
|
|
|
data, data_len, nested_attr_flag, buf);
|
2014-03-03 12:09:50 +01:00
|
|
|
}
|
|
|
|
|
2014-09-11 14:52:37 +02:00
|
|
|
static inline int wpa_drv_roaming(struct wpa_supplicant *wpa_s, int allowed,
|
|
|
|
const u8 *bssid)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->roaming)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->roaming(wpa_s->drv_priv, allowed, bssid);
|
|
|
|
}
|
|
|
|
|
2017-12-14 10:44:51 +01:00
|
|
|
static inline int wpa_drv_disable_fils(struct wpa_supplicant *wpa_s,
|
|
|
|
int disable)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->disable_fils)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->disable_fils(wpa_s->drv_priv, disable);
|
|
|
|
}
|
|
|
|
|
2014-09-27 18:11:24 +02:00
|
|
|
static inline int wpa_drv_set_mac_addr(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *addr)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_mac_addr)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_mac_addr(wpa_s->drv_priv, addr);
|
|
|
|
}
|
|
|
|
|
2014-03-25 20:39:02 +01:00
|
|
|
|
|
|
|
#ifdef CONFIG_MACSEC
|
|
|
|
|
|
|
|
static inline int wpa_drv_macsec_init(struct wpa_supplicant *wpa_s,
|
|
|
|
struct macsec_init_params *params)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->macsec_init)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->macsec_init(wpa_s->drv_priv, params);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_macsec_deinit(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->macsec_deinit)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->macsec_deinit(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
|
2016-10-07 12:08:12 +02:00
|
|
|
static inline int wpa_drv_macsec_get_capability(struct wpa_supplicant *wpa_s,
|
|
|
|
enum macsec_cap *cap)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->macsec_get_capability)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->macsec_get_capability(wpa_s->drv_priv, cap);
|
|
|
|
}
|
|
|
|
|
2014-03-25 20:39:02 +01:00
|
|
|
static inline int wpa_drv_enable_protect_frames(struct wpa_supplicant *wpa_s,
|
2020-04-24 00:27:57 +02:00
|
|
|
bool enabled)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->enable_protect_frames)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->enable_protect_frames(wpa_s->drv_priv, enabled);
|
|
|
|
}
|
|
|
|
|
2016-11-02 16:38:38 +01:00
|
|
|
static inline int wpa_drv_enable_encrypt(struct wpa_supplicant *wpa_s,
|
2020-04-24 00:27:57 +02:00
|
|
|
bool enabled)
|
2016-11-02 16:38:38 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->enable_encrypt)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->enable_encrypt(wpa_s->drv_priv, enabled);
|
|
|
|
}
|
|
|
|
|
2014-03-25 20:39:02 +01:00
|
|
|
static inline int wpa_drv_set_replay_protect(struct wpa_supplicant *wpa_s,
|
2020-04-24 00:27:57 +02:00
|
|
|
bool enabled, u32 window)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_replay_protect)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_replay_protect(wpa_s->drv_priv, enabled,
|
|
|
|
window);
|
|
|
|
}
|
|
|
|
|
2023-02-14 09:26:56 +01:00
|
|
|
static inline int wpa_drv_set_offload(struct wpa_supplicant *wpa_s, u8 offload)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_offload)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_offload(wpa_s->drv_priv, offload);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-03-25 20:39:02 +01:00
|
|
|
static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant *wpa_s,
|
2016-08-12 15:07:35 +02:00
|
|
|
u64 cs)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_current_cipher_suite)
|
|
|
|
return -1;
|
2016-08-15 11:43:42 +02:00
|
|
|
return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
|
2020-04-24 00:27:57 +02:00
|
|
|
bool enabled)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->enable_controlled_port)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->enable_controlled_port(wpa_s->drv_priv, enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_get_receive_lowest_pn(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:05 +02:00
|
|
|
struct receive_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->get_receive_lowest_pn)
|
|
|
|
return -1;
|
2016-09-20 09:43:05 +02:00
|
|
|
return wpa_s->driver->get_receive_lowest_pn(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_get_transmit_next_pn(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:05 +02:00
|
|
|
struct transmit_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->get_transmit_next_pn)
|
|
|
|
return -1;
|
2016-09-20 09:43:05 +02:00
|
|
|
return wpa_s->driver->get_transmit_next_pn(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_set_transmit_next_pn(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:05 +02:00
|
|
|
struct transmit_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_transmit_next_pn)
|
|
|
|
return -1;
|
2016-09-20 09:43:05 +02:00
|
|
|
return wpa_s->driver->set_transmit_next_pn(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
2018-02-20 20:28:39 +01:00
|
|
|
static inline int wpa_drv_set_receive_lowest_pn(struct wpa_supplicant *wpa_s,
|
|
|
|
struct receive_sa *sa)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_receive_lowest_pn)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_receive_lowest_pn(wpa_s->drv_priv, sa);
|
|
|
|
}
|
|
|
|
|
2014-03-25 20:39:02 +01:00
|
|
|
static inline int
|
2016-10-07 12:08:10 +02:00
|
|
|
wpa_drv_create_receive_sc(struct wpa_supplicant *wpa_s, struct receive_sc *sc,
|
2014-03-25 20:39:02 +01:00
|
|
|
unsigned int conf_offset, int validation)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->create_receive_sc)
|
|
|
|
return -1;
|
2016-10-07 12:08:10 +02:00
|
|
|
return wpa_s->driver->create_receive_sc(wpa_s->drv_priv, sc,
|
|
|
|
conf_offset, validation);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_delete_receive_sc(struct wpa_supplicant *wpa_s,
|
2016-10-07 12:08:10 +02:00
|
|
|
struct receive_sc *sc)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->delete_receive_sc)
|
|
|
|
return -1;
|
2016-10-07 12:08:10 +02:00
|
|
|
return wpa_s->driver->delete_receive_sc(wpa_s->drv_priv, sc);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_create_receive_sa(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:09 +02:00
|
|
|
struct receive_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->create_receive_sa)
|
|
|
|
return -1;
|
2016-09-20 09:43:09 +02:00
|
|
|
return wpa_s->driver->create_receive_sa(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
2016-10-21 14:45:28 +02:00
|
|
|
static inline int wpa_drv_delete_receive_sa(struct wpa_supplicant *wpa_s,
|
|
|
|
struct receive_sa *sa)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->delete_receive_sa)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->delete_receive_sa(wpa_s->drv_priv, sa);
|
|
|
|
}
|
|
|
|
|
2014-03-25 20:39:02 +01:00
|
|
|
static inline int wpa_drv_enable_receive_sa(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:09 +02:00
|
|
|
struct receive_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->enable_receive_sa)
|
|
|
|
return -1;
|
2016-09-20 09:43:09 +02:00
|
|
|
return wpa_s->driver->enable_receive_sa(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_disable_receive_sa(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:09 +02:00
|
|
|
struct receive_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->disable_receive_sa)
|
|
|
|
return -1;
|
2016-09-20 09:43:09 +02:00
|
|
|
return wpa_s->driver->disable_receive_sa(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
2016-10-07 12:08:09 +02:00
|
|
|
wpa_drv_create_transmit_sc(struct wpa_supplicant *wpa_s, struct transmit_sc *sc,
|
2014-03-25 20:39:02 +01:00
|
|
|
unsigned int conf_offset)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->create_transmit_sc)
|
|
|
|
return -1;
|
2016-10-07 12:08:09 +02:00
|
|
|
return wpa_s->driver->create_transmit_sc(wpa_s->drv_priv, sc,
|
2014-03-25 20:39:02 +01:00
|
|
|
conf_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_delete_transmit_sc(struct wpa_supplicant *wpa_s,
|
2016-10-07 12:08:09 +02:00
|
|
|
struct transmit_sc *sc)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->delete_transmit_sc)
|
|
|
|
return -1;
|
2016-10-07 12:08:09 +02:00
|
|
|
return wpa_s->driver->delete_transmit_sc(wpa_s->drv_priv, sc);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_create_transmit_sa(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:07 +02:00
|
|
|
struct transmit_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->create_transmit_sa)
|
|
|
|
return -1;
|
2016-09-20 09:43:07 +02:00
|
|
|
return wpa_s->driver->create_transmit_sa(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
2016-10-21 14:45:28 +02:00
|
|
|
static inline int wpa_drv_delete_transmit_sa(struct wpa_supplicant *wpa_s,
|
|
|
|
struct transmit_sa *sa)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->delete_transmit_sa)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->delete_transmit_sa(wpa_s->drv_priv, sa);
|
|
|
|
}
|
|
|
|
|
2014-03-25 20:39:02 +01:00
|
|
|
static inline int wpa_drv_enable_transmit_sa(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:07 +02:00
|
|
|
struct transmit_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->enable_transmit_sa)
|
|
|
|
return -1;
|
2016-09-20 09:43:07 +02:00
|
|
|
return wpa_s->driver->enable_transmit_sa(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_disable_transmit_sa(struct wpa_supplicant *wpa_s,
|
2016-09-20 09:43:07 +02:00
|
|
|
struct transmit_sa *sa)
|
2014-03-25 20:39:02 +01:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->disable_transmit_sa)
|
|
|
|
return -1;
|
2016-09-20 09:43:07 +02:00
|
|
|
return wpa_s->driver->disable_transmit_sa(wpa_s->drv_priv, sa);
|
2014-03-25 20:39:02 +01:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_MACSEC */
|
|
|
|
|
2015-07-27 12:14:22 +02:00
|
|
|
static inline int wpa_drv_setband(struct wpa_supplicant *wpa_s,
|
2020-08-06 08:34:48 +02:00
|
|
|
u32 band_mask)
|
2015-07-27 12:14:22 +02:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_band)
|
|
|
|
return -1;
|
2020-08-06 08:34:48 +02:00
|
|
|
return wpa_s->driver->set_band(wpa_s->drv_priv, band_mask);
|
2015-07-27 12:14:22 +02:00
|
|
|
}
|
|
|
|
|
2015-07-24 01:32:58 +02:00
|
|
|
static inline int wpa_drv_get_pref_freq_list(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wpa_driver_if_type if_type,
|
|
|
|
unsigned int *num,
|
2020-11-05 17:25:55 +01:00
|
|
|
struct weighted_pcl *freq_list)
|
2015-07-24 01:32:58 +02:00
|
|
|
{
|
2017-02-15 14:38:59 +01:00
|
|
|
#ifdef CONFIG_TESTING_OPTIONS
|
|
|
|
if (wpa_s->get_pref_freq_list_override)
|
|
|
|
return wpas_ctrl_iface_get_pref_freq_list_override(
|
|
|
|
wpa_s, if_type, num, freq_list);
|
|
|
|
#endif /* CONFIG_TESTING_OPTIONS */
|
2015-07-24 01:32:58 +02:00
|
|
|
if (!wpa_s->driver->get_pref_freq_list)
|
2015-07-30 21:10:46 +02:00
|
|
|
return -1;
|
2015-07-24 01:32:58 +02:00
|
|
|
return wpa_s->driver->get_pref_freq_list(wpa_s->drv_priv, if_type,
|
|
|
|
num, freq_list);
|
|
|
|
}
|
|
|
|
|
2015-07-24 02:07:55 +02:00
|
|
|
static inline int wpa_drv_set_prob_oper_freq(struct wpa_supplicant *wpa_s,
|
|
|
|
unsigned int freq)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_prob_oper_freq)
|
|
|
|
return 0;
|
|
|
|
return wpa_s->driver->set_prob_oper_freq(wpa_s->drv_priv, freq);
|
|
|
|
}
|
|
|
|
|
2016-11-30 05:34:38 +01:00
|
|
|
static inline int wpa_drv_abort_scan(struct wpa_supplicant *wpa_s,
|
|
|
|
u64 scan_cookie)
|
2015-10-19 16:00:34 +02:00
|
|
|
{
|
|
|
|
if (!wpa_s->driver->abort_scan)
|
|
|
|
return -1;
|
2016-11-30 05:34:38 +01:00
|
|
|
return wpa_s->driver->abort_scan(wpa_s->drv_priv, scan_cookie);
|
2015-10-19 16:00:34 +02:00
|
|
|
}
|
|
|
|
|
2016-04-06 16:14:40 +02:00
|
|
|
static inline int wpa_drv_configure_frame_filters(struct wpa_supplicant *wpa_s,
|
|
|
|
u32 filters)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->configure_data_frame_filters)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->configure_data_frame_filters(wpa_s->drv_priv,
|
|
|
|
filters);
|
|
|
|
}
|
|
|
|
|
2016-04-12 10:01:42 +02:00
|
|
|
static inline int wpa_drv_get_ext_capa(struct wpa_supplicant *wpa_s,
|
|
|
|
enum wpa_driver_if_type type)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->get_ext_capab)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->get_ext_capab(wpa_s->drv_priv, type,
|
|
|
|
&wpa_s->extended_capa,
|
|
|
|
&wpa_s->extended_capa_mask,
|
|
|
|
&wpa_s->extended_capa_len);
|
|
|
|
}
|
|
|
|
|
2016-06-24 20:36:18 +02:00
|
|
|
static inline int wpa_drv_p2p_lo_start(struct wpa_supplicant *wpa_s,
|
|
|
|
unsigned int channel,
|
|
|
|
unsigned int period,
|
|
|
|
unsigned int interval,
|
|
|
|
unsigned int count,
|
|
|
|
const u8 *device_types,
|
|
|
|
size_t dev_types_len,
|
|
|
|
const u8 *ies, size_t ies_len)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->p2p_lo_start)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->p2p_lo_start(wpa_s->drv_priv, channel, period,
|
|
|
|
interval, count, device_types,
|
|
|
|
dev_types_len, ies, ies_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_p2p_lo_stop(struct wpa_supplicant *wpa_s)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->p2p_lo_stop)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->p2p_lo_stop(wpa_s->drv_priv);
|
|
|
|
}
|
|
|
|
|
2016-07-19 09:11:15 +02:00
|
|
|
static inline int wpa_drv_set_default_scan_ies(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *ies, size_t len)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_default_scan_ies)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_default_scan_ies(wpa_s->drv_priv, ies, len);
|
|
|
|
}
|
|
|
|
|
2016-10-25 17:41:04 +02:00
|
|
|
static inline int wpa_drv_set_tdls_mode(struct wpa_supplicant *wpa_s,
|
|
|
|
int tdls_external_control)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_tdls_mode)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_tdls_mode(wpa_s->drv_priv,
|
|
|
|
tdls_external_control);
|
|
|
|
}
|
|
|
|
|
2017-03-06 12:43:10 +01:00
|
|
|
static inline struct wpa_bss_candidate_info *
|
|
|
|
wpa_drv_get_bss_trans_status(struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_bss_trans_info *params)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->get_bss_transition_status)
|
|
|
|
return NULL;
|
|
|
|
return wpa_s->driver->get_bss_transition_status(wpa_s->drv_priv,
|
|
|
|
params);
|
|
|
|
}
|
|
|
|
|
2017-05-04 09:24:49 +02:00
|
|
|
static inline int wpa_drv_ignore_assoc_disallow(struct wpa_supplicant *wpa_s,
|
|
|
|
int val)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->ignore_assoc_disallow)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->ignore_assoc_disallow(wpa_s->drv_priv, val);
|
|
|
|
}
|
|
|
|
|
2020-07-24 11:13:19 +02:00
|
|
|
static inline int wpa_drv_set_bssid_tmp_disallow(struct wpa_supplicant *wpa_s,
|
|
|
|
unsigned int num_bssid,
|
|
|
|
const u8 *bssids)
|
2017-06-21 16:46:07 +02:00
|
|
|
{
|
2020-07-24 11:13:19 +02:00
|
|
|
if (!wpa_s->driver->set_bssid_tmp_disallow)
|
2017-06-21 16:46:07 +02:00
|
|
|
return -1;
|
2020-07-24 11:13:19 +02:00
|
|
|
return wpa_s->driver->set_bssid_tmp_disallow(wpa_s->drv_priv, num_bssid,
|
|
|
|
bssids);
|
2017-06-21 16:46:07 +02:00
|
|
|
}
|
|
|
|
|
2017-08-17 10:26:07 +02:00
|
|
|
static inline int wpa_drv_update_connect_params(
|
|
|
|
struct wpa_supplicant *wpa_s,
|
|
|
|
struct wpa_driver_associate_params *params,
|
|
|
|
enum wpa_drv_update_connect_params_mask mask)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->update_connect_params)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->update_connect_params(wpa_s->drv_priv, params,
|
|
|
|
mask);
|
|
|
|
}
|
|
|
|
|
2018-02-01 12:31:28 +01:00
|
|
|
static inline int
|
|
|
|
wpa_drv_send_external_auth_status(struct wpa_supplicant *wpa_s,
|
|
|
|
struct external_auth *params)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->send_external_auth_status)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->send_external_auth_status(wpa_s->drv_priv,
|
|
|
|
params);
|
|
|
|
}
|
|
|
|
|
2018-12-05 11:23:53 +01:00
|
|
|
static inline int wpa_drv_set_4addr_mode(struct wpa_supplicant *wpa_s, int val)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->set_4addr_mode)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->set_4addr_mode(wpa_s->drv_priv,
|
|
|
|
wpa_s->bridge_ifname, val);
|
|
|
|
}
|
|
|
|
|
2020-04-20 22:52:04 +02:00
|
|
|
static inline int wpa_drv_dpp_listen(struct wpa_supplicant *wpa_s, bool enable)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->dpp_listen)
|
|
|
|
return 0;
|
|
|
|
return wpa_s->driver->dpp_listen(wpa_s->drv_priv, enable);
|
|
|
|
}
|
|
|
|
|
2022-07-26 09:09:17 +02:00
|
|
|
static inline int wpa_drv_send_pasn_resp(struct wpa_supplicant *wpa_s,
|
|
|
|
struct pasn_auth *params)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->send_pasn_resp)
|
|
|
|
return -1;
|
|
|
|
return wpa_s->driver->send_pasn_resp(wpa_s->drv_priv, params);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int wpa_drv_set_secure_ranging_ctx(struct wpa_supplicant *wpa_s,
|
|
|
|
const u8 *own_addr,
|
|
|
|
const u8 *peer_addr,
|
|
|
|
u32 cipher, u8 tk_len,
|
|
|
|
const u8 *tk,
|
|
|
|
u8 ltf_keyseed_len,
|
|
|
|
const u8 *ltf_keyseed,
|
|
|
|
u32 action)
|
|
|
|
{
|
|
|
|
struct secure_ranging_params params;
|
|
|
|
|
|
|
|
if (!wpa_s->driver->set_secure_ranging_ctx)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
os_memset(¶ms, 0, sizeof(params));
|
|
|
|
params.action = action;
|
|
|
|
params.own_addr = own_addr;
|
|
|
|
params.peer_addr = peer_addr;
|
|
|
|
params.cipher = cipher;
|
|
|
|
params.tk_len = tk_len;
|
|
|
|
params.tk = tk;
|
|
|
|
params.ltf_keyseed_len = ltf_keyseed_len;
|
|
|
|
params.ltf_keyseed = ltf_keyseed;
|
|
|
|
|
|
|
|
return wpa_s->driver->set_secure_ranging_ctx(wpa_s->drv_priv, ¶ms);
|
|
|
|
}
|
|
|
|
|
2022-09-08 16:44:11 +02:00
|
|
|
static inline int
|
|
|
|
wpas_drv_get_sta_mlo_info(struct wpa_supplicant *wpa_s,
|
|
|
|
struct driver_sta_mlo_info *mlo_info)
|
|
|
|
{
|
|
|
|
if (!wpa_s->driver->get_sta_mlo_info)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return wpa_s->driver->get_sta_mlo_info(wpa_s->drv_priv, mlo_info);
|
|
|
|
}
|
|
|
|
|
2009-03-26 19:37:05 +01:00
|
|
|
#endif /* DRIVER_I_H */
|