blob: 46cee442f4e94ea4b206c5e7b365f2e1211bfe7e [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * Driver interface definition
Paul Stewart092955c2017-02-06 09:13:09 -08003 * Copyright (c) 2003-2017, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 *
8 * This file defines a driver interface used by both %wpa_supplicant and
9 * hostapd. The first part of the file defines data structures used in various
10 * driver operations. This is followed by the struct wpa_driver_ops that each
11 * driver wrapper will beed to define with callback functions for requesting
12 * driver operations. After this, there are definitions for driver event
13 * reporting with wpa_supplicant_event() and some convenience helper functions
14 * that can be used to report events.
15 */
16
17#ifndef DRIVER_H
18#define DRIVER_H
19
20#define WPA_SUPPLICANT_DRIVER_VERSION 4
21
22#include "common/defs.h"
Dmitry Shmidt9d9e6022015-04-23 10:34:55 -070023#include "common/ieee802_11_defs.h"
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070024#include "common/wpa_common.h"
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -080025#ifdef CONFIG_MACSEC
26#include "pae/ieee802_1x_kay.h"
27#endif /* CONFIG_MACSEC */
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -070028#include "utils/list.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070029
30#define HOSTAPD_CHAN_DISABLED 0x00000001
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080031#define HOSTAPD_CHAN_NO_IR 0x00000002
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070032#define HOSTAPD_CHAN_RADAR 0x00000008
33#define HOSTAPD_CHAN_HT40PLUS 0x00000010
34#define HOSTAPD_CHAN_HT40MINUS 0x00000020
35#define HOSTAPD_CHAN_HT40 0x00000040
Dmitry Shmidt391c59f2013-09-03 12:16:28 -070036#define HOSTAPD_CHAN_SURVEY_LIST_INITIALIZED 0x00000080
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070037
Dmitry Shmidtea69e842013-05-13 14:52:28 -070038#define HOSTAPD_CHAN_DFS_UNKNOWN 0x00000000
39#define HOSTAPD_CHAN_DFS_USABLE 0x00000100
40#define HOSTAPD_CHAN_DFS_UNAVAILABLE 0x00000200
41#define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300
42#define HOSTAPD_CHAN_DFS_MASK 0x00000300
43
Dmitry Shmidt68d0e3e2013-10-28 17:59:21 -070044#define HOSTAPD_CHAN_VHT_10_70 0x00000800
45#define HOSTAPD_CHAN_VHT_30_50 0x00001000
46#define HOSTAPD_CHAN_VHT_50_30 0x00002000
47#define HOSTAPD_CHAN_VHT_70_10 0x00004000
48
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080049#define HOSTAPD_CHAN_INDOOR_ONLY 0x00010000
50#define HOSTAPD_CHAN_GO_CONCURRENT 0x00020000
51
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -080052#define HOSTAPD_CHAN_VHT_10_150 0x00100000
53#define HOSTAPD_CHAN_VHT_30_130 0x00200000
54#define HOSTAPD_CHAN_VHT_50_110 0x00400000
55#define HOSTAPD_CHAN_VHT_70_90 0x00800000
56#define HOSTAPD_CHAN_VHT_90_70 0x01000000
57#define HOSTAPD_CHAN_VHT_110_50 0x02000000
58#define HOSTAPD_CHAN_VHT_130_30 0x04000000
59#define HOSTAPD_CHAN_VHT_150_10 0x08000000
60
Hai Shalom74f70d42019-02-11 14:42:39 -080061/* Allowed bandwidth mask */
62enum hostapd_chan_width_attr {
63 HOSTAPD_CHAN_WIDTH_10 = BIT(0),
64 HOSTAPD_CHAN_WIDTH_20 = BIT(1),
65 HOSTAPD_CHAN_WIDTH_40P = BIT(2),
66 HOSTAPD_CHAN_WIDTH_40M = BIT(3),
67 HOSTAPD_CHAN_WIDTH_80 = BIT(4),
68 HOSTAPD_CHAN_WIDTH_160 = BIT(5),
69};
70
Dmitry Shmidt849734c2016-05-27 09:59:01 -070071/* Filter gratuitous ARP */
72#define WPA_DATA_FRAME_FILTER_FLAG_ARP BIT(0)
73/* Filter unsolicited Neighbor Advertisement */
74#define WPA_DATA_FRAME_FILTER_FLAG_NA BIT(1)
75/* Filter unicast IP packets encrypted using the GTK */
76#define WPA_DATA_FRAME_FILTER_FLAG_GTK BIT(2)
77
Dmitry Shmidtd2986c22017-10-23 14:22:09 -070078#define HOSTAPD_DFS_REGION_FCC 1
79#define HOSTAPD_DFS_REGION_ETSI 2
80#define HOSTAPD_DFS_REGION_JP 3
81
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080082/**
83 * enum reg_change_initiator - Regulatory change initiator
84 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -080085enum reg_change_initiator {
86 REGDOM_SET_BY_CORE,
87 REGDOM_SET_BY_USER,
88 REGDOM_SET_BY_DRIVER,
89 REGDOM_SET_BY_COUNTRY_IE,
Dmitry Shmidt97672262014-02-03 13:02:54 -080090 REGDOM_BEACON_HINT,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -080091};
92
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080093/**
94 * enum reg_type - Regulatory change types
95 */
Dmitry Shmidt7dba0e52014-04-14 10:49:15 -070096enum reg_type {
97 REGDOM_TYPE_UNKNOWN,
98 REGDOM_TYPE_COUNTRY,
99 REGDOM_TYPE_WORLD,
100 REGDOM_TYPE_CUSTOM_WORLD,
101 REGDOM_TYPE_INTERSECTION,
102};
103
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700104/**
Hai Shalom81f62d82019-07-22 12:10:00 -0700105 * struct hostapd_wmm_rule - WMM regulatory rule
106 * @min_cwmin: Lower bound of CW_min value
107 * @min_cwmax: Lower bound of CW_max value
108 * @min_aifs: Lower bound of AIFS value
109 * @max_txop: Upper bound of TXOP, value in units of 32 usec
110 */
111struct hostapd_wmm_rule {
112 int min_cwmin;
113 int min_cwmax;
114 int min_aifs;
115 int max_txop;
116};
117
118/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700119 * struct hostapd_channel_data - Channel information
120 */
121struct hostapd_channel_data {
122 /**
123 * chan - Channel number (IEEE 802.11)
124 */
125 short chan;
126
127 /**
128 * freq - Frequency in MHz
129 */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800130 int freq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700131
132 /**
133 * flag - Channel flags (HOSTAPD_CHAN_*)
134 */
135 int flag;
136
137 /**
Hai Shalom74f70d42019-02-11 14:42:39 -0800138 * allowed_bw - Allowed channel width bitmask
139 *
140 * See enum hostapd_chan_width_attr.
141 */
142 u32 allowed_bw;
143
144 /**
Dmitry Shmidt68d0e3e2013-10-28 17:59:21 -0700145 * max_tx_power - Regulatory transmit power limit in dBm
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700146 */
147 u8 max_tx_power;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700148
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800149 /**
150 * survey_list - Linked list of surveys (struct freq_survey)
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -0700151 */
152 struct dl_list survey_list;
153
154 /**
155 * min_nf - Minimum observed noise floor, in dBm, based on all
156 * surveyed channel data
157 */
158 s8 min_nf;
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700159
160#ifdef CONFIG_ACS
161 /**
162 * interference_factor - Computed interference factor on this
163 * channel (used internally in src/ap/acs.c; driver wrappers do not
164 * need to set this)
165 */
166 long double interference_factor;
167#endif /* CONFIG_ACS */
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700168
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800169 /**
170 * dfs_cac_ms - DFS CAC time in milliseconds
171 */
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700172 unsigned int dfs_cac_ms;
Hai Shalom81f62d82019-07-22 12:10:00 -0700173
174 /**
175 * wmm_rules_valid - Indicates wmm_rules state
176 */
177 int wmm_rules_valid;
178
179 /**
180 * wmm_rules - WMM regulatory rules
181 */
182 struct hostapd_wmm_rule wmm_rules[WMM_AC_NUM];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700183};
184
Hai Shalomfdcde762020-04-02 11:19:20 -0700185#define HE_MAC_CAPAB_0 0
Hai Shalom81f62d82019-07-22 12:10:00 -0700186#define HE_MAX_MAC_CAPAB_SIZE 6
187#define HE_MAX_PHY_CAPAB_SIZE 11
188#define HE_MAX_MCS_CAPAB_SIZE 12
189#define HE_MAX_PPET_CAPAB_SIZE 25
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800190
191/**
192 * struct he_capabilities - IEEE 802.11ax HE capabilities
193 */
194struct he_capabilities {
195 u8 he_supported;
Hai Shalom81f62d82019-07-22 12:10:00 -0700196 u8 phy_cap[HE_MAX_PHY_CAPAB_SIZE];
197 u8 mac_cap[HE_MAX_MAC_CAPAB_SIZE];
198 u8 mcs[HE_MAX_MCS_CAPAB_SIZE];
199 u8 ppet[HE_MAX_PPET_CAPAB_SIZE];
Hai Shalom899fcc72020-10-19 14:38:18 -0700200 u16 he_6ghz_capa;
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800201};
202
Sunil Ravia04bd252022-05-02 22:54:18 -0700203/* struct eht_capabilities - IEEE 802.11be EHT capabilities */
204struct eht_capabilities {
205 bool eht_supported;
206 u16 mac_cap;
207 u8 phy_cap[EHT_PHY_CAPAB_LEN];
208 u8 mcs[EHT_MCS_NSS_CAPAB_LEN];
209 u8 ppet[EHT_PPE_THRESH_CAPAB_LEN];
210};
211
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800212#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
Dmitry Shmidtc2ebb4b2013-07-24 12:57:51 -0700213#define HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN BIT(1)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800214
Hai Shalom81f62d82019-07-22 12:10:00 -0700215
216enum ieee80211_op_mode {
217 IEEE80211_MODE_INFRA = 0,
218 IEEE80211_MODE_IBSS = 1,
219 IEEE80211_MODE_AP = 2,
220 IEEE80211_MODE_MESH = 5,
221
222 /* only add new entries before IEEE80211_MODE_NUM */
223 IEEE80211_MODE_NUM
224};
225
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700226/**
Hai Shalomc3565922019-10-28 11:58:20 -0700227 * struct ieee80211_edmg_config - EDMG configuration
228 *
229 * This structure describes most essential parameters needed
230 * for IEEE 802.11ay EDMG configuration
231 *
232 * @channels: Bitmap that indicates the 2.16 GHz channel(s)
233 * that are allowed to be used for transmissions.
234 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
235 * Set to 0 to indicate EDMG not supported.
236 * @bw_config: Channel BW Configuration subfield encodes
237 * the allowed channel bandwidth configurations
238 */
239struct ieee80211_edmg_config {
240 u8 channels;
241 enum edmg_bw_config bw_config;
242};
243
244/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700245 * struct hostapd_hw_modes - Supported hardware mode information
246 */
247struct hostapd_hw_modes {
248 /**
249 * mode - Hardware mode
250 */
251 enum hostapd_hw_mode mode;
252
253 /**
254 * num_channels - Number of entries in the channels array
255 */
256 int num_channels;
257
258 /**
259 * channels - Array of supported channels
260 */
261 struct hostapd_channel_data *channels;
262
263 /**
264 * num_rates - Number of entries in the rates array
265 */
266 int num_rates;
267
268 /**
269 * rates - Array of supported rates in 100 kbps units
270 */
271 int *rates;
272
273 /**
274 * ht_capab - HT (IEEE 802.11n) capabilities
275 */
276 u16 ht_capab;
277
278 /**
279 * mcs_set - MCS (IEEE 802.11n) rate parameters
280 */
281 u8 mcs_set[16];
282
283 /**
284 * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
285 */
286 u8 a_mpdu_params;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800287
Dmitry Shmidt04949592012-07-19 12:16:46 -0700288 /**
289 * vht_capab - VHT (IEEE 802.11ac) capabilities
290 */
291 u32 vht_capab;
292
293 /**
294 * vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
295 */
296 u8 vht_mcs_set[8];
297
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800298 unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800299
300 /**
301 * he_capab - HE (IEEE 802.11ax) capabilities
302 */
Hai Shalom81f62d82019-07-22 12:10:00 -0700303 struct he_capabilities he_capab[IEEE80211_MODE_NUM];
Hai Shalomc3565922019-10-28 11:58:20 -0700304
305 /**
306 * This structure describes the most essential parameters needed
307 * for IEEE 802.11ay EDMG configuration.
308 */
309 struct ieee80211_edmg_config edmg;
Sunil Ravia04bd252022-05-02 22:54:18 -0700310
311 /**
312 * eht_capab - EHT (IEEE 802.11be) capabilities
313 */
314 struct eht_capabilities eht_capab[IEEE80211_MODE_NUM];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700315};
316
317
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700318#define IEEE80211_CAP_ESS 0x0001
319#define IEEE80211_CAP_IBSS 0x0002
320#define IEEE80211_CAP_PRIVACY 0x0010
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800321#define IEEE80211_CAP_RRM 0x1000
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700322
Dmitry Shmidtf8623282013-02-20 14:34:59 -0800323/* DMG (60 GHz) IEEE 802.11ad */
324/* type - bits 0..1 */
325#define IEEE80211_CAP_DMG_MASK 0x0003
326#define IEEE80211_CAP_DMG_IBSS 0x0001 /* Tx by: STA */
327#define IEEE80211_CAP_DMG_PBSS 0x0002 /* Tx by: PCP */
328#define IEEE80211_CAP_DMG_AP 0x0003 /* Tx by: AP */
329
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700330#define WPA_SCAN_QUAL_INVALID BIT(0)
331#define WPA_SCAN_NOISE_INVALID BIT(1)
332#define WPA_SCAN_LEVEL_INVALID BIT(2)
333#define WPA_SCAN_LEVEL_DBM BIT(3)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700334#define WPA_SCAN_ASSOCIATED BIT(5)
335
336/**
337 * struct wpa_scan_res - Scan result for an BSS/IBSS
338 * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
339 * @bssid: BSSID
340 * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
341 * @beacon_int: beacon interval in TUs (host byte order)
342 * @caps: capability information field in host byte order
343 * @qual: signal quality
344 * @noise: noise level
345 * @level: signal level
346 * @tsf: Timestamp
347 * @age: Age of the information in milliseconds (i.e., how many milliseconds
348 * ago the last Beacon or Probe Response frame was received)
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800349 * @est_throughput: Estimated throughput in kbps (this is calculated during
350 * scan result processing if left zero by the driver wrapper)
351 * @snr: Signal-to-noise ratio in dB (calculated during scan result processing)
Dmitry Shmidt29333592017-01-09 12:27:11 -0800352 * @parent_tsf: Time when the Beacon/Probe Response frame was received in terms
353 * of TSF of the BSS specified by %tsf_bssid.
354 * @tsf_bssid: The BSS that %parent_tsf TSF time refers to.
Sunil Ravia04bd252022-05-02 22:54:18 -0700355 * @beacon_newer: Whether the Beacon frame data is known to be newer
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700356 * @ie_len: length of the following IE field in octets
357 * @beacon_ie_len: length of the following Beacon IE field in octets
358 *
359 * This structure is used as a generic format for scan results from the
360 * driver. Each driver interface implementation is responsible for converting
361 * the driver or OS specific scan results into this format.
362 *
363 * If the driver does not support reporting all IEs, the IE data structure is
364 * constructed of the IEs that are available. This field will also need to
365 * include SSID in IE format. All drivers are encouraged to be extended to
366 * report all IEs to make it easier to support future additions.
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800367 *
368 * This structure data is followed by ie_len octets of IEs from Probe Response
369 * frame (or if the driver does not indicate source of IEs, these may also be
370 * from Beacon frame). After the first set of IEs, another set of IEs may follow
371 * (with beacon_ie_len octets of data) if the driver provides both IE sets.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700372 */
373struct wpa_scan_res {
374 unsigned int flags;
375 u8 bssid[ETH_ALEN];
376 int freq;
377 u16 beacon_int;
378 u16 caps;
379 int qual;
380 int noise;
381 int level;
382 u64 tsf;
383 unsigned int age;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800384 unsigned int est_throughput;
385 int snr;
Dmitry Shmidt29333592017-01-09 12:27:11 -0800386 u64 parent_tsf;
387 u8 tsf_bssid[ETH_ALEN];
Sunil Ravia04bd252022-05-02 22:54:18 -0700388 bool beacon_newer;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700389 size_t ie_len;
390 size_t beacon_ie_len;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800391 /* Followed by ie_len + beacon_ie_len octets of IE data */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700392};
393
394/**
395 * struct wpa_scan_results - Scan results
396 * @res: Array of pointers to allocated variable length scan result entries
397 * @num: Number of entries in the scan result array
Dmitry Shmidtf8623282013-02-20 14:34:59 -0800398 * @fetch_time: Time when the results were fetched from the driver
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700399 */
400struct wpa_scan_results {
401 struct wpa_scan_res **res;
402 size_t num;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800403 struct os_reltime fetch_time;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700404};
405
406/**
407 * struct wpa_interface_info - Network interface information
408 * @next: Pointer to the next interface or NULL if this is the last one
409 * @ifname: Interface name that can be used with init() or init2()
410 * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
411 * not available
412 * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
413 * is not an allocated copy, i.e., get_interfaces() caller will not free
414 * this)
415 */
416struct wpa_interface_info {
417 struct wpa_interface_info *next;
418 char *ifname;
419 char *desc;
420 const char *drv_name;
421};
422
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800423#define WPAS_MAX_SCAN_SSIDS 16
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700424
425/**
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800426 * struct wpa_driver_scan_ssid - SSIDs to scan for
427 * @ssid - specific SSID to scan for (ProbeReq)
428 * %NULL or zero-length SSID is used to indicate active scan
429 * with wildcard SSID.
430 * @ssid_len - Length of the SSID in octets
431 */
432struct wpa_driver_scan_ssid {
433 const u8 *ssid;
434 size_t ssid_len;
435};
436
437/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700438 * struct wpa_driver_scan_params - Scan parameters
439 * Data for struct wpa_driver_ops::scan2().
440 */
441struct wpa_driver_scan_params {
442 /**
443 * ssids - SSIDs to scan for
444 */
Dmitry Shmidtb97e4282016-02-08 10:16:07 -0800445 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700446
447 /**
448 * num_ssids - Number of entries in ssids array
449 * Zero indicates a request for a passive scan.
450 */
451 size_t num_ssids;
452
453 /**
454 * extra_ies - Extra IE(s) to add into Probe Request or %NULL
455 */
456 const u8 *extra_ies;
457
458 /**
459 * extra_ies_len - Length of extra_ies in octets
460 */
461 size_t extra_ies_len;
462
463 /**
464 * freqs - Array of frequencies to scan or %NULL for all frequencies
465 *
466 * The frequency is set in MHz. The array is zero-terminated.
467 */
468 int *freqs;
469
470 /**
471 * filter_ssids - Filter for reporting SSIDs
472 *
473 * This optional parameter can be used to request the driver wrapper to
474 * filter scan results to include only the specified SSIDs. %NULL
475 * indicates that no filtering is to be done. This can be used to
476 * reduce memory needs for scan results in environments that have large
477 * number of APs with different SSIDs.
478 *
479 * The driver wrapper is allowed to take this allocated buffer into its
480 * own use by setting the pointer to %NULL. In that case, the driver
481 * wrapper is responsible for freeing the buffer with os_free() once it
482 * is not needed anymore.
483 */
484 struct wpa_driver_scan_filter {
Dmitry Shmidt9d9e6022015-04-23 10:34:55 -0700485 u8 ssid[SSID_MAX_LEN];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700486 size_t ssid_len;
487 } *filter_ssids;
488
489 /**
490 * num_filter_ssids - Number of entries in filter_ssids array
491 */
492 size_t num_filter_ssids;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800493
494 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700495 * filter_rssi - Filter by RSSI
496 *
497 * The driver may filter scan results in firmware to reduce host
498 * wakeups and thereby save power. Specify the RSSI threshold in s32
499 * dBm.
500 */
501 s32 filter_rssi;
502
503 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800504 * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
505 *
506 * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
507 * Mbps from the support rates element(s) in the Probe Request frames
508 * and not to transmit the frames at any of those rates.
509 */
Dmitry Shmidt2271d3f2014-06-23 12:16:31 -0700510 unsigned int p2p_probe:1;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800511
512 /**
513 * only_new_results - Request driver to report only new results
514 *
515 * This is used to request the driver to report only BSSes that have
516 * been detected after this scan request has been started, i.e., to
517 * flush old cached BSS entries.
518 */
Dmitry Shmidt2271d3f2014-06-23 12:16:31 -0700519 unsigned int only_new_results:1;
520
521 /**
522 * low_priority - Requests driver to use a lower scan priority
523 *
524 * This is used to request the driver to use a lower scan priority
525 * if it supports such a thing.
526 */
527 unsigned int low_priority:1;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800528
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800529 /**
530 * mac_addr_rand - Requests driver to randomize MAC address
531 */
532 unsigned int mac_addr_rand:1;
533
534 /**
535 * mac_addr - MAC address used with randomization. The address cannot be
536 * a multicast one, i.e., bit 0 of byte 0 should not be set.
537 */
Hai Shalomc3565922019-10-28 11:58:20 -0700538 u8 *mac_addr;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800539
540 /**
541 * mac_addr_mask - MAC address mask used with randomization.
542 *
543 * Bits that are 0 in the mask should be randomized. Bits that are 1 in
544 * the mask should be taken as is from mac_addr. The mask should not
545 * allow the generation of a multicast address, i.e., bit 0 of byte 0
546 * must be set.
547 */
548 const u8 *mac_addr_mask;
549
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -0800550 /**
551 * sched_scan_plans - Scan plans for scheduled scan
552 *
553 * Each scan plan consists of the number of iterations to scan and the
554 * interval between scans. When a scan plan finishes (i.e., it was run
555 * for the specified number of iterations), the next scan plan is
556 * executed. The scan plans are executed in the order they appear in
557 * the array (lower index first). The last scan plan will run infinitely
558 * (until requested to stop), thus must not specify the number of
559 * iterations. All other scan plans must specify the number of
560 * iterations.
561 */
562 struct sched_scan_plan {
563 u32 interval; /* In seconds */
564 u32 iterations; /* Zero to run infinitely */
565 } *sched_scan_plans;
566
567 /**
568 * sched_scan_plans_num - Number of scan plans in sched_scan_plans array
569 */
570 unsigned int sched_scan_plans_num;
571
Dmitry Shmidt9c175262016-03-03 10:20:07 -0800572 /**
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700573 * sched_scan_start_delay - Delay to use before starting the first scan
574 *
575 * Delay (in seconds) before scheduling first scan plan cycle. The
576 * driver may ignore this parameter and start immediately (or at any
577 * other time), if this feature is not supported.
578 */
579 u32 sched_scan_start_delay;
580
581 /**
Dmitry Shmidt9c175262016-03-03 10:20:07 -0800582 * bssid - Specific BSSID to scan for
583 *
584 * This optional parameter can be used to replace the default wildcard
585 * BSSID with a specific BSSID to scan for if results are needed from
586 * only a single BSS.
587 */
588 const u8 *bssid;
589
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800590 /**
591 * scan_cookie - Unique identification representing the scan request
592 *
593 * This scan_cookie carries a unique identification representing the
594 * scan request if the host driver/kernel supports concurrent scan
595 * requests. This cookie is returned from the corresponding driver
596 * interface.
597 *
598 * Note: Unlike other parameters in this structure, scan_cookie is used
599 * only to return information instead of setting parameters for the
600 * scan.
601 */
602 u64 scan_cookie;
603
Dmitry Shmidt29333592017-01-09 12:27:11 -0800604 /**
605 * duration - Dwell time on each channel
606 *
607 * This optional parameter can be used to set the dwell time on each
608 * channel. In TUs.
609 */
610 u16 duration;
611
612 /**
613 * duration_mandatory - Whether the specified duration is mandatory
614 *
615 * If this is set, the duration specified by the %duration field is
616 * mandatory (and the driver should reject the scan request if it is
617 * unable to comply with the specified duration), otherwise it is the
618 * maximum duration and the actual duration may be shorter.
619 */
620 unsigned int duration_mandatory:1;
621
Dmitry Shmidtebd93af2017-02-21 13:40:44 -0800622 /**
623 * relative_rssi_set - Whether relative RSSI parameters are set
624 */
625 unsigned int relative_rssi_set:1;
626
627 /**
628 * relative_rssi - Relative RSSI for reporting better BSSs
629 *
630 * Amount of RSSI by which a BSS should be better than the current
631 * connected BSS to report the new BSS to user space.
632 */
633 s8 relative_rssi;
634
635 /**
636 * relative_adjust_band - Band to which RSSI should be adjusted
637 *
638 * The relative_adjust_rssi should be added to the band specified
639 * by relative_adjust_band.
640 */
641 enum set_band relative_adjust_band;
642
643 /**
644 * relative_adjust_rssi - RSSI to be added to relative_adjust_band
645 *
646 * An amount of relative_band_rssi should be added to the BSSs that
647 * belong to the band specified by relative_adjust_band while comparing
648 * with other bands for BSS reporting.
649 */
650 s8 relative_adjust_rssi;
651
Hai Shalomce48b4a2018-09-05 11:41:35 -0700652 /**
653 * oce_scan
654 *
655 * Enable the following OCE scan features: (WFA OCE TechSpec v1.0)
656 * - Accept broadcast Probe Response frame.
657 * - Probe Request frame deferral and suppression.
658 * - Max Channel Time - driver fills FILS request params IE with
659 * Maximum Channel Time.
660 * - Send 1st Probe Request frame in rate of minimum 5.5 Mbps.
661 */
662 unsigned int oce_scan:1;
663
Hai Shalomc1a21442022-02-04 13:43:00 -0800664 /**
665 * p2p_include_6ghz - Include 6 GHz channels for P2P full scan
666 *
667 */
668 unsigned int p2p_include_6ghz:1;
669
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800670 /*
671 * NOTE: Whenever adding new parameters here, please make sure
672 * wpa_scan_clone_params() and wpa_scan_free_params() get updated with
673 * matching changes.
674 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700675};
676
677/**
678 * struct wpa_driver_auth_params - Authentication parameters
679 * Data for struct wpa_driver_ops::authenticate().
680 */
681struct wpa_driver_auth_params {
682 int freq;
683 const u8 *bssid;
684 const u8 *ssid;
685 size_t ssid_len;
686 int auth_alg;
687 const u8 *ie;
688 size_t ie_len;
689 const u8 *wep_key[4];
690 size_t wep_key_len[4];
691 int wep_tx_keyidx;
692 int local_state_change;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800693
694 /**
695 * p2p - Whether this connection is a P2P group
696 */
697 int p2p;
698
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800699 /**
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800700 * auth_data - Additional elements for Authentication frame
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800701 *
702 * This buffer starts with the Authentication transaction sequence
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800703 * number field. If no special handling of such elements is needed, this
704 * pointer is %NULL. This is used with SAE and FILS.
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800705 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800706 const u8 *auth_data;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800707
708 /**
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800709 * auth_data_len - Length of auth_data buffer in octets
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800710 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -0800711 size_t auth_data_len;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700712};
713
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800714/**
715 * enum wps_mode - WPS mode
716 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700717enum wps_mode {
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800718 /**
719 * WPS_MODE_NONE - No WPS provisioning being used
720 */
721 WPS_MODE_NONE,
722
723 /**
724 * WPS_MODE_OPEN - WPS provisioning with AP that is in open mode
725 */
726 WPS_MODE_OPEN,
727
728 /**
729 * WPS_MODE_PRIVACY - WPS provisioning with AP that is using protection
730 */
731 WPS_MODE_PRIVACY
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700732};
733
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800734/**
735 * struct hostapd_freq_params - Channel parameters
736 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700737struct hostapd_freq_params {
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800738 /**
739 * mode - Mode/band (HOSTAPD_MODE_IEEE80211A, ..)
740 */
741 enum hostapd_hw_mode mode;
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700742
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800743 /**
744 * freq - Primary channel center frequency in MHz
745 */
746 int freq;
747
748 /**
749 * channel - Channel number
750 */
751 int channel;
752
753 /**
754 * ht_enabled - Whether HT is enabled
755 */
756 int ht_enabled;
757
758 /**
759 * sec_channel_offset - Secondary channel offset for HT40
760 *
761 * 0 = HT40 disabled,
762 * -1 = HT40 enabled, secondary channel below primary,
763 * 1 = HT40 enabled, secondary channel above primary
764 */
765 int sec_channel_offset;
766
767 /**
768 * vht_enabled - Whether VHT is enabled
769 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700770 int vht_enabled;
771
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800772 /**
Hai Shalom81f62d82019-07-22 12:10:00 -0700773 * he_enabled - Whether HE is enabled
774 */
775 int he_enabled;
776
777 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800778 * center_freq1 - Segment 0 center frequency in MHz
779 *
780 * Valid for both HT and VHT.
781 */
782 int center_freq1;
783
784 /**
785 * center_freq2 - Segment 1 center frequency in MHz
786 *
787 * Non-zero only for bandwidth 80 and an 80+80 channel
788 */
789 int center_freq2;
790
791 /**
792 * bandwidth - Channel bandwidth in MHz (20, 40, 80, 160)
793 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700794 int bandwidth;
Hai Shalomc3565922019-10-28 11:58:20 -0700795
796 /**
797 * This structure describes the most essential parameters needed
798 * for IEEE 802.11ay EDMG configuration.
799 */
800 struct ieee80211_edmg_config edmg;
Sunil Ravia04bd252022-05-02 22:54:18 -0700801
802 /**
803 * radar_background - Whether radar/CAC background is requested
804 */
805 bool radar_background;
806
807 /**
808 * eht_enabled - Whether EHT is enabled
809 */
810 bool eht_enabled;
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700811};
812
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700813/**
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700814 * struct wpa_driver_sta_auth_params - Authentication parameters
815 * Data for struct wpa_driver_ops::sta_auth().
816 */
817struct wpa_driver_sta_auth_params {
818
819 /**
820 * own_addr - Source address and BSSID for authentication frame
821 */
822 const u8 *own_addr;
823
824 /**
825 * addr - MAC address of the station to associate
826 */
827 const u8 *addr;
828
829 /**
830 * seq - authentication sequence number
831 */
832 u16 seq;
833
834 /**
835 * status - authentication response status code
836 */
837 u16 status;
838
839 /**
840 * ie - authentication frame ie buffer
841 */
842 const u8 *ie;
843
844 /**
845 * len - ie buffer length
846 */
847 size_t len;
848
849 /**
850 * fils_auth - Indicates whether FILS authentication is being performed
851 */
852 int fils_auth;
853
854 /**
855 * fils_anonce - ANonce (required for FILS)
856 */
857 u8 fils_anonce[WPA_NONCE_LEN];
858
859 /**
860 * fils_snonce - SNonce (required for FILS)
861 */
862 u8 fils_snonce[WPA_NONCE_LEN];
863
864 /**
865 * fils_kek - key for encryption (required for FILS)
866 */
867 u8 fils_kek[WPA_KEK_MAX_LEN];
868
869 /**
870 * fils_kek_len - Length of the fils_kek in octets (required for FILS)
871 */
872 size_t fils_kek_len;
873};
874
875/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700876 * struct wpa_driver_associate_params - Association parameters
877 * Data for struct wpa_driver_ops::associate().
878 */
879struct wpa_driver_associate_params {
880 /**
881 * bssid - BSSID of the selected AP
882 * This can be %NULL, if ap_scan=2 mode is used and the driver is
883 * responsible for selecting with which BSS to associate. */
884 const u8 *bssid;
885
886 /**
Dmitry Shmidt96be6222014-02-13 10:16:51 -0800887 * bssid_hint - BSSID of a proposed AP
888 *
889 * This indicates which BSS has been found a suitable candidate for
890 * initial association for drivers that use driver/firmwate-based BSS
891 * selection. Unlike the @bssid parameter, @bssid_hint does not limit
892 * the driver from selecting other BSSes in the ESS.
893 */
894 const u8 *bssid_hint;
895
896 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700897 * ssid - The selected SSID
898 */
899 const u8 *ssid;
900
901 /**
902 * ssid_len - Length of the SSID (1..32)
903 */
904 size_t ssid_len;
905
906 /**
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700907 * freq - channel parameters
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700908 */
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -0700909 struct hostapd_freq_params freq;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700910
911 /**
Dmitry Shmidt96be6222014-02-13 10:16:51 -0800912 * freq_hint - Frequency of the channel the proposed AP is using
913 *
914 * This provides a channel on which a suitable BSS has been found as a
915 * hint for the driver. Unlike the @freq parameter, @freq_hint does not
916 * limit the driver from selecting other channels for
917 * driver/firmware-based BSS selection.
918 */
919 int freq_hint;
920
921 /**
Dmitry Shmidt04949592012-07-19 12:16:46 -0700922 * bg_scan_period - Background scan period in seconds, 0 to disable
923 * background scan, or -1 to indicate no change to default driver
924 * configuration
925 */
926 int bg_scan_period;
927
928 /**
Dmitry Shmidt2ac5f602014-03-07 10:08:21 -0800929 * beacon_int - Beacon interval for IBSS or 0 to use driver default
930 */
931 int beacon_int;
932
933 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700934 * wpa_ie - WPA information element for (Re)Association Request
935 * WPA information element to be included in (Re)Association
936 * Request (including information element id and length). Use
937 * of this WPA IE is optional. If the driver generates the WPA
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700938 * IE, it can use pairwise_suite, group_suite, group_mgmt_suite, and
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700939 * key_mgmt_suite to select proper algorithms. In this case,
940 * the driver has to notify wpa_supplicant about the used WPA
941 * IE by generating an event that the interface code will
942 * convert into EVENT_ASSOCINFO data (see below).
943 *
944 * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
945 * instead. The driver can determine which version is used by
946 * looking at the first byte of the IE (0xdd for WPA, 0x30 for
947 * WPA2/RSN).
948 *
949 * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
950 */
951 const u8 *wpa_ie;
952
953 /**
954 * wpa_ie_len - length of the wpa_ie
955 */
956 size_t wpa_ie_len;
957
958 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800959 * wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
960 */
961 unsigned int wpa_proto;
962
963 /**
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800964 * pairwise_suite - Selected pairwise cipher suite (WPA_CIPHER_*)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700965 *
966 * This is usually ignored if @wpa_ie is used.
967 */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800968 unsigned int pairwise_suite;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700969
970 /**
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800971 * group_suite - Selected group cipher suite (WPA_CIPHER_*)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700972 *
973 * This is usually ignored if @wpa_ie is used.
974 */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800975 unsigned int group_suite;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700976
977 /**
Dmitry Shmidtd2986c22017-10-23 14:22:09 -0700978 * mgmt_group_suite - Selected group management cipher suite (WPA_CIPHER_*)
979 *
980 * This is usually ignored if @wpa_ie is used.
981 */
982 unsigned int mgmt_group_suite;
983
984 /**
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800985 * key_mgmt_suite - Selected key management suite (WPA_KEY_MGMT_*)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700986 *
987 * This is usually ignored if @wpa_ie is used.
988 */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800989 unsigned int key_mgmt_suite;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700990
991 /**
992 * auth_alg - Allowed authentication algorithms
993 * Bit field of WPA_AUTH_ALG_*
994 */
995 int auth_alg;
996
997 /**
998 * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
999 */
1000 int mode;
1001
1002 /**
1003 * wep_key - WEP keys for static WEP configuration
1004 */
1005 const u8 *wep_key[4];
1006
1007 /**
1008 * wep_key_len - WEP key length for static WEP configuration
1009 */
1010 size_t wep_key_len[4];
1011
1012 /**
1013 * wep_tx_keyidx - WEP TX key index for static WEP configuration
1014 */
1015 int wep_tx_keyidx;
1016
1017 /**
1018 * mgmt_frame_protection - IEEE 802.11w management frame protection
1019 */
1020 enum mfp_options mgmt_frame_protection;
1021
1022 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001023 * passphrase - RSN passphrase for PSK
1024 *
1025 * This value is made available only for WPA/WPA2-Personal (PSK) and
Hai Shalom74f70d42019-02-11 14:42:39 -08001026 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK. This
1027 * is the 8..63 character ASCII passphrase, if available. Please note
1028 * that this can be %NULL if passphrase was not used to generate the
1029 * PSK. In that case, the psk field must be used to fetch the PSK.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001030 */
1031 const char *passphrase;
1032
1033 /**
1034 * psk - RSN PSK (alternative for passphrase for PSK)
1035 *
1036 * This value is made available only for WPA/WPA2-Personal (PSK) and
Hai Shalom74f70d42019-02-11 14:42:39 -08001037 * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK. This
1038 * is the 32-octet (256-bit) PSK, if available. The driver wrapper
1039 * should be prepared to handle %NULL value as an error.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001040 */
1041 const u8 *psk;
1042
1043 /**
1044 * drop_unencrypted - Enable/disable unencrypted frame filtering
1045 *
1046 * Configure the driver to drop all non-EAPOL frames (both receive and
1047 * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
1048 * still be allowed for key negotiation.
1049 */
1050 int drop_unencrypted;
1051
1052 /**
1053 * prev_bssid - Previously used BSSID in this ESS
1054 *
1055 * When not %NULL, this is a request to use reassociation instead of
1056 * association.
1057 */
1058 const u8 *prev_bssid;
1059
1060 /**
1061 * wps - WPS mode
1062 *
1063 * If the driver needs to do special configuration for WPS association,
1064 * this variable provides more information on what type of association
Sunil Ravia04bd252022-05-02 22:54:18 -07001065 * is being requested. Most drivers should not need to use this.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001066 */
1067 enum wps_mode wps;
1068
1069 /**
1070 * p2p - Whether this connection is a P2P group
1071 */
1072 int p2p;
1073
1074 /**
1075 * uapsd - UAPSD parameters for the network
1076 * -1 = do not change defaults
1077 * AP mode: 1 = enabled, 0 = disabled
1078 * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
1079 */
1080 int uapsd;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08001081
1082 /**
1083 * fixed_bssid - Whether to force this BSSID in IBSS mode
1084 * 1 = Fix this BSSID and prevent merges.
1085 * 0 = Do not fix BSSID.
1086 */
1087 int fixed_bssid;
1088
1089 /**
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001090 * fixed_freq - Fix control channel in IBSS mode
1091 * 0 = don't fix control channel (default)
1092 * 1 = fix control channel; this prevents IBSS merging with another
1093 * channel
1094 */
1095 int fixed_freq;
1096
1097 /**
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08001098 * disable_ht - Disable HT (IEEE 802.11n) for this connection
1099 */
1100 int disable_ht;
1101
1102 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001103 * htcaps - HT Capabilities over-rides
1104 *
1105 * Only bits set in the mask will be used, and not all values are used
1106 * by the kernel anyway. Currently, MCS, MPDU and MSDU fields are used.
1107 *
1108 * Pointer to struct ieee80211_ht_capabilities.
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08001109 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001110 const u8 *htcaps;
1111
1112 /**
1113 * htcaps_mask - HT Capabilities over-rides mask
1114 *
1115 * Pointer to struct ieee80211_ht_capabilities.
1116 */
1117 const u8 *htcaps_mask;
Dmitry Shmidt2f023192013-03-12 12:44:17 -07001118
1119#ifdef CONFIG_VHT_OVERRIDES
1120 /**
1121 * disable_vht - Disable VHT for this connection
1122 */
1123 int disable_vht;
1124
1125 /**
1126 * VHT capability overrides.
1127 */
1128 const struct ieee80211_vht_capabilities *vhtcaps;
1129 const struct ieee80211_vht_capabilities *vhtcaps_mask;
1130#endif /* CONFIG_VHT_OVERRIDES */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001131
Hai Shalomfdcde762020-04-02 11:19:20 -07001132#ifdef CONFIG_HE_OVERRIDES
1133 /**
1134 * disable_he - Disable HE for this connection
1135 */
1136 int disable_he;
1137#endif /* CONFIG_HE_OVERRIDES */
1138
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001139 /**
1140 * req_key_mgmt_offload - Request key management offload for connection
1141 *
1142 * Request key management offload for this connection if the device
1143 * supports it.
1144 */
1145 int req_key_mgmt_offload;
1146
1147 /**
Hai Shalomc3565922019-10-28 11:58:20 -07001148 * req_handshake_offload - Request EAPOL handshake offload
1149 *
1150 * Request EAPOL handshake offload for this connection if the device
1151 * supports it.
1152 */
1153 int req_handshake_offload;
1154
1155 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001156 * Flag for indicating whether this association includes support for
1157 * RRM (Radio Resource Measurements)
1158 */
1159 int rrm_used;
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08001160
1161 /**
1162 * pbss - If set, connect to a PCP in a PBSS. Otherwise, connect to an
1163 * AP as usual. Valid for DMG network only.
1164 */
1165 int pbss;
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08001166
1167 /**
1168 * fils_kek - KEK for FILS association frame protection (AES-SIV)
1169 */
1170 const u8 *fils_kek;
1171
1172 /**
1173 * fils_kek_len: Length of fils_kek in bytes
1174 */
1175 size_t fils_kek_len;
1176
1177 /**
1178 * fils_nonces - Nonces for FILS association frame protection
1179 * (AES-SIV AAD)
1180 */
1181 const u8 *fils_nonces;
1182
1183 /**
1184 * fils_nonces_len: Length of fils_nonce in bytes
1185 */
1186 size_t fils_nonces_len;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001187
1188 /**
1189 * fils_erp_username - Username part of keyName-NAI
1190 */
1191 const u8 *fils_erp_username;
1192
1193 /**
1194 * fils_erp_username_len - Length of fils_erp_username in bytes
1195 */
1196 size_t fils_erp_username_len;
1197
1198 /**
1199 * fils_erp_realm - Realm/domain name to use in FILS ERP
1200 */
1201 const u8 *fils_erp_realm;
1202
1203 /**
1204 * fils_erp_realm_len - Length of fils_erp_realm in bytes
1205 */
1206 size_t fils_erp_realm_len;
1207
1208 /**
1209 * fils_erp_next_seq_num - The next sequence number to use in FILS ERP
1210 * messages
1211 */
1212 u16 fils_erp_next_seq_num;
1213
1214 /**
1215 * fils_erp_rrk - Re-authentication root key (rRK) for the keyName-NAI
1216 * specified by fils_erp_username@fils_erp_realm.
1217 */
1218 const u8 *fils_erp_rrk;
1219
1220 /**
1221 * fils_erp_rrk_len - Length of fils_erp_rrk in bytes
1222 */
1223 size_t fils_erp_rrk_len;
Hai Shalom60840252021-02-19 19:02:11 -08001224
1225 /**
1226 * sae_pwe - SAE mechanism for PWE derivation
1227 * 0 = hunting-and-pecking loop only
1228 * 1 = hash-to-element only
1229 * 2 = both hunting-and-pecking loop and hash-to-element enabled
1230 */
1231 int sae_pwe;
Vinayak Yadawade62409f2022-01-20 12:32:07 +05301232#ifdef CONFIG_DRIVER_NL80211_BRCM
1233 /**
1234 * td_policy - Transition Disable Policy
1235 */
1236 u32 td_policy;
1237#endif /* CONFIG_DRIVER_NL80211_BRCM */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001238};
1239
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001240enum hide_ssid {
1241 NO_SSID_HIDING,
1242 HIDDEN_SSID_ZERO_LEN,
1243 HIDDEN_SSID_ZERO_CONTENTS
1244};
1245
Hai Shalom81f62d82019-07-22 12:10:00 -07001246enum ch_switch_state {
1247 CH_SW_STARTED,
1248 CH_SW_FINISHED
1249};
1250
Dmitry Shmidtb58836e2014-04-29 14:35:56 -07001251struct wowlan_triggers {
1252 u8 any;
1253 u8 disconnect;
1254 u8 magic_pkt;
1255 u8 gtk_rekey_failure;
1256 u8 eap_identity_req;
1257 u8 four_way_handshake;
1258 u8 rfkill_release;
1259};
1260
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001261struct wpa_driver_ap_params {
1262 /**
1263 * head - Beacon head from IEEE 802.11 header to IEs before TIM IE
1264 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08001265 u8 *head;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001266
1267 /**
1268 * head_len - Length of the head buffer in octets
1269 */
1270 size_t head_len;
1271
1272 /**
1273 * tail - Beacon tail following TIM IE
1274 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08001275 u8 *tail;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001276
1277 /**
1278 * tail_len - Length of the tail buffer in octets
1279 */
1280 size_t tail_len;
1281
1282 /**
1283 * dtim_period - DTIM period
1284 */
1285 int dtim_period;
1286
1287 /**
1288 * beacon_int - Beacon interval
1289 */
1290 int beacon_int;
1291
1292 /**
1293 * basic_rates: -1 terminated array of basic rates in 100 kbps
1294 *
1295 * This parameter can be used to set a specific basic rate set for the
1296 * BSS. If %NULL, default basic rate set is used.
1297 */
1298 int *basic_rates;
1299
1300 /**
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08001301 * beacon_rate: Beacon frame data rate
1302 *
1303 * This parameter can be used to set a specific Beacon frame data rate
1304 * for the BSS. The interpretation of this value depends on the
Hai Shalom60840252021-02-19 19:02:11 -08001305 * rate_type (legacy: in 100 kbps units, HT: HT-MCS, VHT: VHT-MCS,
1306 * HE: HE-MCS). If beacon_rate == 0 and rate_type == 0
1307 * (BEACON_RATE_LEGACY), the default Beacon frame data rate is used.
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08001308 */
1309 unsigned int beacon_rate;
1310
1311 /**
Hai Shalom60840252021-02-19 19:02:11 -08001312 * beacon_rate_type: Beacon data rate type (legacy/HT/VHT/HE)
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08001313 */
1314 enum beacon_rate_type rate_type;
1315
1316 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001317 * proberesp - Probe Response template
1318 *
1319 * This is used by drivers that reply to Probe Requests internally in
1320 * AP mode and require the full Probe Response template.
1321 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08001322 u8 *proberesp;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001323
1324 /**
1325 * proberesp_len - Length of the proberesp buffer in octets
1326 */
1327 size_t proberesp_len;
1328
1329 /**
1330 * ssid - The SSID to use in Beacon/Probe Response frames
1331 */
1332 const u8 *ssid;
1333
1334 /**
1335 * ssid_len - Length of the SSID (1..32)
1336 */
1337 size_t ssid_len;
1338
1339 /**
1340 * hide_ssid - Whether to hide the SSID
1341 */
1342 enum hide_ssid hide_ssid;
1343
1344 /**
1345 * pairwise_ciphers - WPA_CIPHER_* bitfield
1346 */
1347 unsigned int pairwise_ciphers;
1348
1349 /**
1350 * group_cipher - WPA_CIPHER_*
1351 */
1352 unsigned int group_cipher;
1353
1354 /**
1355 * key_mgmt_suites - WPA_KEY_MGMT_* bitfield
1356 */
1357 unsigned int key_mgmt_suites;
1358
1359 /**
1360 * auth_algs - WPA_AUTH_ALG_* bitfield
1361 */
1362 unsigned int auth_algs;
1363
1364 /**
1365 * wpa_version - WPA_PROTO_* bitfield
1366 */
1367 unsigned int wpa_version;
1368
1369 /**
1370 * privacy - Whether privacy is used in the BSS
1371 */
1372 int privacy;
1373
1374 /**
1375 * beacon_ies - WPS/P2P IE(s) for Beacon frames
1376 *
1377 * This is used to add IEs like WPS IE and P2P IE by drivers that do
1378 * not use the full Beacon template.
1379 */
1380 const struct wpabuf *beacon_ies;
1381
1382 /**
1383 * proberesp_ies - P2P/WPS IE(s) for Probe Response frames
1384 *
1385 * This is used to add IEs like WPS IE and P2P IE by drivers that
1386 * reply to Probe Request frames internally.
1387 */
1388 const struct wpabuf *proberesp_ies;
1389
1390 /**
1391 * assocresp_ies - WPS IE(s) for (Re)Association Response frames
1392 *
1393 * This is used to add IEs like WPS IE by drivers that reply to
1394 * (Re)Association Request frames internally.
1395 */
1396 const struct wpabuf *assocresp_ies;
1397
1398 /**
1399 * isolate - Whether to isolate frames between associated stations
1400 *
1401 * If this is non-zero, the AP is requested to disable forwarding of
1402 * frames between associated stations.
1403 */
1404 int isolate;
1405
1406 /**
1407 * cts_protect - Whether CTS protection is enabled
1408 */
1409 int cts_protect;
1410
1411 /**
1412 * preamble - Whether short preamble is enabled
1413 */
1414 int preamble;
1415
1416 /**
1417 * short_slot_time - Whether short slot time is enabled
1418 *
1419 * 0 = short slot time disable, 1 = short slot time enabled, -1 = do
1420 * not set (e.g., when 802.11g mode is not in use)
1421 */
1422 int short_slot_time;
1423
1424 /**
1425 * ht_opmode - HT operation mode or -1 if HT not in use
1426 */
1427 int ht_opmode;
1428
1429 /**
1430 * interworking - Whether Interworking is enabled
1431 */
1432 int interworking;
1433
1434 /**
1435 * hessid - Homogeneous ESS identifier or %NULL if not set
1436 */
1437 const u8 *hessid;
1438
1439 /**
1440 * access_network_type - Access Network Type (0..15)
1441 *
1442 * This is used for filtering Probe Request frames when Interworking is
1443 * enabled.
1444 */
1445 u8 access_network_type;
Dmitry Shmidt04949592012-07-19 12:16:46 -07001446
1447 /**
1448 * ap_max_inactivity - Timeout in seconds to detect STA's inactivity
1449 *
1450 * This is used by driver which advertises this capability.
1451 */
1452 int ap_max_inactivity;
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001453
1454 /**
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001455 * ctwindow - Client Traffic Window (in TUs)
1456 */
1457 u8 p2p_go_ctwindow;
1458
1459 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001460 * disable_dgaf - Whether group-addressed frames are disabled
1461 */
1462 int disable_dgaf;
Dmitry Shmidtf21452a2014-02-26 10:55:25 -08001463
1464 /**
1465 * osen - Whether OSEN security is enabled
1466 */
1467 int osen;
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07001468
1469 /**
1470 * freq - Channel parameters for dynamic bandwidth changes
1471 */
1472 struct hostapd_freq_params *freq;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001473
1474 /**
1475 * reenable - Whether this is to re-enable beaconing
1476 */
1477 int reenable;
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08001478
1479 /**
1480 * pbss - Whether to start a PCP (in PBSS) instead of an AP in
1481 * infrastructure BSS. Valid only for DMG network.
1482 */
1483 int pbss;
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08001484
1485 /**
1486 * multicast_to_unicast - Whether to use multicast_to_unicast
1487 *
1488 * If this is non-zero, the AP is requested to perform multicast to
1489 * unicast conversion for ARP, IPv4, and IPv6 frames (possibly within
1490 * 802.1Q). If enabled, such frames are to be sent to each station
1491 * separately, with the DA replaced by their own MAC address rather
1492 * than the group address.
1493 *
1494 * Note that this may break certain expectations of the receiver, such
1495 * as the ability to drop unicast IP packets received within multicast
1496 * L2 frames, or the ability to not send ICMP destination unreachable
1497 * messages for packets received in L2 multicast (which is required,
1498 * but the receiver can't tell the difference if this new option is
1499 * enabled.)
1500 *
1501 * This also doesn't implement the 802.11 DMS (directed multicast
1502 * service).
1503 */
1504 int multicast_to_unicast;
Hai Shalom74f70d42019-02-11 14:42:39 -08001505
1506 /**
1507 * ftm_responder - Whether FTM responder is enabled
1508 */
1509 int ftm_responder;
1510
1511 /**
1512 * lci - Binary data, the content of an LCI report IE with type 8 as
1513 * defined in IEEE Std 802.11-2016, 9.4.2.22.10
1514 */
1515 const struct wpabuf *lci;
1516
1517 /**
1518 * civic - Binary data, the content of a measurement report IE with
1519 * type 11 as defined in IEEE Std 802.11-2016, 9.4.2.22.13
1520 */
1521 const struct wpabuf *civic;
Hai Shalomc3565922019-10-28 11:58:20 -07001522
1523 /**
Hai Shalom60840252021-02-19 19:02:11 -08001524 * he_spr_ctrl - Spatial Reuse control field of SPR element
Hai Shalomc3565922019-10-28 11:58:20 -07001525 */
Hai Shalom60840252021-02-19 19:02:11 -08001526 u8 he_spr_ctrl;
1527
1528 /**
1529 * he_spr_non_srg_obss_pd_max_offset - Non-SRG Maximum TX power offset
1530 */
1531 u8 he_spr_non_srg_obss_pd_max_offset;
Hai Shalomc3565922019-10-28 11:58:20 -07001532
1533 /**
1534 * he_spr_srg_obss_pd_min_offset - Minimum TX power offset
1535 */
Hai Shalom60840252021-02-19 19:02:11 -08001536 u8 he_spr_srg_obss_pd_min_offset;
Hai Shalomc3565922019-10-28 11:58:20 -07001537
1538 /**
1539 * he_spr_srg_obss_pd_max_offset - Maximum TX power offset
1540 */
Hai Shalom60840252021-02-19 19:02:11 -08001541 u8 he_spr_srg_obss_pd_max_offset;
1542
1543 /**
1544 * he_spr_bss_color_bitmap - BSS color values used by members of the
1545 * SRG.
1546 */
1547 u8 he_spr_bss_color_bitmap[8];
1548
1549 /**
1550 * he_spr_partial_bssid_bitmap - Partial BSSID values used by members
1551 * of the SRG.
1552 */
1553 u8 he_spr_partial_bssid_bitmap[8];
Hai Shalomfdcde762020-04-02 11:19:20 -07001554
1555 /**
1556 * he_bss_color - Whether the BSS Color is disabled
1557 */
1558 int he_bss_color_disabled;
1559
1560 /**
1561 * he_bss_color_partial - The BSS Color AID equation
1562 */
1563 int he_bss_color_partial;
1564
1565 /**
1566 * he_bss_color - The BSS Color of the AP
1567 */
1568 int he_bss_color;
1569
1570 /**
1571 * twt_responder - Whether Target Wait Time responder is enabled
1572 */
1573 int twt_responder;
Hai Shalom60840252021-02-19 19:02:11 -08001574
1575 /**
1576 * sae_pwe - SAE mechanism for PWE derivation
1577 * 0 = hunting-and-pecking loop only
1578 * 1 = hash-to-element only
1579 * 2 = both hunting-and-pecking loop and hash-to-element enabled
1580 */
1581 int sae_pwe;
1582
1583 /**
1584 * FILS Discovery frame minimum interval in TUs
1585 */
1586 u32 fd_min_int;
1587
1588 /**
1589 * FILS Discovery frame maximum interval in TUs (0 = FD frame disabled)
1590 */
1591 u32 fd_max_int;
1592
1593 /**
1594 * FILS Discovery frame template data
1595 */
1596 u8 *fd_frame_tmpl;
1597
1598 /**
1599 * FILS Discovery frame template length
1600 */
1601 size_t fd_frame_tmpl_len;
1602
1603 /**
1604 * Unsolicited broadcast Probe Response interval in TUs
1605 */
1606 unsigned int unsol_bcast_probe_resp_interval;
1607
1608 /**
1609 * Unsolicited broadcast Probe Response template data
1610 */
1611 u8 *unsol_bcast_probe_resp_tmpl;
1612
1613 /**
1614 * Unsolicited broadcast Probe Response template length
1615 */
1616 size_t unsol_bcast_probe_resp_tmpl_len;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001617};
1618
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001619struct wpa_driver_mesh_bss_params {
Dmitry Shmidtd13095b2016-08-22 14:02:19 -07001620#define WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS 0x00000001
1621#define WPA_DRIVER_MESH_CONF_FLAG_PEER_LINK_TIMEOUT 0x00000002
1622#define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004
1623#define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001624#define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010
Hai Shalomc1a21442022-02-04 13:43:00 -08001625#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001626 /*
1627 * TODO: Other mesh configuration parameters would go here.
1628 * See NL80211_MESHCONF_* for all the mesh config parameters.
1629 */
1630 unsigned int flags;
Dmitry Shmidtd13095b2016-08-22 14:02:19 -07001631 int auto_plinks;
Dmitry Shmidt2f74e362015-01-21 13:19:05 -08001632 int peer_link_timeout;
Dmitry Shmidtd13095b2016-08-22 14:02:19 -07001633 int max_peer_links;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001634 int rssi_threshold;
Hai Shalomc1a21442022-02-04 13:43:00 -08001635 int forwarding;
Dmitry Shmidtd13095b2016-08-22 14:02:19 -07001636 u16 ht_opmode;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001637};
1638
1639struct wpa_driver_mesh_join_params {
1640 const u8 *meshid;
1641 int meshid_len;
1642 const int *basic_rates;
1643 const u8 *ies;
1644 int ie_len;
Dmitry Shmidtff787d52015-01-12 13:01:47 -08001645 struct hostapd_freq_params freq;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001646 int beacon_int;
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -07001647 int dtim_period;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001648 struct wpa_driver_mesh_bss_params conf;
1649#define WPA_DRIVER_MESH_FLAG_USER_MPM 0x00000001
1650#define WPA_DRIVER_MESH_FLAG_DRIVER_MPM 0x00000002
1651#define WPA_DRIVER_MESH_FLAG_SAE_AUTH 0x00000004
1652#define WPA_DRIVER_MESH_FLAG_AMPE 0x00000008
1653 unsigned int flags;
Hai Shalom60840252021-02-19 19:02:11 -08001654 bool handle_dfs;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001655};
1656
Hai Shalomfdcde762020-04-02 11:19:20 -07001657struct wpa_driver_set_key_params {
1658 /**
1659 * ifname - Interface name (for multi-SSID/VLAN support) */
1660 const char *ifname;
1661
1662 /**
1663 * alg - Encryption algorithm
1664 *
1665 * (%WPA_ALG_NONE, %WPA_ALG_WEP, %WPA_ALG_TKIP, %WPA_ALG_CCMP,
Hai Shalom4fbc08f2020-05-18 12:37:00 -07001666 * %WPA_ALG_BIP_AES_CMAC_128, %WPA_ALG_GCMP, %WPA_ALG_GCMP_256,
1667 * %WPA_ALG_CCMP_256, %WPA_ALG_BIP_GMAC_128, %WPA_ALG_BIP_GMAC_256,
1668 * %WPA_ALG_BIP_CMAC_256);
Hai Shalomfdcde762020-04-02 11:19:20 -07001669 * %WPA_ALG_NONE clears the key. */
1670 enum wpa_alg alg;
1671
1672 /**
1673 * addr - Address of the peer STA
1674 *
1675 * (BSSID of the current AP when setting pairwise key in station mode),
1676 * ff:ff:ff:ff:ff:ff for broadcast keys, %NULL for default keys that
1677 * are used both for broadcast and unicast; when clearing keys, %NULL
1678 * is used to indicate that both the broadcast-only and default key of
1679 * the specified key index is to be cleared */
1680 const u8 *addr;
1681
1682 /**
1683 * key_idx - Key index
1684 *
1685 * (0..3), usually 0 for unicast keys; 4..5 for IGTK; 6..7 for BIGTK */
1686 int key_idx;
1687
1688 /**
1689 * set_tx - Configure this key as the default Tx key
1690 *
1691 * Only used when driver does not support separate unicast/individual
1692 * key */
1693 int set_tx;
1694
1695 /**
1696 * seq - Sequence number/packet number
1697 *
1698 * seq_len octets, the next packet number to be used for in replay
1699 * protection; configured for Rx keys (in most cases, this is only used
1700 * with broadcast keys and set to zero for unicast keys); %NULL if not
1701 * set */
1702 const u8 *seq;
1703
1704 /**
1705 * seq_len - Length of the seq, depends on the algorithm
1706 *
1707 * TKIP: 6 octets, CCMP/GCMP: 6 octets, IGTK: 6 octets */
1708 size_t seq_len;
1709
1710 /**
1711 * key - Key buffer
1712 *
1713 * TKIP: 16-byte temporal key, 8-byte Tx Mic key, 8-byte Rx Mic Key */
1714 const u8 *key;
1715
1716 /**
1717 * key_len - Length of the key buffer in octets
1718 *
1719 * WEP: 5 or 13, TKIP: 32, CCMP/GCMP: 16, IGTK: 16 */
1720 size_t key_len;
1721
1722 /**
1723 * vlan_id - VLAN index (0..4095) for VLAN offload cases */
1724 int vlan_id;
1725
1726 /**
1727 * key_flag - Additional key flags
1728 *
1729 * %KEY_FLAG_MODIFY
1730 * Set when an already installed key must be updated.
1731 * So far the only use-case is changing RX/TX status for
1732 * pairwise keys. Must not be set when deleting a key.
1733 * %KEY_FLAG_DEFAULT
1734 * Set when the key is also a default key. Must not be set when
1735 * deleting a key.
1736 * %KEY_FLAG_RX
1737 * The key is valid for RX. Must not be set when deleting a key.
1738 * %KEY_FLAG_TX
1739 * The key is valid for TX. Must not be set when deleting a key.
1740 * %KEY_FLAG_GROUP
1741 * The key is a broadcast or group key.
1742 * %KEY_FLAG_PAIRWISE
1743 * The key is a pairwise key.
1744 * %KEY_FLAG_PMK
1745 * The key is a Pairwise Master Key (PMK).
1746 *
1747 * Valid and pre-defined combinations are:
1748 * %KEY_FLAG_GROUP_RX_TX
1749 * WEP key not to be installed as default key.
1750 * %KEY_FLAG_GROUP_RX_TX_DEFAULT
1751 * Default WEP or WPA-NONE key.
1752 * %KEY_FLAG_GROUP_RX
1753 * GTK key valid for RX only.
1754 * %KEY_FLAG_GROUP_TX_DEFAULT
1755 * GTK key valid for TX only, immediately taking over TX.
1756 * %KEY_FLAG_PAIRWISE_RX_TX
1757 * Pairwise key immediately becoming the active pairwise key.
1758 * %KEY_FLAG_PAIRWISE_RX
1759 * Pairwise key not yet valid for TX. (Only usable when Extended
1760 * Key ID is supported by the driver.)
1761 * %KEY_FLAG_PAIRWISE_RX_TX_MODIFY
1762 * Enable TX for a pairwise key installed with
1763 * KEY_FLAG_PAIRWISE_RX.
1764 *
1765 * Not a valid standalone key type but pre-defined to be combined
1766 * with other key_flags:
1767 * %KEY_FLAG_RX_TX
1768 * RX/TX key. */
1769 enum key_flag key_flag;
1770};
1771
Hai Shalom4fbc08f2020-05-18 12:37:00 -07001772enum wpa_driver_if_type {
1773 /**
1774 * WPA_IF_STATION - Station mode interface
1775 */
1776 WPA_IF_STATION,
1777
1778 /**
1779 * WPA_IF_AP_VLAN - AP mode VLAN interface
1780 *
1781 * This interface shares its address and Beacon frame with the main
1782 * BSS.
1783 */
1784 WPA_IF_AP_VLAN,
1785
1786 /**
1787 * WPA_IF_AP_BSS - AP mode BSS interface
1788 *
1789 * This interface has its own address and Beacon frame.
1790 */
1791 WPA_IF_AP_BSS,
1792
1793 /**
1794 * WPA_IF_P2P_GO - P2P Group Owner
1795 */
1796 WPA_IF_P2P_GO,
1797
1798 /**
1799 * WPA_IF_P2P_CLIENT - P2P Client
1800 */
1801 WPA_IF_P2P_CLIENT,
1802
1803 /**
1804 * WPA_IF_P2P_GROUP - P2P Group interface (will become either
1805 * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
1806 */
1807 WPA_IF_P2P_GROUP,
1808
1809 /**
Sunil Ravia04bd252022-05-02 22:54:18 -07001810 * WPA_IF_P2P_DEVICE - P2P Device interface is used to identify the
Hai Shalom4fbc08f2020-05-18 12:37:00 -07001811 * abstracted P2P Device function in the driver
1812 */
1813 WPA_IF_P2P_DEVICE,
1814
1815 /*
1816 * WPA_IF_MESH - Mesh interface
1817 */
1818 WPA_IF_MESH,
1819
1820 /*
1821 * WPA_IF_TDLS - TDLS offchannel interface (used for pref freq only)
1822 */
1823 WPA_IF_TDLS,
1824
1825 /*
1826 * WPA_IF_IBSS - IBSS interface (used for pref freq only)
1827 */
1828 WPA_IF_IBSS,
1829
1830 /*
1831 * WPA_IF_NAN - NAN Device
1832 */
1833 WPA_IF_NAN,
1834
1835 /* keep last */
1836 WPA_IF_MAX
1837};
1838
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001839/**
1840 * struct wpa_driver_capa - Driver capability information
1841 */
1842struct wpa_driver_capa {
1843#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
1844#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
1845#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
1846#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
1847#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
1848#define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
1849#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
Dmitry Shmidtd5e49232012-12-03 15:08:10 -08001850#define WPA_DRIVER_CAPA_KEY_MGMT_WAPI_PSK 0x00000080
Dmitry Shmidt807291d2015-01-27 13:40:23 -08001851#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B 0x00000100
1852#define WPA_DRIVER_CAPA_KEY_MGMT_SUITE_B_192 0x00000200
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001853#define WPA_DRIVER_CAPA_KEY_MGMT_OWE 0x00000400
1854#define WPA_DRIVER_CAPA_KEY_MGMT_DPP 0x00000800
1855#define WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA256 0x00001000
1856#define WPA_DRIVER_CAPA_KEY_MGMT_FILS_SHA384 0x00002000
1857#define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA256 0x00004000
1858#define WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA384 0x00008000
Hai Shalom74f70d42019-02-11 14:42:39 -08001859#define WPA_DRIVER_CAPA_KEY_MGMT_SAE 0x00010000
Tanmay Garga7fd80d2020-05-18 15:52:44 +05301860#define WPA_DRIVER_CAPA_KEY_MGMT_802_1X_SHA256 0x00020000
1861#define WPA_DRIVER_CAPA_KEY_MGMT_PSK_SHA256 0x00040000
1862#define WPA_DRIVER_CAPA_KEY_MGMT_TPK_HANDSHAKE 0x00080000
1863#define WPA_DRIVER_CAPA_KEY_MGMT_FT_SAE 0x00100000
1864#define WPA_DRIVER_CAPA_KEY_MGMT_FT_802_1X_SHA384 0x00200000
1865#define WPA_DRIVER_CAPA_KEY_MGMT_CCKM 0x00400000
1866#define WPA_DRIVER_CAPA_KEY_MGMT_OSEN 0x00800000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001867 /** Bitfield of supported key management suites */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001868 unsigned int key_mgmt;
Hai Shalom4fbc08f2020-05-18 12:37:00 -07001869 unsigned int key_mgmt_iftype[WPA_IF_MAX];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001870
1871#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
1872#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
1873#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
1874#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
Dmitry Shmidt04949592012-07-19 12:16:46 -07001875#define WPA_DRIVER_CAPA_ENC_WEP128 0x00000010
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001876#define WPA_DRIVER_CAPA_ENC_GCMP 0x00000020
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08001877#define WPA_DRIVER_CAPA_ENC_GCMP_256 0x00000040
1878#define WPA_DRIVER_CAPA_ENC_CCMP_256 0x00000080
1879#define WPA_DRIVER_CAPA_ENC_BIP 0x00000100
1880#define WPA_DRIVER_CAPA_ENC_BIP_GMAC_128 0x00000200
1881#define WPA_DRIVER_CAPA_ENC_BIP_GMAC_256 0x00000400
1882#define WPA_DRIVER_CAPA_ENC_BIP_CMAC_256 0x00000800
Dmitry Shmidtf21452a2014-02-26 10:55:25 -08001883#define WPA_DRIVER_CAPA_ENC_GTK_NOT_USED 0x00001000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001884 /** Bitfield of supported cipher suites */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001885 unsigned int enc;
1886
1887#define WPA_DRIVER_AUTH_OPEN 0x00000001
1888#define WPA_DRIVER_AUTH_SHARED 0x00000002
1889#define WPA_DRIVER_AUTH_LEAP 0x00000004
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001890 /** Bitfield of supported IEEE 802.11 authentication algorithms */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001891 unsigned int auth;
1892
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001893/** Driver generated WPA/RSN IE */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001894#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001895/** Driver needs static WEP key setup after association command */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001896#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001897/** Driver takes care of all DFS operations */
Dmitry Shmidtd11f0192014-03-24 12:09:47 -07001898#define WPA_DRIVER_FLAGS_DFS_OFFLOAD 0x00000004
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001899/** Driver takes care of RSN 4-way handshake internally; PMK is configured with
Hai Shalomfdcde762020-04-02 11:19:20 -07001900 * struct wpa_driver_ops::set_key using key_flag = KEY_FLAG_PMK */
Hai Shalom74f70d42019-02-11 14:42:39 -08001901#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X 0x00000008
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001902/** Driver is for a wired Ethernet interface */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001903#define WPA_DRIVER_FLAGS_WIRED 0x00000010
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001904/** Driver provides separate commands for authentication and association (SME in
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001905 * wpa_supplicant). */
1906#define WPA_DRIVER_FLAGS_SME 0x00000020
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001907/** Driver supports AP mode */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001908#define WPA_DRIVER_FLAGS_AP 0x00000040
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001909/** Driver needs static WEP key setup after association has been completed */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001910#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001911/** Driver supports dynamic HT 20/40 MHz channel changes during BSS lifetime */
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07001912#define WPA_DRIVER_FLAGS_HT_2040_COEX 0x00000100
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001913/** Driver supports concurrent P2P operations */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001914#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001915/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001916 * Driver uses the initial interface as a dedicated management interface, i.e.,
1917 * it cannot be used for P2P group operations or non-P2P purposes.
1918 */
1919#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001920/** This interface is P2P capable (P2P GO or P2P Client) */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001921#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001922/** Driver supports station and key removal when stopping an AP */
Dmitry Shmidta38abf92014-03-06 13:38:44 -08001923#define WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT 0x00001000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001924/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001925 * Driver uses the initial interface for P2P management interface and non-P2P
1926 * purposes (e.g., connect to infra AP), but this interface cannot be used for
1927 * P2P group operations.
1928 */
1929#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001930/**
Hai Shalomc1a21442022-02-04 13:43:00 -08001931 * Driver is known to use valid error codes, i.e., when it indicates that
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001932 * something (e.g., association) fails, there was indeed a failure and the
1933 * operation does not end up getting completed successfully later.
1934 */
Hai Shalomc1a21442022-02-04 13:43:00 -08001935#define WPA_DRIVER_FLAGS_VALID_ERROR_CODES 0x00004000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001936/** Driver supports off-channel TX */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001937#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001938/** Driver indicates TX status events for EAPOL Data frames */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001939#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001940/** Driver indicates TX status events for Deauth/Disassoc frames */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001941#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS 0x00020000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001942/** Driver supports roaming (BSS selection) in firmware */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001943#define WPA_DRIVER_FLAGS_BSS_SELECTION 0x00040000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001944/** Driver supports operating as a TDLS peer */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001945#define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001946/** Driver requires external TDLS setup/teardown/discovery */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001947#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001948/** Driver indicates support for Probe Response offloading in AP mode */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001949#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001950/** Driver supports U-APSD in AP mode */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08001951#define WPA_DRIVER_FLAGS_AP_UAPSD 0x00400000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001952/** Driver supports inactivity timer in AP mode */
Dmitry Shmidt04949592012-07-19 12:16:46 -07001953#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER 0x00800000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001954/** Driver expects user space implementation of MLME in AP mode */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07001955#define WPA_DRIVER_FLAGS_AP_MLME 0x01000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001956/** Driver supports SAE with user space SME */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -08001957#define WPA_DRIVER_FLAGS_SAE 0x02000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001958/** Driver makes use of OBSS scan mechanism in wpa_supplicant */
Dmitry Shmidtd5e49232012-12-03 15:08:10 -08001959#define WPA_DRIVER_FLAGS_OBSS_SCAN 0x04000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001960/** Driver supports IBSS (Ad-hoc) mode */
Dmitry Shmidt700a1372013-03-15 14:14:44 -07001961#define WPA_DRIVER_FLAGS_IBSS 0x08000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001962/** Driver supports radar detection */
Dmitry Shmidtea69e842013-05-13 14:52:28 -07001963#define WPA_DRIVER_FLAGS_RADAR 0x10000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001964/** Driver supports a dedicated interface for P2P Device */
Dmitry Shmidt34af3062013-07-11 10:46:32 -07001965#define WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE 0x20000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001966/** Driver supports QoS Mapping */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08001967#define WPA_DRIVER_FLAGS_QOS_MAPPING 0x40000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001968/** Driver supports CSA in AP mode */
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08001969#define WPA_DRIVER_FLAGS_AP_CSA 0x80000000
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001970/** Driver supports mesh */
1971#define WPA_DRIVER_FLAGS_MESH 0x0000000100000000ULL
1972/** Driver support ACS offload */
1973#define WPA_DRIVER_FLAGS_ACS_OFFLOAD 0x0000000200000000ULL
1974/** Driver supports key management offload */
1975#define WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD 0x0000000400000000ULL
1976/** Driver supports TDLS channel switching */
1977#define WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH 0x0000000800000000ULL
Dmitry Shmidtff787d52015-01-12 13:01:47 -08001978/** Driver supports IBSS with HT datarates */
1979#define WPA_DRIVER_FLAGS_HT_IBSS 0x0000001000000000ULL
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001980/** Driver supports IBSS with VHT datarates */
1981#define WPA_DRIVER_FLAGS_VHT_IBSS 0x0000002000000000ULL
Dmitry Shmidtb1e52102015-05-29 12:36:29 -07001982/** Driver supports automatic band selection */
1983#define WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY 0x0000004000000000ULL
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08001984/** Driver supports simultaneous off-channel operations */
1985#define WPA_DRIVER_FLAGS_OFFCHANNEL_SIMULTANEOUS 0x0000008000000000ULL
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08001986/** Driver supports full AP client state */
1987#define WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE 0x0000010000000000ULL
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -07001988/** Driver supports P2P Listen offload */
1989#define WPA_DRIVER_FLAGS_P2P_LISTEN_OFFLOAD 0x0000020000000000ULL
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08001990/** Driver supports FILS */
1991#define WPA_DRIVER_FLAGS_SUPPORT_FILS 0x0000040000000000ULL
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08001992/** Driver supports Beacon frame TX rate configuration (legacy rates) */
1993#define WPA_DRIVER_FLAGS_BEACON_RATE_LEGACY 0x0000080000000000ULL
1994/** Driver supports Beacon frame TX rate configuration (HT rates) */
1995#define WPA_DRIVER_FLAGS_BEACON_RATE_HT 0x0000100000000000ULL
1996/** Driver supports Beacon frame TX rate configuration (VHT rates) */
1997#define WPA_DRIVER_FLAGS_BEACON_RATE_VHT 0x0000200000000000ULL
Dmitry Shmidtebd93af2017-02-21 13:40:44 -08001998/** Driver supports mgmt_tx with random TX address in non-connected state */
1999#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA 0x0000400000000000ULL
2000/** Driver supports mgmt_tx with random TX addr in connected state */
2001#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA_CONNECTED 0x0000800000000000ULL
2002/** Driver supports better BSS reporting with sched_scan in connected mode */
2003#define WPA_DRIVER_FLAGS_SCHED_SCAN_RELATIVE_RSSI 0x0001000000000000ULL
2004/** Driver supports HE capabilities */
2005#define WPA_DRIVER_FLAGS_HE_CAPABILITIES 0x0002000000000000ULL
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002006/** Driver supports FILS shared key offload */
2007#define WPA_DRIVER_FLAGS_FILS_SK_OFFLOAD 0x0004000000000000ULL
2008/** Driver supports all OCE STA specific mandatory features */
2009#define WPA_DRIVER_FLAGS_OCE_STA 0x0008000000000000ULL
2010/** Driver supports all OCE AP specific mandatory features */
2011#define WPA_DRIVER_FLAGS_OCE_AP 0x0010000000000000ULL
2012/**
2013 * Driver supports all OCE STA-CFON specific mandatory features only.
2014 * If a driver sets this bit but not the %WPA_DRIVER_FLAGS_OCE_AP, the
2015 * userspace shall assume that this driver may not support all OCE AP
2016 * functionality but can support only OCE STA-CFON functionality.
2017 */
2018#define WPA_DRIVER_FLAGS_OCE_STA_CFON 0x0020000000000000ULL
Roshan Pius3a1667e2018-07-03 15:17:14 -07002019/** Driver supports MFP-optional in the connect command */
2020#define WPA_DRIVER_FLAGS_MFP_OPTIONAL 0x0040000000000000ULL
Hai Shalom39ba6fc2019-01-22 12:40:38 -08002021/** Driver is a self-managed regulatory device */
2022#define WPA_DRIVER_FLAGS_SELF_MANAGED_REGULATORY 0x0080000000000000ULL
Hai Shalom74f70d42019-02-11 14:42:39 -08002023/** Driver supports FTM responder functionality */
2024#define WPA_DRIVER_FLAGS_FTM_RESPONDER 0x0100000000000000ULL
2025/** Driver support 4-way handshake offload for WPA-Personal */
2026#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK 0x0200000000000000ULL
Hai Shalomb755a2a2020-04-23 21:49:02 -07002027/** Driver supports a separate control port TX for EAPOL frames */
Hai Shalomfdcde762020-04-02 11:19:20 -07002028#define WPA_DRIVER_FLAGS_CONTROL_PORT 0x0400000000000000ULL
2029/** Driver supports VLAN offload */
2030#define WPA_DRIVER_FLAGS_VLAN_OFFLOAD 0x0800000000000000ULL
2031/** Driver supports UPDATE_FT_IES command */
2032#define WPA_DRIVER_FLAGS_UPDATE_FT_IES 0x1000000000000000ULL
2033/** Driver can correctly rekey PTKs without Extended Key ID */
2034#define WPA_DRIVER_FLAGS_SAFE_PTK0_REKEYS 0x2000000000000000ULL
2035/** Driver supports Beacon protection */
2036#define WPA_DRIVER_FLAGS_BEACON_PROTECTION 0x4000000000000000ULL
2037/** Driver supports Extended Key ID */
2038#define WPA_DRIVER_FLAGS_EXTENDED_KEY_ID 0x8000000000000000ULL
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002039 u64 flags;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002040
Hai Shalomb755a2a2020-04-23 21:49:02 -07002041/** Driver supports a separate control port RX for EAPOL frames */
2042#define WPA_DRIVER_FLAGS2_CONTROL_PORT_RX 0x0000000000000001ULL
Hai Shalom899fcc72020-10-19 14:38:18 -07002043/** Driver supports TX status reports for EAPOL frames through control port */
2044#define WPA_DRIVER_FLAGS2_CONTROL_PORT_TX_STATUS 0x0000000000000002ULL
Hai Shalom60840252021-02-19 19:02:11 -08002045/** Driver supports secure LTF */
2046#define WPA_DRIVER_FLAGS2_SEC_LTF 0x0000000000000004ULL
2047/** Driver supports secure RTT measurement exchange */
2048#define WPA_DRIVER_FLAGS2_SEC_RTT 0x0000000000000008ULL
2049/**
2050 * Driver supports protection of range negotiation and measurement management
2051 * frames
2052 */
2053#define WPA_DRIVER_FLAGS2_PROT_RANGE_NEG 0x0000000000000010ULL
2054/** Driver supports Beacon frame TX rate configuration (HE rates) */
2055#define WPA_DRIVER_FLAGS2_BEACON_RATE_HE 0x0000000000000020ULL
2056/** Driver supports Beacon protection only in client mode */
2057#define WPA_DRIVER_FLAGS2_BEACON_PROTECTION_CLIENT 0x0000000000000040ULL
2058/** Driver supports Operating Channel Validation */
2059#define WPA_DRIVER_FLAGS2_OCV 0x0000000000000080ULL
2060/** Driver expects user space implementation of SME in AP mode */
2061#define WPA_DRIVER_FLAGS2_AP_SME 0x0000000000000100ULL
Sunil Ravia04bd252022-05-02 22:54:18 -07002062/** Driver handles SA Query procedures in AP mode */
2063#define WPA_DRIVER_FLAGS2_SA_QUERY_OFFLOAD_AP 0x0000000000000200ULL
2064/** Driver supports background radar/CAC detection */
2065#define WPA_DRIVER_RADAR_BACKGROUND 0x0000000000000400ULL
Hai Shalomb755a2a2020-04-23 21:49:02 -07002066 u64 flags2;
2067
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08002068#define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
2069 (drv_flags & WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE)
2070
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002071 unsigned int wmm_ac_supported:1;
2072
2073 unsigned int mac_addr_rand_scan_supported:1;
2074 unsigned int mac_addr_rand_sched_scan_supported:1;
2075
2076 /** Maximum number of supported active probe SSIDs */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002077 int max_scan_ssids;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002078
2079 /** Maximum number of supported active probe SSIDs for sched_scan */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002080 int max_sched_scan_ssids;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002081
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -08002082 /** Maximum number of supported scan plans for scheduled scan */
2083 unsigned int max_sched_scan_plans;
2084
2085 /** Maximum interval in a scan plan. In seconds */
2086 u32 max_sched_scan_plan_interval;
2087
2088 /** Maximum number of iterations in a single scan plan */
2089 u32 max_sched_scan_plan_iterations;
2090
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002091 /** Whether sched_scan (offloaded scanning) is supported */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002092 int sched_scan_supported;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002093
2094 /** Maximum number of supported match sets for sched_scan */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002095 int max_match_sets;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002096
2097 /**
2098 * max_remain_on_chan - Maximum remain-on-channel duration in msec
2099 */
2100 unsigned int max_remain_on_chan;
2101
2102 /**
2103 * max_stations - Maximum number of associated stations the driver
2104 * supports in AP mode
2105 */
2106 unsigned int max_stations;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002107
2108 /**
2109 * probe_resp_offloads - Bitmap of supported protocols by the driver
2110 * for Probe Response offloading.
2111 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002112/** Driver Probe Response offloading support for WPS ver. 1 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002113#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS 0x00000001
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002114/** Driver Probe Response offloading support for WPS ver. 2 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002115#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2 0x00000002
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002116/** Driver Probe Response offloading support for P2P */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002117#define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P 0x00000004
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002118/** Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002119#define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING 0x00000008
2120 unsigned int probe_resp_offloads;
Dmitry Shmidt444d5672013-04-01 13:08:44 -07002121
Dmitry Shmidt8bae4132013-06-06 11:25:10 -07002122 unsigned int max_acl_mac_addrs;
2123
Dmitry Shmidt444d5672013-04-01 13:08:44 -07002124 /**
Dmitry Shmidtc2ebb4b2013-07-24 12:57:51 -07002125 * Number of supported concurrent channels
2126 */
2127 unsigned int num_multichan_concurrent;
2128
2129 /**
Dmitry Shmidt444d5672013-04-01 13:08:44 -07002130 * extended_capa - extended capabilities in driver/device
2131 *
2132 * Must be allocated and freed by driver and the pointers must be
2133 * valid for the lifetime of the driver, i.e., freed in deinit()
2134 */
2135 const u8 *extended_capa, *extended_capa_mask;
2136 unsigned int extended_capa_len;
Dmitry Shmidtb58836e2014-04-29 14:35:56 -07002137
2138 struct wowlan_triggers wowlan_triggers;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002139
2140/** Driver adds the DS Params Set IE in Probe Request frames */
2141#define WPA_DRIVER_FLAGS_DS_PARAM_SET_IE_IN_PROBES 0x00000001
2142/** Driver adds the WFA TPC IE in Probe Request frames */
2143#define WPA_DRIVER_FLAGS_WFA_TPC_IE_IN_PROBES 0x00000002
2144/** Driver handles quiet period requests */
2145#define WPA_DRIVER_FLAGS_QUIET 0x00000004
2146/**
2147 * Driver is capable of inserting the current TX power value into the body of
2148 * transmitted frames.
2149 * Background: Some Action frames include a TPC Report IE. This IE contains a
2150 * TX power field, which has to be updated by lower layers. One such Action
2151 * frame is Link Measurement Report (part of RRM). Another is TPC Report (part
2152 * of spectrum management). Note that this insertion takes place at a fixed
2153 * offset, namely the 6th byte in the Action frame body.
2154 */
2155#define WPA_DRIVER_FLAGS_TX_POWER_INSERTION 0x00000008
Dmitry Shmidt849734c2016-05-27 09:59:01 -07002156/**
2157 * Driver supports RRM. With this support, the driver will accept to use RRM in
2158 * (Re)Association Request frames, without supporting quiet period.
2159 */
2160#define WPA_DRIVER_FLAGS_SUPPORT_RRM 0x00000010
2161
Dmitry Shmidt29333592017-01-09 12:27:11 -08002162/** Driver supports setting the scan dwell time */
2163#define WPA_DRIVER_FLAGS_SUPPORT_SET_SCAN_DWELL 0x00000020
2164/** Driver supports Beacon Report Measurement */
2165#define WPA_DRIVER_FLAGS_SUPPORT_BEACON_REPORT 0x00000040
2166
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002167 u32 rrm_flags;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08002168
2169 /* Driver concurrency capabilities */
2170 unsigned int conc_capab;
2171 /* Maximum number of concurrent channels on 2.4 GHz */
2172 unsigned int max_conc_chan_2_4;
2173 /* Maximum number of concurrent channels on 5 GHz */
2174 unsigned int max_conc_chan_5_0;
2175
2176 /* Maximum number of supported CSA counters */
2177 u16 max_csa_counters;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002178};
2179
2180
2181struct hostapd_data;
2182
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002183#define STA_DRV_DATA_TX_MCS BIT(0)
2184#define STA_DRV_DATA_RX_MCS BIT(1)
2185#define STA_DRV_DATA_TX_VHT_MCS BIT(2)
2186#define STA_DRV_DATA_RX_VHT_MCS BIT(3)
2187#define STA_DRV_DATA_TX_VHT_NSS BIT(4)
2188#define STA_DRV_DATA_RX_VHT_NSS BIT(5)
2189#define STA_DRV_DATA_TX_SHORT_GI BIT(6)
2190#define STA_DRV_DATA_RX_SHORT_GI BIT(7)
Roshan Pius3a1667e2018-07-03 15:17:14 -07002191#define STA_DRV_DATA_LAST_ACK_RSSI BIT(8)
Hai Shalomc1a21442022-02-04 13:43:00 -08002192#define STA_DRV_DATA_CONN_TIME BIT(9)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002193
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002194struct hostap_sta_driver_data {
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08002195 unsigned long rx_packets, tx_packets;
2196 unsigned long long rx_bytes, tx_bytes;
Hai Shalom81f62d82019-07-22 12:10:00 -07002197 unsigned long long rx_airtime, tx_airtime;
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08002198 int bytes_64bit; /* whether 64-bit byte counters are supported */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002199 unsigned long current_tx_rate;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002200 unsigned long current_rx_rate;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002201 unsigned long inactive_msec;
Hai Shalomc1a21442022-02-04 13:43:00 -08002202 unsigned long connected_sec;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002203 unsigned long flags; /* bitfield of STA_DRV_DATA_* */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002204 unsigned long num_ps_buf_frames;
2205 unsigned long tx_retry_failed;
2206 unsigned long tx_retry_count;
Roshan Pius3a1667e2018-07-03 15:17:14 -07002207 s8 last_ack_rssi;
Hai Shalom81f62d82019-07-22 12:10:00 -07002208 unsigned long backlog_packets;
2209 unsigned long backlog_bytes;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002210 s8 signal;
2211 u8 rx_vhtmcs;
2212 u8 tx_vhtmcs;
2213 u8 rx_mcs;
2214 u8 tx_mcs;
2215 u8 rx_vht_nss;
2216 u8 tx_vht_nss;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002217};
2218
2219struct hostapd_sta_add_params {
2220 const u8 *addr;
2221 u16 aid;
2222 u16 capability;
2223 const u8 *supp_rates;
2224 size_t supp_rates_len;
2225 u16 listen_interval;
2226 const struct ieee80211_ht_capabilities *ht_capabilities;
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -08002227 const struct ieee80211_vht_capabilities *vht_capabilities;
Dmitry Shmidtbd14a572014-02-18 10:33:49 -08002228 int vht_opmode_enabled;
2229 u8 vht_opmode;
Hai Shalom81f62d82019-07-22 12:10:00 -07002230 const struct ieee80211_he_capabilities *he_capab;
2231 size_t he_capab_len;
Hai Shalom4fbc08f2020-05-18 12:37:00 -07002232 const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab;
Sunil Ravia04bd252022-05-02 22:54:18 -07002233 const struct ieee80211_eht_capabilities *eht_capab;
2234 size_t eht_capab_len;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002235 u32 flags; /* bitmask of WPA_STA_* flags */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002236 u32 flags_mask; /* unset bits in flags */
2237#ifdef CONFIG_MESH
2238 enum mesh_plink_state plink_state;
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -07002239 u16 peer_aid;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002240#endif /* CONFIG_MESH */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002241 int set; /* Set STA parameters instead of add */
2242 u8 qosinfo;
Dmitry Shmidtf8623282013-02-20 14:34:59 -08002243 const u8 *ext_capab;
2244 size_t ext_capab_len;
Dmitry Shmidt344abd32014-01-14 13:17:00 -08002245 const u8 *supp_channels;
2246 size_t supp_channels_len;
2247 const u8 *supp_oper_classes;
2248 size_t supp_oper_classes_len;
Dmitry Shmidt849734c2016-05-27 09:59:01 -07002249 int support_p2p_ps;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002250};
2251
Dmitry Shmidt8bae4132013-06-06 11:25:10 -07002252struct mac_address {
2253 u8 addr[ETH_ALEN];
2254};
2255
2256struct hostapd_acl_params {
2257 u8 acl_policy;
2258 unsigned int num_mac_acl;
2259 struct mac_address mac_acl[0];
2260};
2261
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002262struct wpa_init_params {
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002263 void *global_priv;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002264 const u8 *bssid;
2265 const char *ifname;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002266 const char *driver_params;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002267 int use_pae_group_addr;
2268 char **bridge;
2269 size_t num_bridge;
2270
2271 u8 *own_addr; /* buffer for writing own MAC address */
2272};
2273
2274
2275struct wpa_bss_params {
2276 /** Interface name (for multi-SSID/VLAN support) */
2277 const char *ifname;
2278 /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
2279 int enabled;
2280
2281 int wpa;
2282 int ieee802_1x;
2283 int wpa_group;
2284 int wpa_pairwise;
2285 int wpa_key_mgmt;
2286 int rsn_preauth;
2287 enum mfp_options ieee80211w;
2288};
2289
2290#define WPA_STA_AUTHORIZED BIT(0)
2291#define WPA_STA_WMM BIT(1)
2292#define WPA_STA_SHORT_PREAMBLE BIT(2)
2293#define WPA_STA_MFP BIT(3)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002294#define WPA_STA_TDLS_PEER BIT(4)
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002295#define WPA_STA_AUTHENTICATED BIT(5)
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08002296#define WPA_STA_ASSOCIATED BIT(6)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002297
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002298enum tdls_oper {
2299 TDLS_DISCOVERY_REQ,
2300 TDLS_SETUP,
2301 TDLS_TEARDOWN,
2302 TDLS_ENABLE_LINK,
2303 TDLS_DISABLE_LINK,
2304 TDLS_ENABLE,
2305 TDLS_DISABLE
2306};
2307
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07002308enum wnm_oper {
2309 WNM_SLEEP_ENTER_CONFIRM,
2310 WNM_SLEEP_ENTER_FAIL,
2311 WNM_SLEEP_EXIT_CONFIRM,
2312 WNM_SLEEP_EXIT_FAIL,
2313 WNM_SLEEP_TFS_REQ_IE_ADD, /* STA requests driver to add TFS req IE */
2314 WNM_SLEEP_TFS_REQ_IE_NONE, /* STA requests empty TFS req IE */
2315 WNM_SLEEP_TFS_REQ_IE_SET, /* AP requests driver to set TFS req IE for
2316 * a STA */
2317 WNM_SLEEP_TFS_RESP_IE_ADD, /* AP requests driver to add TFS resp IE
2318 * for a STA */
2319 WNM_SLEEP_TFS_RESP_IE_NONE, /* AP requests empty TFS resp IE */
2320 WNM_SLEEP_TFS_RESP_IE_SET, /* AP requests driver to set TFS resp IE
2321 * for a STA */
2322 WNM_SLEEP_TFS_IE_DEL /* AP delete the TFS IE */
2323};
2324
Roshan Pius3a1667e2018-07-03 15:17:14 -07002325/* enum smps_mode - SMPS mode definitions */
2326enum smps_mode {
2327 SMPS_AUTOMATIC,
2328 SMPS_OFF,
2329 SMPS_DYNAMIC,
2330 SMPS_STATIC,
2331
2332 /* Keep last */
2333 SMPS_INVALID,
2334};
2335
Hai Shalom74f70d42019-02-11 14:42:39 -08002336#define WPA_INVALID_NOISE 9999
Dmitry Shmidt34af3062013-07-11 10:46:32 -07002337
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002338/**
2339 * struct wpa_signal_info - Information about channel signal quality
Hai Shalom74f70d42019-02-11 14:42:39 -08002340 * @frequency: control frequency
2341 * @above_threshold: true if the above threshold was crossed
2342 * (relevant for a CQM event)
2343 * @current_signal: in dBm
2344 * @avg_signal: in dBm
2345 * @avg_beacon_signal: in dBm
2346 * @current_noise: %WPA_INVALID_NOISE if not supported
2347 * @current_txrate: current TX rate
2348 * @chanwidth: channel width
2349 * @center_frq1: center frequency for the first segment
2350 * @center_frq2: center frequency for the second segment (if relevant)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002351 */
2352struct wpa_signal_info {
2353 u32 frequency;
2354 int above_threshold;
2355 int current_signal;
Dmitry Shmidt34af3062013-07-11 10:46:32 -07002356 int avg_signal;
Dmitry Shmidtf73259c2015-03-17 11:00:54 -07002357 int avg_beacon_signal;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002358 int current_noise;
2359 int current_txrate;
Dmitry Shmidt34af3062013-07-11 10:46:32 -07002360 enum chan_width chanwidth;
2361 int center_frq1;
2362 int center_frq2;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002363};
2364
2365/**
Hai Shalom74f70d42019-02-11 14:42:39 -08002366 * struct wpa_channel_info - Information about the current channel
2367 * @frequency: Center frequency of the primary 20 MHz channel
2368 * @chanwidth: Width of the current operating channel
2369 * @sec_channel: Location of the secondary 20 MHz channel (either +1 or -1).
2370 * This field is only filled in when using a 40 MHz channel.
2371 * @center_frq1: Center frequency of frequency segment 0
2372 * @center_frq2: Center frequency of frequency segment 1 (for 80+80 channels)
2373 * @seg1_idx: Frequency segment 1 index when using a 80+80 channel. This is
2374 * derived from center_frq2 for convenience.
2375 */
2376struct wpa_channel_info {
2377 u32 frequency;
2378 enum chan_width chanwidth;
2379 int sec_channel;
2380 int center_frq1;
2381 int center_frq2;
2382 u8 seg1_idx;
2383};
2384
2385/**
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08002386 * struct beacon_data - Beacon data
2387 * @head: Head portion of Beacon frame (before TIM IE)
2388 * @tail: Tail portion of Beacon frame (after TIM IE)
2389 * @beacon_ies: Extra information element(s) to add into Beacon frames or %NULL
2390 * @proberesp_ies: Extra information element(s) to add into Probe Response
2391 * frames or %NULL
2392 * @assocresp_ies: Extra information element(s) to add into (Re)Association
2393 * Response frames or %NULL
2394 * @probe_resp: Probe Response frame template
2395 * @head_len: Length of @head
2396 * @tail_len: Length of @tail
2397 * @beacon_ies_len: Length of beacon_ies in octets
2398 * @proberesp_ies_len: Length of proberesp_ies in octets
2399 * @proberesp_ies_len: Length of proberesp_ies in octets
2400 * @probe_resp_len: Length of probe response template (@probe_resp)
2401 */
2402struct beacon_data {
2403 u8 *head, *tail;
2404 u8 *beacon_ies;
2405 u8 *proberesp_ies;
2406 u8 *assocresp_ies;
2407 u8 *probe_resp;
2408
2409 size_t head_len, tail_len;
2410 size_t beacon_ies_len;
2411 size_t proberesp_ies_len;
2412 size_t assocresp_ies_len;
2413 size_t probe_resp_len;
2414};
2415
2416/**
2417 * struct csa_settings - Settings for channel switch command
2418 * @cs_count: Count in Beacon frames (TBTT) to perform the switch
2419 * @block_tx: 1 - block transmission for CSA period
2420 * @freq_params: Next channel frequency parameter
2421 * @beacon_csa: Beacon/probe resp/asooc resp info for CSA period
2422 * @beacon_after: Next beacon/probe resp/asooc resp info
2423 * @counter_offset_beacon: Offset to the count field in beacon's tail
2424 * @counter_offset_presp: Offset to the count field in probe resp.
2425 */
2426struct csa_settings {
2427 u8 cs_count;
2428 u8 block_tx;
2429
2430 struct hostapd_freq_params freq_params;
2431 struct beacon_data beacon_csa;
2432 struct beacon_data beacon_after;
2433
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08002434 u16 counter_offset_beacon[2];
2435 u16 counter_offset_presp[2];
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08002436};
2437
Sunil Ravia04bd252022-05-02 22:54:18 -07002438/**
2439 * struct cca_settings - Settings for color switch command
2440 * @cca_count: Count in Beacon frames (TBTT) to perform the switch
2441 * @cca_color: The new color that we are switching to
2442 * @beacon_cca: Beacon/Probe Response/(Re)Association Response frame info for
2443 * color switch period
2444 * @beacon_after: Next Beacon/Probe Response/(Re)Association Response frame info
2445 * @counter_offset_beacon: Offset to the count field in Beacon frame tail
2446 * @counter_offset_presp: Offset to the count field in Probe Response frame
2447 */
2448struct cca_settings {
2449 u8 cca_count;
2450 u8 cca_color;
2451
2452 struct beacon_data beacon_cca;
2453 struct beacon_data beacon_after;
2454
2455 u16 counter_offset_beacon;
2456 u16 counter_offset_presp;
2457};
2458
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -07002459/* TDLS peer capabilities for send_tdls_mgmt() */
2460enum tdls_peer_capability {
2461 TDLS_PEER_HT = BIT(0),
2462 TDLS_PEER_VHT = BIT(1),
2463 TDLS_PEER_WMM = BIT(2),
Hai Shalomc1a21442022-02-04 13:43:00 -08002464 TDLS_PEER_HE = BIT(3),
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -07002465};
2466
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002467/* valid info in the wmm_params struct */
2468enum wmm_params_valid_info {
2469 WMM_PARAMS_UAPSD_QUEUES_INFO = BIT(0),
2470};
2471
2472/**
2473 * struct wmm_params - WMM parameterss configured for this association
2474 * @info_bitmap: Bitmap of valid wmm_params info; indicates what fields
2475 * of the struct contain valid information.
2476 * @uapsd_queues: Bitmap of ACs configured for uapsd (valid only if
2477 * %WMM_PARAMS_UAPSD_QUEUES_INFO is set)
2478 */
2479struct wmm_params {
2480 u8 info_bitmap;
2481 u8 uapsd_queues;
2482};
2483
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07002484#ifdef CONFIG_MACSEC
2485struct macsec_init_params {
Hai Shalome21d4e82020-04-29 16:34:06 -07002486 bool always_include_sci;
2487 bool use_es;
2488 bool use_scb;
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07002489};
2490#endif /* CONFIG_MACSEC */
2491
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002492enum drv_br_port_attr {
2493 DRV_BR_PORT_ATTR_PROXYARP,
2494 DRV_BR_PORT_ATTR_HAIRPIN_MODE,
2495};
2496
2497enum drv_br_net_param {
2498 DRV_BR_NET_PARAM_GARP_ACCEPT,
Dmitry Shmidt83474442015-04-15 13:47:09 -07002499 DRV_BR_MULTICAST_SNOOPING,
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002500};
2501
2502struct drv_acs_params {
2503 /* Selected mode (HOSTAPD_MODE_*) */
2504 enum hostapd_hw_mode hw_mode;
2505
2506 /* Indicates whether HT is enabled */
2507 int ht_enabled;
2508
2509 /* Indicates whether HT40 is enabled */
2510 int ht40_enabled;
Dmitry Shmidtdda10c22015-03-24 16:05:01 -07002511
2512 /* Indicates whether VHT is enabled */
2513 int vht_enabled;
2514
2515 /* Configured ACS channel width */
2516 u16 ch_width;
2517
Ahmed ElArabawy0ff61c52019-12-26 12:38:39 -08002518 /* ACS frequency list info */
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08002519 const int *freq_list;
Hai Shalomfdcde762020-04-02 11:19:20 -07002520
2521 /* Indicates whether EDMG is enabled */
2522 int edmg_enabled;
Sunil Ravia04bd252022-05-02 22:54:18 -07002523
2524 /* Indicates whether EHT is enabled */
2525 bool eht_enabled;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08002526};
2527
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002528struct wpa_bss_trans_info {
2529 u8 mbo_transition_reason;
2530 u8 n_candidates;
2531 u8 *bssid;
2532};
2533
2534struct wpa_bss_candidate_info {
2535 u8 num;
2536 struct candidate_list {
2537 u8 bssid[ETH_ALEN];
2538 u8 is_accept;
2539 u32 reject_reason;
2540 } *candidates;
2541};
2542
2543struct wpa_pmkid_params {
2544 const u8 *bssid;
2545 const u8 *ssid;
2546 size_t ssid_len;
2547 const u8 *fils_cache_id;
2548 const u8 *pmkid;
2549 const u8 *pmk;
2550 size_t pmk_len;
Hai Shalomfdcde762020-04-02 11:19:20 -07002551 u32 pmk_lifetime;
2552 u8 pmk_reauth_threshold;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002553};
2554
2555/* Mask used to specify which connection parameters have to be updated */
2556enum wpa_drv_update_connect_params_mask {
2557 WPA_DRV_UPDATE_ASSOC_IES = BIT(0),
2558 WPA_DRV_UPDATE_FILS_ERP_INFO = BIT(1),
2559 WPA_DRV_UPDATE_AUTH_TYPE = BIT(2),
Vinayak Yadawade62409f2022-01-20 12:32:07 +05302560#ifdef CONFIG_DRIVER_NL80211_BRCM
2561 WPA_DRV_UPDATE_TD_POLICY = BIT(3),
2562#endif /* CONFIG_DRIVER_NL80211_BRCM */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002563};
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07002564
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08002565/**
Roshan Pius3a1667e2018-07-03 15:17:14 -07002566 * struct external_auth - External authentication trigger parameters
2567 *
2568 * These are used across the external authentication request and event
2569 * interfaces.
2570 * @action: Action type / trigger for external authentication. Only significant
2571 * for the event interface.
2572 * @bssid: BSSID of the peer with which the authentication has to happen. Used
2573 * by both the request and event interface.
2574 * @ssid: SSID of the AP. Used by both the request and event interface.
2575 * @ssid_len: SSID length in octets.
2576 * @key_mgmt_suite: AKM suite of the respective authentication. Optional for
2577 * the request interface.
2578 * @status: Status code, %WLAN_STATUS_SUCCESS for successful authentication,
2579 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if wpa_supplicant cannot give
2580 * the real status code for failures. Used only for the request interface
2581 * from user space to the driver.
Hai Shalom5f92bc92019-04-18 11:54:11 -07002582 * @pmkid: Generated PMKID as part of external auth exchange (e.g., SAE).
Roshan Pius3a1667e2018-07-03 15:17:14 -07002583 */
2584struct external_auth {
2585 enum {
2586 EXT_AUTH_START,
2587 EXT_AUTH_ABORT,
2588 } action;
Hai Shalom5f92bc92019-04-18 11:54:11 -07002589 const u8 *bssid;
2590 const u8 *ssid;
Roshan Pius3a1667e2018-07-03 15:17:14 -07002591 size_t ssid_len;
2592 unsigned int key_mgmt_suite;
2593 u16 status;
Hai Shalom5f92bc92019-04-18 11:54:11 -07002594 const u8 *pmkid;
Roshan Pius3a1667e2018-07-03 15:17:14 -07002595};
2596
Hai Shalom60840252021-02-19 19:02:11 -08002597/* enum nested_attr - Used to specify if subcommand uses nested attributes */
2598enum nested_attr {
2599 NESTED_ATTR_NOT_USED = 0,
2600 NESTED_ATTR_USED = 1,
2601 NESTED_ATTR_UNSPECIFIED = 2,
2602};
2603
Roshan Pius3a1667e2018-07-03 15:17:14 -07002604/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002605 * struct wpa_driver_ops - Driver interface API definition
2606 *
2607 * This structure defines the API that each driver interface needs to implement
2608 * for core wpa_supplicant code. All driver specific functionality is captured
2609 * in this wrapper.
2610 */
2611struct wpa_driver_ops {
2612 /** Name of the driver interface */
2613 const char *name;
2614 /** One line description of the driver interface */
2615 const char *desc;
2616
2617 /**
2618 * get_bssid - Get the current BSSID
2619 * @priv: private driver interface data
2620 * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
2621 *
2622 * Returns: 0 on success, -1 on failure
2623 *
2624 * Query kernel driver for the current BSSID and copy it to bssid.
2625 * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
2626 * associated.
2627 */
2628 int (*get_bssid)(void *priv, u8 *bssid);
2629
2630 /**
2631 * get_ssid - Get the current SSID
2632 * @priv: private driver interface data
2633 * @ssid: buffer for SSID (at least 32 bytes)
2634 *
2635 * Returns: Length of the SSID on success, -1 on failure
2636 *
2637 * Query kernel driver for the current SSID and copy it to ssid.
2638 * Returning zero is recommended if the STA is not associated.
2639 *
2640 * Note: SSID is an array of octets, i.e., it is not nul terminated and
2641 * can, at least in theory, contain control characters (including nul)
2642 * and as such, should be processed as binary data, not a printable
2643 * string.
2644 */
2645 int (*get_ssid)(void *priv, u8 *ssid);
2646
2647 /**
2648 * set_key - Configure encryption key
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002649 * @priv: private driver interface data
Hai Shalomfdcde762020-04-02 11:19:20 -07002650 * @params: Key parameters
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002651 * Returns: 0 on success, -1 on failure
2652 *
2653 * Configure the given key for the kernel driver. If the driver
2654 * supports separate individual keys (4 default keys + 1 individual),
2655 * addr can be used to determine whether the key is default or
2656 * individual. If only 4 keys are supported, the default key with key
2657 * index 0 is used as the individual key. STA must be configured to use
2658 * it as the default Tx key (set_tx is set) and accept Rx for all the
2659 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
2660 * broadcast keys, so key index 0 is available for this kind of
2661 * configuration.
2662 *
2663 * Please note that TKIP keys include separate TX and RX MIC keys and
2664 * some drivers may expect them in different order than wpa_supplicant
2665 * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
2666 * will trigger Michael MIC errors. This can be fixed by changing the
Sunil Ravia04bd252022-05-02 22:54:18 -07002667 * order of MIC keys by swapping the bytes 16..23 and 24..31 of the key
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002668 * in driver_*.c set_key() implementation, see driver_ndis.c for an
2669 * example on how this can be done.
2670 */
Hai Shalomfdcde762020-04-02 11:19:20 -07002671 int (*set_key)(void *priv, struct wpa_driver_set_key_params *params);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002672
2673 /**
2674 * init - Initialize driver interface
2675 * @ctx: context to be used when calling wpa_supplicant functions,
2676 * e.g., wpa_supplicant_event()
2677 * @ifname: interface name, e.g., wlan0
2678 *
2679 * Returns: Pointer to private data, %NULL on failure
2680 *
2681 * Initialize driver interface, including event processing for kernel
2682 * driver events (e.g., associated, scan results, Michael MIC failure).
2683 * This function can allocate a private configuration data area for
2684 * @ctx, file descriptor, interface name, etc. information that may be
2685 * needed in future driver operations. If this is not used, non-NULL
2686 * value will need to be returned because %NULL is used to indicate
2687 * failure. The returned value will be used as 'void *priv' data for
2688 * all other driver_ops functions.
2689 *
2690 * The main event loop (eloop.c) of wpa_supplicant can be used to
2691 * register callback for read sockets (eloop_register_read_sock()).
2692 *
2693 * See below for more information about events and
2694 * wpa_supplicant_event() function.
2695 */
2696 void * (*init)(void *ctx, const char *ifname);
2697
2698 /**
2699 * deinit - Deinitialize driver interface
2700 * @priv: private driver interface data from init()
2701 *
2702 * Shut down driver interface and processing of driver events. Free
2703 * private data buffer if one was allocated in init() handler.
2704 */
2705 void (*deinit)(void *priv);
2706
2707 /**
2708 * set_param - Set driver configuration parameters
2709 * @priv: private driver interface data from init()
2710 * @param: driver specific configuration parameters
2711 *
2712 * Returns: 0 on success, -1 on failure
2713 *
2714 * Optional handler for notifying driver interface about configuration
2715 * parameters (driver_param).
2716 */
2717 int (*set_param)(void *priv, const char *param);
2718
2719 /**
2720 * set_countermeasures - Enable/disable TKIP countermeasures
2721 * @priv: private driver interface data
2722 * @enabled: 1 = countermeasures enabled, 0 = disabled
2723 *
2724 * Returns: 0 on success, -1 on failure
2725 *
2726 * Configure TKIP countermeasures. When these are enabled, the driver
2727 * should drop all received and queued frames that are using TKIP.
2728 */
2729 int (*set_countermeasures)(void *priv, int enabled);
2730
2731 /**
2732 * deauthenticate - Request driver to deauthenticate
2733 * @priv: private driver interface data
2734 * @addr: peer address (BSSID of the AP)
2735 * @reason_code: 16-bit reason code to be sent in the deauthentication
2736 * frame
2737 *
2738 * Returns: 0 on success, -1 on failure
2739 */
Hai Shalom81f62d82019-07-22 12:10:00 -07002740 int (*deauthenticate)(void *priv, const u8 *addr, u16 reason_code);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002741
2742 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002743 * associate - Request driver to associate
2744 * @priv: private driver interface data
2745 * @params: association parameters
2746 *
2747 * Returns: 0 on success, -1 on failure
2748 */
2749 int (*associate)(void *priv,
2750 struct wpa_driver_associate_params *params);
2751
2752 /**
2753 * add_pmkid - Add PMKSA cache entry to the driver
2754 * @priv: private driver interface data
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002755 * @params: PMKSA parameters
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002756 *
2757 * Returns: 0 on success, -1 on failure
2758 *
2759 * This function is called when a new PMK is received, as a result of
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002760 * either normal authentication or RSN pre-authentication. The PMKSA
2761 * parameters are either a set of bssid, pmkid, and pmk; or a set of
2762 * ssid, fils_cache_id, pmkid, and pmk.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002763 *
2764 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
2765 * associate(), add_pmkid() can be used to add new PMKSA cache entries
2766 * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
2767 * driver_ops function does not need to be implemented. Likewise, if
2768 * the driver does not support WPA, this function is not needed.
2769 */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002770 int (*add_pmkid)(void *priv, struct wpa_pmkid_params *params);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002771
2772 /**
2773 * remove_pmkid - Remove PMKSA cache entry to the driver
2774 * @priv: private driver interface data
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002775 * @params: PMKSA parameters
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002776 *
2777 * Returns: 0 on success, -1 on failure
2778 *
2779 * This function is called when the supplicant drops a PMKSA cache
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002780 * entry for any reason. The PMKSA parameters are either a set of
2781 * bssid and pmkid; or a set of ssid, fils_cache_id, and pmkid.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002782 *
2783 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
2784 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
2785 * between the driver and wpa_supplicant. If the driver uses wpa_ie
2786 * from wpa_supplicant, this driver_ops function does not need to be
2787 * implemented. Likewise, if the driver does not support WPA, this
2788 * function is not needed.
2789 */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002790 int (*remove_pmkid)(void *priv, struct wpa_pmkid_params *params);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002791
2792 /**
2793 * flush_pmkid - Flush PMKSA cache
2794 * @priv: private driver interface data
2795 *
2796 * Returns: 0 on success, -1 on failure
2797 *
2798 * This function is called when the supplicant drops all PMKSA cache
2799 * entries for any reason.
2800 *
2801 * If the driver generates RSN IE, i.e., it does not use wpa_ie in
2802 * associate(), remove_pmkid() can be used to synchronize PMKSA caches
2803 * between the driver and wpa_supplicant. If the driver uses wpa_ie
2804 * from wpa_supplicant, this driver_ops function does not need to be
2805 * implemented. Likewise, if the driver does not support WPA, this
2806 * function is not needed.
2807 */
2808 int (*flush_pmkid)(void *priv);
2809
2810 /**
2811 * get_capa - Get driver capabilities
2812 * @priv: private driver interface data
2813 *
2814 * Returns: 0 on success, -1 on failure
2815 *
2816 * Get driver/firmware/hardware capabilities.
2817 */
2818 int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
2819
2820 /**
2821 * poll - Poll driver for association information
2822 * @priv: private driver interface data
2823 *
2824 * This is an option callback that can be used when the driver does not
2825 * provide event mechanism for association events. This is called when
2826 * receiving WPA EAPOL-Key messages that require association
2827 * information. The driver interface is supposed to generate associnfo
2828 * event before returning from this callback function. In addition, the
2829 * driver interface should generate an association event after having
2830 * sent out associnfo.
2831 */
2832 void (*poll)(void *priv);
2833
2834 /**
Dmitry Shmidte4663042016-04-04 10:07:49 -07002835 * get_ifindex - Get interface index
2836 * @priv: private driver interface data
2837 *
2838 * Returns: Interface index
2839 */
2840 unsigned int (*get_ifindex)(void *priv);
2841
2842 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002843 * get_ifname - Get interface name
2844 * @priv: private driver interface data
2845 *
2846 * Returns: Pointer to the interface name. This can differ from the
2847 * interface name used in init() call. Init() is called first.
2848 *
2849 * This optional function can be used to allow the driver interface to
2850 * replace the interface name with something else, e.g., based on an
2851 * interface mapping from a more descriptive name.
2852 */
2853 const char * (*get_ifname)(void *priv);
2854
2855 /**
2856 * get_mac_addr - Get own MAC address
2857 * @priv: private driver interface data
2858 *
2859 * Returns: Pointer to own MAC address or %NULL on failure
2860 *
2861 * This optional function can be used to get the own MAC address of the
2862 * device from the driver interface code. This is only needed if the
2863 * l2_packet implementation for the OS does not provide easy access to
2864 * a MAC address. */
2865 const u8 * (*get_mac_addr)(void *priv);
2866
2867 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002868 * set_operstate - Sets device operating state to DORMANT or UP
2869 * @priv: private driver interface data
2870 * @state: 0 = dormant, 1 = up
2871 * Returns: 0 on success, -1 on failure
2872 *
2873 * This is an optional function that can be used on operating systems
2874 * that support a concept of controlling network device state from user
2875 * space applications. This function, if set, gets called with
2876 * state = 1 when authentication has been completed and with state = 0
2877 * when connection is lost.
2878 */
2879 int (*set_operstate)(void *priv, int state);
2880
2881 /**
2882 * mlme_setprotection - MLME-SETPROTECTION.request primitive
2883 * @priv: Private driver interface data
2884 * @addr: Address of the station for which to set protection (may be
2885 * %NULL for group keys)
2886 * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
2887 * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
2888 * Returns: 0 on success, -1 on failure
2889 *
2890 * This is an optional function that can be used to set the driver to
2891 * require protection for Tx and/or Rx frames. This uses the layer
2892 * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
2893 * (MLME-SETPROTECTION.request). Many drivers do not use explicit
2894 * set protection operation; instead, they set protection implicitly
2895 * based on configured keys.
2896 */
2897 int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
2898 int key_type);
2899
2900 /**
2901 * get_hw_feature_data - Get hardware support data (channels and rates)
2902 * @priv: Private driver interface data
2903 * @num_modes: Variable for returning the number of returned modes
2904 * flags: Variable for returning hardware feature flags
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002905 * @dfs: Variable for returning DFS region (HOSTAPD_DFS_REGION_*)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002906 * Returns: Pointer to allocated hardware data on success or %NULL on
2907 * failure. Caller is responsible for freeing this.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002908 */
2909 struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
2910 u16 *num_modes,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07002911 u16 *flags, u8 *dfs);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002912
2913 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002914 * send_mlme - Send management frame from MLME
2915 * @priv: Private driver interface data
2916 * @data: IEEE 802.11 management frame with IEEE 802.11 header
2917 * @data_len: Size of the management frame
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002918 * @noack: Do not wait for this frame to be acked (disable retries)
Dmitry Shmidta3dc3092015-06-23 11:21:28 -07002919 * @freq: Frequency (in MHz) to send the frame on, or 0 to let the
2920 * driver decide
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08002921 * @csa_offs: Array of CSA offsets or %NULL
2922 * @csa_offs_len: Number of elements in csa_offs
Hai Shalomfdcde762020-04-02 11:19:20 -07002923 * @no_encrypt: Do not encrypt frame even if appropriate key exists
2924 * (used only for testing purposes)
2925 * @wait: Time to wait off-channel for a response (in ms), or zero
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002926 * Returns: 0 on success, -1 on failure
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002927 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08002928 int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08002929 int noack, unsigned int freq, const u16 *csa_offs,
Hai Shalomfdcde762020-04-02 11:19:20 -07002930 size_t csa_offs_len, int no_encrypt,
2931 unsigned int wait);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002932
2933 /**
2934 * update_ft_ies - Update FT (IEEE 802.11r) IEs
2935 * @priv: Private driver interface data
2936 * @md: Mobility domain (2 octets) (also included inside ies)
2937 * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
2938 * @ies_len: Length of FT IEs in bytes
2939 * Returns: 0 on success, -1 on failure
2940 *
2941 * The supplicant uses this callback to let the driver know that keying
2942 * material for FT is available and that the driver can use the
2943 * provided IEs in the next message in FT authentication sequence.
2944 *
2945 * This function is only needed for driver that support IEEE 802.11r
2946 * (Fast BSS Transition).
2947 */
2948 int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
2949 size_t ies_len);
2950
2951 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002952 * get_scan_results2 - Fetch the latest scan results
2953 * @priv: private driver interface data
2954 *
2955 * Returns: Allocated buffer of scan results (caller is responsible for
2956 * freeing the data structure) on success, NULL on failure
2957 */
2958 struct wpa_scan_results * (*get_scan_results2)(void *priv);
2959
2960 /**
2961 * set_country - Set country
2962 * @priv: Private driver interface data
2963 * @alpha2: country to which to switch to
2964 * Returns: 0 on success, -1 on failure
2965 *
2966 * This function is for drivers which support some form
2967 * of setting a regulatory domain.
2968 */
2969 int (*set_country)(void *priv, const char *alpha2);
2970
2971 /**
Dmitry Shmidtcce06662013-11-04 18:44:24 -08002972 * get_country - Get country
2973 * @priv: Private driver interface data
2974 * @alpha2: Buffer for returning country code (at least 3 octets)
2975 * Returns: 0 on success, -1 on failure
2976 */
2977 int (*get_country)(void *priv, char *alpha2);
2978
2979 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002980 * global_init - Global driver initialization
Dmitry Shmidte4663042016-04-04 10:07:49 -07002981 * @ctx: wpa_global pointer
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002982 * Returns: Pointer to private data (global), %NULL on failure
2983 *
2984 * This optional function is called to initialize the driver wrapper
2985 * for global data, i.e., data that applies to all interfaces. If this
2986 * function is implemented, global_deinit() will also need to be
2987 * implemented to free the private data. The driver will also likely
2988 * use init2() function instead of init() to get the pointer to global
2989 * data available to per-interface initializer.
2990 */
Dmitry Shmidte4663042016-04-04 10:07:49 -07002991 void * (*global_init)(void *ctx);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07002992
2993 /**
2994 * global_deinit - Global driver deinitialization
2995 * @priv: private driver global data from global_init()
2996 *
2997 * Terminate any global driver related functionality and free the
2998 * global data structure.
2999 */
3000 void (*global_deinit)(void *priv);
3001
3002 /**
3003 * init2 - Initialize driver interface (with global data)
3004 * @ctx: context to be used when calling wpa_supplicant functions,
3005 * e.g., wpa_supplicant_event()
3006 * @ifname: interface name, e.g., wlan0
3007 * @global_priv: private driver global data from global_init()
3008 * Returns: Pointer to private data, %NULL on failure
3009 *
3010 * This function can be used instead of init() if the driver wrapper
3011 * uses global data.
3012 */
3013 void * (*init2)(void *ctx, const char *ifname, void *global_priv);
3014
3015 /**
3016 * get_interfaces - Get information about available interfaces
3017 * @global_priv: private driver global data from global_init()
3018 * Returns: Allocated buffer of interface information (caller is
3019 * responsible for freeing the data structure) on success, NULL on
3020 * failure
3021 */
3022 struct wpa_interface_info * (*get_interfaces)(void *global_priv);
3023
3024 /**
3025 * scan2 - Request the driver to initiate scan
3026 * @priv: private driver interface data
3027 * @params: Scan parameters
3028 *
3029 * Returns: 0 on success, -1 on failure
3030 *
3031 * Once the scan results are ready, the driver should report scan
3032 * results event for wpa_supplicant which will eventually request the
3033 * results with wpa_driver_get_scan_results2().
3034 */
3035 int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
3036
3037 /**
3038 * authenticate - Request driver to authenticate
3039 * @priv: private driver interface data
3040 * @params: authentication parameters
3041 * Returns: 0 on success, -1 on failure
3042 *
3043 * This is an optional function that can be used with drivers that
3044 * support separate authentication and association steps, i.e., when
3045 * wpa_supplicant can act as the SME. If not implemented, associate()
3046 * function is expected to take care of IEEE 802.11 authentication,
3047 * too.
3048 */
3049 int (*authenticate)(void *priv,
3050 struct wpa_driver_auth_params *params);
3051
3052 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003053 * set_ap - Set Beacon and Probe Response information for AP mode
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003054 * @priv: Private driver interface data
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003055 * @params: Parameters to use in AP mode
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003056 *
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003057 * This function is used to configure Beacon template and/or extra IEs
3058 * to add for Beacon and Probe Response frames for the driver in
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003059 * AP mode. The driver is responsible for building the full Beacon
3060 * frame by concatenating the head part with TIM IE generated by the
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003061 * driver/firmware and finishing with the tail part. Depending on the
3062 * driver architectue, this can be done either by using the full
3063 * template or the set of additional IEs (e.g., WPS and P2P IE).
3064 * Similarly, Probe Response processing depends on the driver design.
3065 * If the driver (or firmware) takes care of replying to Probe Request
3066 * frames, the extra IEs provided here needs to be added to the Probe
3067 * Response frames.
3068 *
3069 * Returns: 0 on success, -1 on failure
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003070 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003071 int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003072
3073 /**
Dmitry Shmidt8bae4132013-06-06 11:25:10 -07003074 * set_acl - Set ACL in AP mode
3075 * @priv: Private driver interface data
3076 * @params: Parameters to configure ACL
3077 * Returns: 0 on success, -1 on failure
3078 *
3079 * This is used only for the drivers which support MAC address ACL.
3080 */
3081 int (*set_acl)(void *priv, struct hostapd_acl_params *params);
3082
3083 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003084 * hapd_init - Initialize driver interface (hostapd only)
3085 * @hapd: Pointer to hostapd context
3086 * @params: Configuration for the driver wrapper
3087 * Returns: Pointer to private data, %NULL on failure
3088 *
3089 * This function is used instead of init() or init2() when the driver
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003090 * wrapper is used with hostapd.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003091 */
3092 void * (*hapd_init)(struct hostapd_data *hapd,
3093 struct wpa_init_params *params);
3094
3095 /**
3096 * hapd_deinit - Deinitialize driver interface (hostapd only)
3097 * @priv: Private driver interface data from hapd_init()
3098 */
3099 void (*hapd_deinit)(void *priv);
3100
3101 /**
3102 * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
3103 * @priv: Private driver interface data
3104 * @params: BSS parameters
3105 * Returns: 0 on success, -1 on failure
3106 *
3107 * This is an optional function to configure the kernel driver to
3108 * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
3109 * can be left undefined (set to %NULL) if IEEE 802.1X support is
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003110 * always enabled and the driver uses set_ap() to set WPA/RSN IE
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003111 * for Beacon frames.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003112 *
3113 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003114 */
3115 int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
3116
3117 /**
3118 * set_privacy - Enable/disable privacy (AP only)
3119 * @priv: Private driver interface data
3120 * @enabled: 1 = privacy enabled, 0 = disabled
3121 * Returns: 0 on success, -1 on failure
3122 *
3123 * This is an optional function to configure privacy field in the
3124 * kernel driver for Beacon frames. This can be left undefined (set to
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003125 * %NULL) if the driver uses the Beacon template from set_ap().
3126 *
3127 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003128 */
3129 int (*set_privacy)(void *priv, int enabled);
3130
3131 /**
3132 * get_seqnum - Fetch the current TSC/packet number (AP only)
3133 * @ifname: The interface name (main or virtual)
3134 * @priv: Private driver interface data
3135 * @addr: MAC address of the station or %NULL for group keys
3136 * @idx: Key index
3137 * @seq: Buffer for returning the latest used TSC/packet number
3138 * Returns: 0 on success, -1 on failure
3139 *
3140 * This function is used to fetch the last used TSC/packet number for
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07003141 * a TKIP, CCMP, GCMP, or BIP/IGTK key. It is mainly used with group
3142 * keys, so there is no strict requirement on implementing support for
3143 * unicast keys (i.e., addr != %NULL).
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003144 */
3145 int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
3146 int idx, u8 *seq);
3147
3148 /**
3149 * flush - Flush all association stations (AP only)
3150 * @priv: Private driver interface data
3151 * Returns: 0 on success, -1 on failure
3152 *
3153 * This function requests the driver to disassociate all associated
3154 * stations. This function does not need to be implemented if the
3155 * driver does not process association frames internally.
3156 */
3157 int (*flush)(void *priv);
3158
3159 /**
3160 * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
3161 * @priv: Private driver interface data
3162 * @elem: Information elements
3163 * @elem_len: Length of the elem buffer in octets
3164 * Returns: 0 on success, -1 on failure
3165 *
3166 * This is an optional function to add information elements in the
3167 * kernel driver for Beacon and Probe Response frames. This can be left
3168 * undefined (set to %NULL) if the driver uses the Beacon template from
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003169 * set_ap().
3170 *
3171 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003172 */
3173 int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
3174
3175 /**
Jouni Malinen1e6c57f2012-09-05 17:07:03 +03003176 * read_sta_data - Fetch station data
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003177 * @priv: Private driver interface data
3178 * @data: Buffer for returning station information
3179 * @addr: MAC address of the station
3180 * Returns: 0 on success, -1 on failure
3181 */
3182 int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
3183 const u8 *addr);
3184
3185 /**
Hai Shalomfdcde762020-04-02 11:19:20 -07003186 * tx_control_port - Send a frame over the 802.1X controlled port
3187 * @priv: Private driver interface data
3188 * @dest: Destination MAC address
3189 * @proto: Ethertype in host byte order
3190 * @buf: Frame payload starting from IEEE 802.1X header
3191 * @len: Frame payload length
3192 * @no_encrypt: Do not encrypt frame
3193 *
3194 * Returns 0 on success, else an error
3195 *
3196 * This is like a normal Ethernet send except that the driver is aware
3197 * (by other means than the Ethertype) that this frame is special,
3198 * and more importantly it gains an ordering between the transmission of
3199 * the frame and other driver management operations such as key
3200 * installations. This can be used to work around known limitations in
3201 * IEEE 802.11 protocols such as race conditions between rekeying 4-way
3202 * handshake message 4/4 and a PTK being overwritten.
3203 *
3204 * This function is only used for a given interface if the driver
3205 * instance reports WPA_DRIVER_FLAGS_CONTROL_PORT capability. Otherwise,
3206 * API users will fall back to sending the frame via a normal socket.
3207 */
3208 int (*tx_control_port)(void *priv, const u8 *dest,
3209 u16 proto, const u8 *buf, size_t len,
3210 int no_encrypt);
3211
3212 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003213 * hapd_send_eapol - Send an EAPOL packet (AP only)
3214 * @priv: private driver interface data
3215 * @addr: Destination MAC address
3216 * @data: EAPOL packet starting with IEEE 802.1X header
3217 * @data_len: Length of the EAPOL packet in octets
3218 * @encrypt: Whether the frame should be encrypted
3219 * @own_addr: Source MAC address
3220 * @flags: WPA_STA_* flags for the destination station
3221 *
3222 * Returns: 0 on success, -1 on failure
3223 */
3224 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
3225 size_t data_len, int encrypt,
3226 const u8 *own_addr, u32 flags);
3227
3228 /**
3229 * sta_deauth - Deauthenticate a station (AP only)
3230 * @priv: Private driver interface data
3231 * @own_addr: Source address and BSSID for the Deauthentication frame
3232 * @addr: MAC address of the station to deauthenticate
3233 * @reason: Reason code for the Deauthentiation frame
3234 * Returns: 0 on success, -1 on failure
3235 *
3236 * This function requests a specific station to be deauthenticated and
3237 * a Deauthentication frame to be sent to it.
3238 */
3239 int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
Hai Shalom81f62d82019-07-22 12:10:00 -07003240 u16 reason);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003241
3242 /**
3243 * sta_disassoc - Disassociate a station (AP only)
3244 * @priv: Private driver interface data
3245 * @own_addr: Source address and BSSID for the Disassociation frame
3246 * @addr: MAC address of the station to disassociate
3247 * @reason: Reason code for the Disassociation frame
3248 * Returns: 0 on success, -1 on failure
3249 *
3250 * This function requests a specific station to be disassociated and
3251 * a Disassociation frame to be sent to it.
3252 */
3253 int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
Hai Shalom81f62d82019-07-22 12:10:00 -07003254 u16 reason);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003255
3256 /**
3257 * sta_remove - Remove a station entry (AP only)
3258 * @priv: Private driver interface data
3259 * @addr: MAC address of the station to be removed
3260 * Returns: 0 on success, -1 on failure
3261 */
3262 int (*sta_remove)(void *priv, const u8 *addr);
3263
3264 /**
3265 * hapd_get_ssid - Get the current SSID (AP only)
3266 * @priv: Private driver interface data
3267 * @buf: Buffer for returning the SSID
3268 * @len: Maximum length of the buffer
3269 * Returns: Length of the SSID on success, -1 on failure
3270 *
3271 * This function need not be implemented if the driver uses Beacon
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003272 * template from set_ap() and does not reply to Probe Request frames.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003273 */
3274 int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
3275
3276 /**
3277 * hapd_set_ssid - Set SSID (AP only)
3278 * @priv: Private driver interface data
3279 * @buf: SSID
3280 * @len: Length of the SSID in octets
3281 * Returns: 0 on success, -1 on failure
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003282 *
3283 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003284 */
3285 int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
3286
3287 /**
3288 * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
3289 * @priv: Private driver interface data
3290 * @enabled: 1 = countermeasures enabled, 0 = disabled
3291 * Returns: 0 on success, -1 on failure
3292 *
3293 * This need not be implemented if the driver does not take care of
3294 * association processing.
3295 */
3296 int (*hapd_set_countermeasures)(void *priv, int enabled);
3297
3298 /**
3299 * sta_add - Add a station entry
3300 * @priv: Private driver interface data
3301 * @params: Station parameters
3302 * Returns: 0 on success, -1 on failure
3303 *
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08003304 * This function is used to add or set (params->set 1) a station
3305 * entry in the driver. Adding STA entries is used only if the driver
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003306 * does not take care of association processing.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003307 *
Dmitry Shmidt57c2d392016-02-23 13:40:19 -08003308 * With drivers that don't support full AP client state, this function
3309 * is used to add a station entry to the driver once the station has
3310 * completed association.
3311 *
3312 * With TDLS, this function is used to add or set (params->set 1)
3313 * TDLS peer entries (even with drivers that do not support full AP
3314 * client state).
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003315 */
3316 int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
3317
3318 /**
3319 * get_inact_sec - Get station inactivity duration (AP only)
3320 * @priv: Private driver interface data
3321 * @addr: Station address
3322 * Returns: Number of seconds station has been inactive, -1 on failure
3323 */
3324 int (*get_inact_sec)(void *priv, const u8 *addr);
3325
3326 /**
3327 * sta_clear_stats - Clear station statistics (AP only)
3328 * @priv: Private driver interface data
3329 * @addr: Station address
3330 * Returns: 0 on success, -1 on failure
3331 */
3332 int (*sta_clear_stats)(void *priv, const u8 *addr);
3333
3334 /**
3335 * set_freq - Set channel/frequency (AP only)
3336 * @priv: Private driver interface data
3337 * @freq: Channel parameters
3338 * Returns: 0 on success, -1 on failure
3339 */
3340 int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
3341
3342 /**
3343 * set_rts - Set RTS threshold
3344 * @priv: Private driver interface data
3345 * @rts: RTS threshold in octets
3346 * Returns: 0 on success, -1 on failure
3347 */
3348 int (*set_rts)(void *priv, int rts);
3349
3350 /**
3351 * set_frag - Set fragmentation threshold
3352 * @priv: Private driver interface data
3353 * @frag: Fragmentation threshold in octets
3354 * Returns: 0 on success, -1 on failure
3355 */
3356 int (*set_frag)(void *priv, int frag);
3357
3358 /**
3359 * sta_set_flags - Set station flags (AP only)
3360 * @priv: Private driver interface data
3361 * @addr: Station address
3362 * @total_flags: Bitmap of all WPA_STA_* flags currently set
3363 * @flags_or: Bitmap of WPA_STA_* flags to add
3364 * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
3365 * Returns: 0 on success, -1 on failure
3366 */
3367 int (*sta_set_flags)(void *priv, const u8 *addr,
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08003368 unsigned int total_flags, unsigned int flags_or,
3369 unsigned int flags_and);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003370
3371 /**
Hai Shalom81f62d82019-07-22 12:10:00 -07003372 * sta_set_airtime_weight - Set station airtime weight (AP only)
3373 * @priv: Private driver interface data
3374 * @addr: Station address
3375 * @weight: New weight for station airtime assignment
3376 * Returns: 0 on success, -1 on failure
3377 */
3378 int (*sta_set_airtime_weight)(void *priv, const u8 *addr,
3379 unsigned int weight);
3380
3381 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003382 * set_tx_queue_params - Set TX queue parameters
3383 * @priv: Private driver interface data
3384 * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
3385 * @aifs: AIFS
3386 * @cw_min: cwMin
3387 * @cw_max: cwMax
3388 * @burst_time: Maximum length for bursting in 0.1 msec units
3389 */
3390 int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
3391 int cw_max, int burst_time);
3392
3393 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003394 * if_add - Add a virtual interface
3395 * @priv: Private driver interface data
3396 * @type: Interface type
3397 * @ifname: Interface name for the new virtual interface
3398 * @addr: Local address to use for the interface or %NULL to use the
3399 * parent interface address
3400 * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
3401 * @drv_priv: Pointer for overwriting the driver context or %NULL if
3402 * not allowed (applies only to %WPA_IF_AP_BSS type)
3403 * @force_ifname: Buffer for returning an interface name that the
3404 * driver ended up using if it differs from the requested ifname
3405 * @if_addr: Buffer for returning the allocated interface address
3406 * (this may differ from the requested addr if the driver cannot
3407 * change interface address)
3408 * @bridge: Bridge interface to use or %NULL if no bridge configured
Dmitry Shmidtcce06662013-11-04 18:44:24 -08003409 * @use_existing: Whether to allow existing interface to be used
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -08003410 * @setup_ap: Whether to setup AP for %WPA_IF_AP_BSS interfaces
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003411 * Returns: 0 on success, -1 on failure
3412 */
3413 int (*if_add)(void *priv, enum wpa_driver_if_type type,
3414 const char *ifname, const u8 *addr, void *bss_ctx,
3415 void **drv_priv, char *force_ifname, u8 *if_addr,
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -08003416 const char *bridge, int use_existing, int setup_ap);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003417
3418 /**
3419 * if_remove - Remove a virtual interface
3420 * @priv: Private driver interface data
3421 * @type: Interface type
3422 * @ifname: Interface name of the virtual interface to be removed
3423 * Returns: 0 on success, -1 on failure
3424 */
3425 int (*if_remove)(void *priv, enum wpa_driver_if_type type,
3426 const char *ifname);
3427
3428 /**
3429 * set_sta_vlan - Bind a station into a specific interface (AP only)
3430 * @priv: Private driver interface data
3431 * @ifname: Interface (main or virtual BSS or VLAN)
3432 * @addr: MAC address of the associated station
3433 * @vlan_id: VLAN ID
3434 * Returns: 0 on success, -1 on failure
3435 *
3436 * This function is used to bind a station to a specific virtual
3437 * interface. It is only used if when virtual interfaces are supported,
3438 * e.g., to assign stations to different VLAN interfaces based on
3439 * information from a RADIUS server. This allows separate broadcast
3440 * domains to be used with a single BSS.
3441 */
3442 int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
3443 int vlan_id);
3444
3445 /**
3446 * commit - Optional commit changes handler (AP only)
3447 * @priv: driver private data
3448 * Returns: 0 on success, -1 on failure
3449 *
3450 * This optional handler function can be registered if the driver
3451 * interface implementation needs to commit changes (e.g., by setting
3452 * network interface up) at the end of initial configuration. If set,
3453 * this handler will be called after initial setup has been completed.
3454 */
3455 int (*commit)(void *priv);
3456
3457 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003458 * set_radius_acl_auth - Notification of RADIUS ACL change
3459 * @priv: Private driver interface data
3460 * @mac: MAC address of the station
3461 * @accepted: Whether the station was accepted
3462 * @session_timeout: Session timeout for the station
3463 * Returns: 0 on success, -1 on failure
3464 */
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07003465 int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003466 u32 session_timeout);
3467
3468 /**
3469 * set_radius_acl_expire - Notification of RADIUS ACL expiration
3470 * @priv: Private driver interface data
3471 * @mac: MAC address of the station
3472 * Returns: 0 on success, -1 on failure
3473 */
3474 int (*set_radius_acl_expire)(void *priv, const u8 *mac);
3475
3476 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003477 * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
3478 * @priv: Private driver interface data
3479 * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
3480 * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
3481 * extra IE(s)
3482 * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
3483 * to remove extra IE(s)
3484 * Returns: 0 on success, -1 on failure
3485 *
3486 * This is an optional function to add WPS IE in the kernel driver for
3487 * Beacon and Probe Response frames. This can be left undefined (set
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003488 * to %NULL) if the driver uses the Beacon template from set_ap()
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003489 * and does not process Probe Request frames. If the driver takes care
3490 * of (Re)Association frame processing, the assocresp buffer includes
3491 * WPS IE(s) that need to be added to (Re)Association Response frames
3492 * whenever a (Re)Association Request frame indicated use of WPS.
3493 *
3494 * This will also be used to add P2P IE(s) into Beacon/Probe Response
3495 * frames when operating as a GO. The driver is responsible for adding
3496 * timing related attributes (e.g., NoA) in addition to the IEs
3497 * included here by appending them after these buffers. This call is
3498 * also used to provide Probe Response IEs for P2P Listen state
3499 * operations for drivers that generate the Probe Response frames
3500 * internally.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003501 *
3502 * DEPRECATED - use set_ap() instead
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003503 */
3504 int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
3505 const struct wpabuf *proberesp,
3506 const struct wpabuf *assocresp);
3507
3508 /**
3509 * set_supp_port - Set IEEE 802.1X Supplicant Port status
3510 * @priv: Private driver interface data
3511 * @authorized: Whether the port is authorized
3512 * Returns: 0 on success, -1 on failure
3513 */
3514 int (*set_supp_port)(void *priv, int authorized);
3515
3516 /**
3517 * set_wds_sta - Bind a station into a 4-address WDS (AP only)
3518 * @priv: Private driver interface data
3519 * @addr: MAC address of the associated station
3520 * @aid: Association ID
3521 * @val: 1 = bind to 4-address WDS; 0 = unbind
3522 * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
3523 * to indicate that bridge is not to be used
Dmitry Shmidtc2ebb4b2013-07-24 12:57:51 -07003524 * @ifname_wds: Buffer to return the interface name for the new WDS
3525 * station or %NULL to indicate name is not returned.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003526 * Returns: 0 on success, -1 on failure
3527 */
3528 int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07003529 const char *bridge_ifname, char *ifname_wds);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003530
3531 /**
3532 * send_action - Transmit an Action frame
3533 * @priv: Private driver interface data
3534 * @freq: Frequency (in MHz) of the channel
3535 * @wait: Time to wait off-channel for a response (in ms), or zero
3536 * @dst: Destination MAC address (Address 1)
3537 * @src: Source MAC address (Address 2)
3538 * @bssid: BSSID (Address 3)
3539 * @data: Frame body
3540 * @data_len: data length in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003541 @ @no_cck: Whether CCK rates must not be used to transmit this frame
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003542 * Returns: 0 on success, -1 on failure
3543 *
3544 * This command can be used to request the driver to transmit an action
3545 * frame to the specified destination.
3546 *
3547 * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
3548 * be transmitted on the given channel and the device will wait for a
3549 * response on that channel for the given wait time.
3550 *
3551 * If the flag is not set, the wait time will be ignored. In this case,
3552 * if a remain-on-channel duration is in progress, the frame must be
3553 * transmitted on that channel; alternatively the frame may be sent on
3554 * the current operational channel (if in associated state in station
3555 * mode or while operating as an AP.)
Dmitry Shmidtebd93af2017-02-21 13:40:44 -08003556 *
3557 * If @src differs from the device MAC address, use of a random
3558 * transmitter address is requested for this message exchange.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003559 */
3560 int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
3561 const u8 *dst, const u8 *src, const u8 *bssid,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003562 const u8 *data, size_t data_len, int no_cck);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003563
3564 /**
3565 * send_action_cancel_wait - Cancel action frame TX wait
3566 * @priv: Private driver interface data
3567 *
3568 * This command cancels the wait time associated with sending an action
3569 * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
3570 * set in the driver flags.
3571 */
3572 void (*send_action_cancel_wait)(void *priv);
3573
3574 /**
3575 * remain_on_channel - Remain awake on a channel
3576 * @priv: Private driver interface data
3577 * @freq: Frequency (in MHz) of the channel
3578 * @duration: Duration in milliseconds
3579 * Returns: 0 on success, -1 on failure
3580 *
3581 * This command is used to request the driver to remain awake on the
3582 * specified channel for the specified duration and report received
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08003583 * Action frames with EVENT_RX_MGMT events. Optionally, received
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003584 * Probe Request frames may also be requested to be reported by calling
3585 * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
3586 *
3587 * The driver may not be at the requested channel when this function
3588 * returns, i.e., the return code is only indicating whether the
3589 * request was accepted. The caller will need to wait until the
3590 * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
3591 * completed the channel change. This may take some time due to other
3592 * need for the radio and the caller should be prepared to timing out
3593 * its wait since there are no guarantees on when this request can be
3594 * executed.
3595 */
3596 int (*remain_on_channel)(void *priv, unsigned int freq,
3597 unsigned int duration);
3598
3599 /**
3600 * cancel_remain_on_channel - Cancel remain-on-channel operation
3601 * @priv: Private driver interface data
3602 *
3603 * This command can be used to cancel a remain-on-channel operation
3604 * before its originally requested duration has passed. This could be
3605 * used, e.g., when remain_on_channel() is used to request extra time
3606 * to receive a response to an Action frame and the response is
3607 * received when there is still unneeded time remaining on the
3608 * remain-on-channel operation.
3609 */
3610 int (*cancel_remain_on_channel)(void *priv);
3611
3612 /**
3613 * probe_req_report - Request Probe Request frames to be indicated
3614 * @priv: Private driver interface data
3615 * @report: Whether to report received Probe Request frames
3616 * Returns: 0 on success, -1 on failure (or if not supported)
3617 *
3618 * This command can be used to request the driver to indicate when
3619 * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
3620 * Since this operation may require extra resources, e.g., due to less
3621 * optimal hardware/firmware RX filtering, many drivers may disable
3622 * Probe Request reporting at least in station mode. This command is
3623 * used to notify the driver when the Probe Request frames need to be
3624 * reported, e.g., during remain-on-channel operations.
3625 */
3626 int (*probe_req_report)(void *priv, int report);
3627
3628 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003629 * deinit_ap - Deinitialize AP mode
3630 * @priv: Private driver interface data
3631 * Returns: 0 on success, -1 on failure (or if not supported)
3632 *
3633 * This optional function can be used to disable AP mode related
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07003634 * configuration. If the interface was not dynamically added,
3635 * change the driver mode to station mode to allow normal station
3636 * operations like scanning to be completed.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003637 */
3638 int (*deinit_ap)(void *priv);
3639
3640 /**
Dmitry Shmidt04949592012-07-19 12:16:46 -07003641 * deinit_p2p_cli - Deinitialize P2P client mode
3642 * @priv: Private driver interface data
3643 * Returns: 0 on success, -1 on failure (or if not supported)
3644 *
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07003645 * This optional function can be used to disable P2P client mode. If the
3646 * interface was not dynamically added, change the interface type back
3647 * to station mode.
Dmitry Shmidt04949592012-07-19 12:16:46 -07003648 */
3649 int (*deinit_p2p_cli)(void *priv);
3650
3651 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003652 * suspend - Notification on system suspend/hibernate event
3653 * @priv: Private driver interface data
3654 */
3655 void (*suspend)(void *priv);
3656
3657 /**
3658 * resume - Notification on system resume/thaw event
3659 * @priv: Private driver interface data
3660 */
3661 void (*resume)(void *priv);
3662
3663 /**
3664 * signal_monitor - Set signal monitoring parameters
3665 * @priv: Private driver interface data
3666 * @threshold: Threshold value for signal change events; 0 = disabled
3667 * @hysteresis: Minimum change in signal strength before indicating a
3668 * new event
3669 * Returns: 0 on success, -1 on failure (or if not supported)
3670 *
3671 * This function can be used to configure monitoring of signal strength
3672 * with the current AP. Whenever signal strength drops below the
3673 * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
3674 * should be generated assuming the signal strength has changed at
3675 * least %hysteresis from the previously indicated signal change event.
3676 */
3677 int (*signal_monitor)(void *priv, int threshold, int hysteresis);
3678
3679 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003680 * get_noa - Get current Notice of Absence attribute payload
3681 * @priv: Private driver interface data
3682 * @buf: Buffer for returning NoA
3683 * @buf_len: Buffer length in octets
3684 * Returns: Number of octets used in buf, 0 to indicate no NoA is being
3685 * advertized, or -1 on failure
3686 *
3687 * This function is used to fetch the current Notice of Absence
3688 * attribute value from GO.
3689 */
3690 int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
3691
3692 /**
3693 * set_noa - Set Notice of Absence parameters for GO (testing)
3694 * @priv: Private driver interface data
3695 * @count: Count
3696 * @start: Start time in ms from next TBTT
3697 * @duration: Duration in ms
3698 * Returns: 0 on success or -1 on failure
3699 *
3700 * This function is used to set Notice of Absence parameters for GO. It
3701 * is used only for testing. To disable NoA, all parameters are set to
3702 * 0.
3703 */
3704 int (*set_noa)(void *priv, u8 count, int start, int duration);
3705
3706 /**
3707 * set_p2p_powersave - Set P2P power save options
3708 * @priv: Private driver interface data
3709 * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
3710 * @opp_ps: 0 = disable, 1 = enable, -1 = no change
3711 * @ctwindow: 0.. = change (msec), -1 = no change
3712 * Returns: 0 on success or -1 on failure
3713 */
3714 int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
3715 int ctwindow);
3716
3717 /**
3718 * ampdu - Enable/disable aggregation
3719 * @priv: Private driver interface data
3720 * @ampdu: 1/0 = enable/disable A-MPDU aggregation
3721 * Returns: 0 on success or -1 on failure
3722 */
3723 int (*ampdu)(void *priv, int ampdu);
3724
3725 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003726 * get_radio_name - Get physical radio name for the device
3727 * @priv: Private driver interface data
3728 * Returns: Radio name or %NULL if not known
3729 *
3730 * The returned data must not be modified by the caller. It is assumed
3731 * that any interface that has the same radio name as another is
3732 * sharing the same physical radio. This information can be used to
3733 * share scan results etc. information between the virtual interfaces
3734 * to speed up various operations.
3735 */
3736 const char * (*get_radio_name)(void *priv);
3737
3738 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003739 * send_tdls_mgmt - for sending TDLS management packets
3740 * @priv: private driver interface data
3741 * @dst: Destination (peer) MAC address
3742 * @action_code: TDLS action code for the mssage
3743 * @dialog_token: Dialog Token to use in the message (if needed)
3744 * @status_code: Status Code or Reason Code to use (if needed)
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -07003745 * @peer_capab: TDLS peer capability (TDLS_PEER_* bitfield)
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -07003746 * @initiator: Is the current end the TDLS link initiator
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003747 * @buf: TDLS IEs to add to the message
3748 * @len: Length of buf in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003749 * Returns: 0 on success, negative (<0) on failure
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003750 *
3751 * This optional function can be used to send packet to driver which is
3752 * responsible for receiving and sending all TDLS packets.
3753 */
3754 int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -07003755 u8 dialog_token, u16 status_code, u32 peer_capab,
Dmitry Shmidt9ead16e2014-10-07 13:15:23 -07003756 int initiator, const u8 *buf, size_t len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003757
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003758 /**
3759 * tdls_oper - Ask the driver to perform high-level TDLS operations
3760 * @priv: Private driver interface data
3761 * @oper: TDLS high-level operation. See %enum tdls_oper
3762 * @peer: Destination (peer) MAC address
3763 * Returns: 0 on success, negative (<0) on failure
3764 *
3765 * This optional function can be used to send high-level TDLS commands
3766 * to the driver.
3767 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003768 int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
3769
3770 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07003771 * wnm_oper - Notify driver of the WNM frame reception
3772 * @priv: Private driver interface data
3773 * @oper: WNM operation. See %enum wnm_oper
3774 * @peer: Destination (peer) MAC address
3775 * @buf: Buffer for the driver to fill in (for getting IE)
3776 * @buf_len: Return the len of buf
3777 * Returns: 0 on success, negative (<0) on failure
3778 */
3779 int (*wnm_oper)(void *priv, enum wnm_oper oper, const u8 *peer,
3780 u8 *buf, u16 *buf_len);
3781
3782 /**
Dmitry Shmidt051af732013-10-22 13:52:46 -07003783 * set_qos_map - Set QoS Map
3784 * @priv: Private driver interface data
3785 * @qos_map_set: QoS Map
3786 * @qos_map_set_len: Length of QoS Map
3787 */
3788 int (*set_qos_map)(void *priv, const u8 *qos_map_set,
3789 u8 qos_map_set_len);
3790
3791 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08003792 * br_add_ip_neigh - Add a neigh to the bridge ip neigh table
3793 * @priv: Private driver interface data
3794 * @version: IP version of the IP address, 4 or 6
3795 * @ipaddr: IP address for the neigh entry
3796 * @prefixlen: IP address prefix length
3797 * @addr: Corresponding MAC address
3798 * Returns: 0 on success, negative (<0) on failure
3799 */
3800 int (*br_add_ip_neigh)(void *priv, u8 version, const u8 *ipaddr,
3801 int prefixlen, const u8 *addr);
3802
3803 /**
3804 * br_delete_ip_neigh - Remove a neigh from the bridge ip neigh table
3805 * @priv: Private driver interface data
3806 * @version: IP version of the IP address, 4 or 6
3807 * @ipaddr: IP address for the neigh entry
3808 * Returns: 0 on success, negative (<0) on failure
3809 */
3810 int (*br_delete_ip_neigh)(void *priv, u8 version, const u8 *ipaddr);
3811
3812 /**
3813 * br_port_set_attr - Set a bridge port attribute
3814 * @attr: Bridge port attribute to set
3815 * @val: Value to be set
3816 * Returns: 0 on success, negative (<0) on failure
3817 */
3818 int (*br_port_set_attr)(void *priv, enum drv_br_port_attr attr,
3819 unsigned int val);
3820
3821 /**
3822 * br_port_set_attr - Set a bridge network parameter
3823 * @param: Bridge parameter to set
3824 * @val: Value to be set
3825 * Returns: 0 on success, negative (<0) on failure
3826 */
3827 int (*br_set_net_param)(void *priv, enum drv_br_net_param param,
3828 unsigned int val);
3829
3830 /**
Hai Shalomfdcde762020-04-02 11:19:20 -07003831 * get_wowlan - Get wake-on-wireless status
3832 * @priv: Private driver interface data
3833 */
3834 int (*get_wowlan)(void *priv);
3835
3836 /**
Dmitry Shmidtb58836e2014-04-29 14:35:56 -07003837 * set_wowlan - Set wake-on-wireless triggers
3838 * @priv: Private driver interface data
3839 * @triggers: wowlan triggers
3840 */
3841 int (*set_wowlan)(void *priv, const struct wowlan_triggers *triggers);
3842
3843 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003844 * signal_poll - Get current connection information
3845 * @priv: Private driver interface data
3846 * @signal_info: Connection info structure
Dmitry Shmidt7832adb2014-04-29 10:53:02 -07003847 */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07003848 int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
Dmitry Shmidtbd567ad2011-05-09 14:17:09 -07003849
3850 /**
Hai Shalom74f70d42019-02-11 14:42:39 -08003851 * channel_info - Get parameters of the current operating channel
3852 * @priv: Private driver interface data
3853 * @channel_info: Channel info structure
3854 * Returns: 0 on success, negative (<0) on failure
3855 */
3856 int (*channel_info)(void *priv, struct wpa_channel_info *channel_info);
3857
3858 /**
Jouni Malinen75ecf522011-06-27 15:19:46 -07003859 * set_authmode - Set authentication algorithm(s) for static WEP
3860 * @priv: Private driver interface data
3861 * @authmode: 1=Open System, 2=Shared Key, 3=both
3862 * Returns: 0 on success, -1 on failure
3863 *
3864 * This function can be used to set authentication algorithms for AP
3865 * mode when static WEP is used. If the driver uses user space MLME/SME
3866 * implementation, there is no need to implement this function.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003867 *
3868 * DEPRECATED - use set_ap() instead
Jouni Malinen75ecf522011-06-27 15:19:46 -07003869 */
3870 int (*set_authmode)(void *priv, int authmode);
Dmitry Shmidt292b0c32013-11-22 12:54:42 -08003871
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003872#ifdef ANDROID
Jouni Malinen75ecf522011-06-27 15:19:46 -07003873 /**
Dmitry Shmidt292b0c32013-11-22 12:54:42 -08003874 * driver_cmd - Execute driver-specific command
3875 * @priv: Private driver interface data
3876 * @cmd: Command to execute
3877 * @buf: Return buffer
3878 * @buf_len: Buffer length
Dmitry Shmidtbd567ad2011-05-09 14:17:09 -07003879 * Returns: 0 on success, -1 on failure
3880 */
Dmitry Shmidt292b0c32013-11-22 12:54:42 -08003881 int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
3882#endif /* ANDROID */
3883
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003884 /**
Dmitry Shmidta38abf92014-03-06 13:38:44 -08003885 * vendor_cmd - Execute vendor specific command
3886 * @priv: Private driver interface data
3887 * @vendor_id: Vendor id
3888 * @subcmd: Vendor command id
Hai Shalom60840252021-02-19 19:02:11 -08003889 * @nested_attr_flag: Specifies if vendor subcommand uses nested
3890 * attributes or not
Dmitry Shmidta38abf92014-03-06 13:38:44 -08003891 * @data: Vendor command parameters (%NULL if no parameters)
3892 * @data_len: Data length
3893 * @buf: Return buffer (%NULL to ignore reply)
3894 * Returns: 0 on success, negative (<0) on failure
3895 *
3896 * This function handles vendor specific commands that are passed to
3897 * the driver/device. The command is identified by vendor id and
Hai Shalom60840252021-02-19 19:02:11 -08003898 * command id. The nested_attr_flag specifies whether the subcommand
3899 * uses nested attributes or not. Parameters can be passed
3900 * as argument to the command in the data buffer. Reply (if any) will be
3901 * filled in the supplied return buffer.
Dmitry Shmidta38abf92014-03-06 13:38:44 -08003902 *
3903 * The exact driver behavior is driver interface and vendor specific. As
3904 * an example, this will be converted to a vendor specific cfg80211
3905 * command in case of the nl80211 driver interface.
3906 */
3907 int (*vendor_cmd)(void *priv, unsigned int vendor_id,
3908 unsigned int subcmd, const u8 *data, size_t data_len,
Hai Shalom60840252021-02-19 19:02:11 -08003909 enum nested_attr nested_attr_flag,
Dmitry Shmidta38abf92014-03-06 13:38:44 -08003910 struct wpabuf *buf);
3911
3912 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003913 * set_rekey_info - Set rekey information
3914 * @priv: Private driver interface data
3915 * @kek: Current KEK
Dmitry Shmidt807291d2015-01-27 13:40:23 -08003916 * @kek_len: KEK length in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003917 * @kck: Current KCK
Dmitry Shmidt807291d2015-01-27 13:40:23 -08003918 * @kck_len: KCK length in octets
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003919 * @replay_ctr: Current EAPOL-Key Replay Counter
3920 *
3921 * This optional function can be used to provide information for the
3922 * driver/firmware to process EAPOL-Key frames in Group Key Handshake
3923 * while the host (including wpa_supplicant) is sleeping.
3924 */
Dmitry Shmidt807291d2015-01-27 13:40:23 -08003925 void (*set_rekey_info)(void *priv, const u8 *kek, size_t kek_len,
3926 const u8 *kck, size_t kck_len,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003927 const u8 *replay_ctr);
3928
3929 /**
3930 * sta_assoc - Station association indication
3931 * @priv: Private driver interface data
3932 * @own_addr: Source address and BSSID for association frame
3933 * @addr: MAC address of the station to associate
3934 * @reassoc: flag to indicate re-association
3935 * @status: association response status code
3936 * @ie: assoc response ie buffer
3937 * @len: ie buffer length
3938 * Returns: 0 on success, -1 on failure
3939 *
3940 * This function indicates the driver to send (Re)Association
3941 * Response frame to the station.
3942 */
3943 int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
3944 int reassoc, u16 status, const u8 *ie, size_t len);
3945
3946 /**
3947 * sta_auth - Station authentication indication
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07003948 * @priv: private driver interface data
3949 * @params: Station authentication parameters
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003950 *
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07003951 * Returns: 0 on success, -1 on failure
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003952 */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07003953 int (*sta_auth)(void *priv,
3954 struct wpa_driver_sta_auth_params *params);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003955
3956 /**
3957 * add_tspec - Add traffic stream
3958 * @priv: Private driver interface data
3959 * @addr: MAC address of the station to associate
3960 * @tspec_ie: tspec ie buffer
3961 * @tspec_ielen: tspec ie length
3962 * Returns: 0 on success, -1 on failure
3963 *
3964 * This function adds the traffic steam for the station
3965 * and fills the medium_time in tspec_ie.
3966 */
3967 int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
3968 size_t tspec_ielen);
3969
3970 /**
3971 * add_sta_node - Add a station node in the driver
3972 * @priv: Private driver interface data
3973 * @addr: MAC address of the station to add
3974 * @auth_alg: authentication algorithm used by the station
3975 * Returns: 0 on success, -1 on failure
3976 *
3977 * This function adds the station node in the driver, when
3978 * the station gets added by FT-over-DS.
3979 */
3980 int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
3981
3982 /**
3983 * sched_scan - Request the driver to initiate scheduled scan
3984 * @priv: Private driver interface data
3985 * @params: Scan parameters
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003986 * Returns: 0 on success, -1 on failure
3987 *
3988 * This operation should be used for scheduled scan offload to
3989 * the hardware. Every time scan results are available, the
3990 * driver should report scan results event for wpa_supplicant
3991 * which will eventually request the results with
3992 * wpa_driver_get_scan_results2(). This operation is optional
3993 * and if not provided or if it returns -1, we fall back to
3994 * normal host-scheduled scans.
3995 */
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -08003996 int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08003997
3998 /**
3999 * stop_sched_scan - Request the driver to stop a scheduled scan
4000 * @priv: Private driver interface data
4001 * Returns: 0 on success, -1 on failure
4002 *
4003 * This should cause the scheduled scan to be stopped and
4004 * results should stop being sent. Must be supported if
4005 * sched_scan is supported.
4006 */
4007 int (*stop_sched_scan)(void *priv);
4008
4009 /**
4010 * poll_client - Probe (null data or such) the given station
4011 * @priv: Private driver interface data
4012 * @own_addr: MAC address of sending interface
4013 * @addr: MAC address of the station to probe
4014 * @qos: Indicates whether station is QoS station
4015 *
4016 * This function is used to verify whether an associated station is
4017 * still present. This function does not need to be implemented if the
4018 * driver provides such inactivity polling mechanism.
4019 */
4020 void (*poll_client)(void *priv, const u8 *own_addr,
4021 const u8 *addr, int qos);
Dmitry Shmidt04949592012-07-19 12:16:46 -07004022
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004023 /**
Dmitry Shmidt04949592012-07-19 12:16:46 -07004024 * radio_disable - Disable/enable radio
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004025 * @priv: Private driver interface data
Dmitry Shmidt04949592012-07-19 12:16:46 -07004026 * @disabled: 1=disable 0=enable radio
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004027 * Returns: 0 on success, -1 on failure
4028 *
Dmitry Shmidt04949592012-07-19 12:16:46 -07004029 * This optional command is for testing purposes. It can be used to
4030 * disable the radio on a testbed device to simulate out-of-radio-range
4031 * conditions.
4032 */
4033 int (*radio_disable)(void *priv, int disabled);
4034
4035 /**
4036 * switch_channel - Announce channel switch and migrate the GO to the
4037 * given frequency
4038 * @priv: Private driver interface data
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08004039 * @settings: Settings for CSA period and new channel
Dmitry Shmidt04949592012-07-19 12:16:46 -07004040 * Returns: 0 on success, -1 on failure
4041 *
4042 * This function is used to move the GO to the legacy STA channel to
4043 * avoid frequency conflict in single channel concurrency.
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004044 */
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08004045 int (*switch_channel)(void *priv, struct csa_settings *settings);
Dmitry Shmidtea69e842013-05-13 14:52:28 -07004046
4047 /**
Sunil Ravia04bd252022-05-02 22:54:18 -07004048 * switch_color - Announce color switch and migrate the BSS to the
4049 * given color
4050 * @priv: Private driver interface data
4051 * @settings: Settings for CCA period and new color
4052 * Returns: 0 on success, -1 on failure
4053 *
4054 * This function is used to move the BSS to its new color.
4055 */
4056 int (*switch_color)(void *priv, struct cca_settings *settings);
4057
4058 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08004059 * add_tx_ts - Add traffic stream
4060 * @priv: Private driver interface data
4061 * @tsid: Traffic stream ID
4062 * @addr: Receiver address
4063 * @user_prio: User priority of the traffic stream
4064 * @admitted_time: Admitted time for this TS in units of
4065 * 32 microsecond periods (per second).
4066 * Returns: 0 on success, -1 on failure
4067 */
4068 int (*add_tx_ts)(void *priv, u8 tsid, const u8 *addr, u8 user_prio,
4069 u16 admitted_time);
4070
4071 /**
4072 * del_tx_ts - Delete traffic stream
4073 * @priv: Private driver interface data
4074 * @tsid: Traffic stream ID
4075 * @addr: Receiver address
4076 * Returns: 0 on success, -1 on failure
4077 */
4078 int (*del_tx_ts)(void *priv, u8 tsid, const u8 *addr);
4079
4080 /**
4081 * Enable channel-switching with TDLS peer
4082 * @priv: Private driver interface data
4083 * @addr: MAC address of the TDLS peer
4084 * @oper_class: Operating class of the switch channel
4085 * @params: Channel specification
4086 * Returns: 0 on success, -1 on failure
4087 *
4088 * The function indicates to driver that it can start switching to a
4089 * different channel with a specified TDLS peer. The switching is
4090 * assumed on until canceled with tdls_disable_channel_switch().
4091 */
4092 int (*tdls_enable_channel_switch)(
4093 void *priv, const u8 *addr, u8 oper_class,
4094 const struct hostapd_freq_params *params);
4095
4096 /**
4097 * Disable channel switching with TDLS peer
4098 * @priv: Private driver interface data
4099 * @addr: MAC address of the TDLS peer
4100 * Returns: 0 on success, -1 on failure
4101 *
4102 * This function indicates to the driver that it should stop switching
4103 * with a given TDLS peer.
4104 */
4105 int (*tdls_disable_channel_switch)(void *priv, const u8 *addr);
4106
4107 /**
Dmitry Shmidtea69e842013-05-13 14:52:28 -07004108 * start_dfs_cac - Listen for radar interference on the channel
4109 * @priv: Private driver interface data
Dmitry Shmidt051af732013-10-22 13:52:46 -07004110 * @freq: Channel parameters
Dmitry Shmidtea69e842013-05-13 14:52:28 -07004111 * Returns: 0 on success, -1 on failure
4112 */
Dmitry Shmidt051af732013-10-22 13:52:46 -07004113 int (*start_dfs_cac)(void *priv, struct hostapd_freq_params *freq);
Dmitry Shmidtea69e842013-05-13 14:52:28 -07004114
4115 /**
4116 * stop_ap - Removes beacon from AP
4117 * @priv: Private driver interface data
4118 * Returns: 0 on success, -1 on failure (or if not supported)
4119 *
4120 * This optional function can be used to disable AP mode related
4121 * configuration. Unlike deinit_ap, it does not change to station
4122 * mode.
4123 */
4124 int (*stop_ap)(void *priv);
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07004125
4126 /**
4127 * get_survey - Retrieve survey data
4128 * @priv: Private driver interface data
4129 * @freq: If set, survey data for the specified frequency is only
4130 * being requested. If not set, all survey data is requested.
4131 * Returns: 0 on success, -1 on failure
4132 *
4133 * Use this to retrieve:
4134 *
4135 * - the observed channel noise floor
4136 * - the amount of time we have spent on the channel
4137 * - the amount of time during which we have spent on the channel that
4138 * the radio has determined the medium is busy and we cannot
4139 * transmit
4140 * - the amount of time we have spent receiving data
4141 * - the amount of time we have spent transmitting data
4142 *
4143 * This data can be used for spectrum heuristics. One example is
4144 * Automatic Channel Selection (ACS). The channel survey data is
4145 * kept on a linked list on the channel data, one entry is added
4146 * for each survey. The min_nf of the channel is updated for each
4147 * survey.
4148 */
4149 int (*get_survey)(void *priv, unsigned int freq);
Dmitry Shmidt56052862013-10-04 10:23:25 -07004150
4151 /**
4152 * status - Get driver interface status information
4153 * @priv: Private driver interface data
Hai Shalom74f70d42019-02-11 14:42:39 -08004154 * @buf: Buffer for printing the status information
Dmitry Shmidt56052862013-10-04 10:23:25 -07004155 * @buflen: Maximum length of the buffer
4156 * Returns: Length of written status information or -1 on failure
4157 */
4158 int (*status)(void *priv, char *buf, size_t buflen);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004159
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07004160 /**
4161 * roaming - Set roaming policy for driver-based BSS selection
4162 * @priv: Private driver interface data
4163 * @allowed: Whether roaming within ESS is allowed
4164 * @bssid: Forced BSSID if roaming is disabled or %NULL if not set
4165 * Returns: Length of written status information or -1 on failure
4166 *
4167 * This optional callback can be used to update roaming policy from the
4168 * associate() command (bssid being set there indicates that the driver
4169 * should not roam before getting this roaming() call to allow roaming.
4170 * If the driver does not indicate WPA_DRIVER_FLAGS_BSS_SELECTION
4171 * capability, roaming policy is handled within wpa_supplicant and there
4172 * is no need to implement or react to this callback.
4173 */
4174 int (*roaming)(void *priv, int allowed, const u8 *bssid);
4175
4176 /**
Roshan Pius3a1667e2018-07-03 15:17:14 -07004177 * disable_fils - Enable/disable FILS feature
4178 * @priv: Private driver interface data
4179 * @disable: 0-enable and 1-disable FILS feature
4180 * Returns: 0 on success, -1 on failure
4181 *
4182 * This callback can be used to configure driver and below layers to
4183 * enable/disable all FILS features.
4184 */
4185 int (*disable_fils)(void *priv, int disable);
4186
4187 /**
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07004188 * set_mac_addr - Set MAC address
4189 * @priv: Private driver interface data
4190 * @addr: MAC address to use or %NULL for setting back to permanent
4191 * Returns: 0 on success, -1 on failure
4192 */
4193 int (*set_mac_addr)(void *priv, const u8 *addr);
4194
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004195#ifdef CONFIG_MACSEC
4196 int (*macsec_init)(void *priv, struct macsec_init_params *params);
4197
4198 int (*macsec_deinit)(void *priv);
4199
4200 /**
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004201 * macsec_get_capability - Inform MKA of this driver's capability
4202 * @priv: Private driver interface data
4203 * @cap: Driver's capability
4204 * Returns: 0 on success, -1 on failure
4205 */
4206 int (*macsec_get_capability)(void *priv, enum macsec_cap *cap);
4207
4208 /**
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004209 * enable_protect_frames - Set protect frames status
4210 * @priv: Private driver interface data
Hai Shalome21d4e82020-04-29 16:34:06 -07004211 * @enabled: true = protect frames enabled
4212 * false = protect frames disabled
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004213 * Returns: 0 on success, -1 on failure (or if not supported)
4214 */
Hai Shalome21d4e82020-04-29 16:34:06 -07004215 int (*enable_protect_frames)(void *priv, bool enabled);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004216
4217 /**
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08004218 * enable_encrypt - Set encryption status
4219 * @priv: Private driver interface data
Hai Shalome21d4e82020-04-29 16:34:06 -07004220 * @enabled: true = encrypt outgoing traffic
4221 * false = integrity-only protection on outgoing traffic
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08004222 * Returns: 0 on success, -1 on failure (or if not supported)
4223 */
Hai Shalome21d4e82020-04-29 16:34:06 -07004224 int (*enable_encrypt)(void *priv, bool enabled);
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08004225
4226 /**
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004227 * set_replay_protect - Set replay protect status and window size
4228 * @priv: Private driver interface data
Hai Shalome21d4e82020-04-29 16:34:06 -07004229 * @enabled: true = replay protect enabled
4230 * false = replay protect disabled
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004231 * @window: replay window size, valid only when replay protect enabled
4232 * Returns: 0 on success, -1 on failure (or if not supported)
4233 */
Hai Shalome21d4e82020-04-29 16:34:06 -07004234 int (*set_replay_protect)(void *priv, bool enabled, u32 window);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004235
4236 /**
4237 * set_current_cipher_suite - Set current cipher suite
4238 * @priv: Private driver interface data
4239 * @cs: EUI64 identifier
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004240 * Returns: 0 on success, -1 on failure (or if not supported)
4241 */
Dmitry Shmidt7d175302016-09-06 13:11:34 -07004242 int (*set_current_cipher_suite)(void *priv, u64 cs);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004243
4244 /**
4245 * enable_controlled_port - Set controlled port status
4246 * @priv: Private driver interface data
Hai Shalome21d4e82020-04-29 16:34:06 -07004247 * @enabled: true = controlled port enabled
4248 * false = controlled port disabled
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004249 * Returns: 0 on success, -1 on failure (or if not supported)
4250 */
Hai Shalome21d4e82020-04-29 16:34:06 -07004251 int (*enable_controlled_port)(void *priv, bool enabled);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004252
4253 /**
4254 * get_receive_lowest_pn - Get receive lowest pn
4255 * @priv: Private driver interface data
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004256 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004257 * Returns: 0 on success, -1 on failure (or if not supported)
4258 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004259 int (*get_receive_lowest_pn)(void *priv, struct receive_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004260
4261 /**
4262 * get_transmit_next_pn - Get transmit next pn
4263 * @priv: Private driver interface data
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004264 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004265 * Returns: 0 on success, -1 on failure (or if not supported)
4266 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004267 int (*get_transmit_next_pn)(void *priv, struct transmit_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004268
4269 /**
4270 * set_transmit_next_pn - Set transmit next pn
4271 * @priv: Private driver interface data
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004272 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004273 * Returns: 0 on success, -1 on failure (or if not supported)
4274 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004275 int (*set_transmit_next_pn)(void *priv, struct transmit_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004276
4277 /**
Hai Shalom74f70d42019-02-11 14:42:39 -08004278 * set_receive_lowest_pn - Set receive lowest PN
4279 * @priv: Private driver interface data
4280 * @sa: secure association
4281 * Returns: 0 on success, -1 on failure (or if not supported)
4282 */
4283 int (*set_receive_lowest_pn)(void *priv, struct receive_sa *sa);
4284
4285 /**
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004286 * create_receive_sc - create secure channel for receiving
4287 * @priv: Private driver interface data
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004288 * @sc: secure channel
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004289 * @conf_offset: confidentiality offset (0, 30, or 50)
4290 * @validation: frame validation policy (0 = Disabled, 1 = Checked,
4291 * 2 = Strict)
4292 * Returns: 0 on success, -1 on failure (or if not supported)
4293 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004294 int (*create_receive_sc)(void *priv, struct receive_sc *sc,
4295 unsigned int conf_offset,
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004296 int validation);
4297
4298 /**
4299 * delete_receive_sc - delete secure connection for receiving
4300 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004301 * @sc: secure channel
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004302 * Returns: 0 on success, -1 on failure
4303 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004304 int (*delete_receive_sc)(void *priv, struct receive_sc *sc);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004305
4306 /**
4307 * create_receive_sa - create secure association for receive
4308 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004309 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004310 * Returns: 0 on success, -1 on failure
4311 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004312 int (*create_receive_sa)(void *priv, struct receive_sa *sa);
4313
4314 /**
4315 * delete_receive_sa - Delete secure association for receive
4316 * @priv: Private driver interface data from init()
4317 * @sa: Secure association
4318 * Returns: 0 on success, -1 on failure
4319 */
4320 int (*delete_receive_sa)(void *priv, struct receive_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004321
4322 /**
4323 * enable_receive_sa - enable the SA for receive
4324 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004325 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004326 * Returns: 0 on success, -1 on failure
4327 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004328 int (*enable_receive_sa)(void *priv, struct receive_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004329
4330 /**
4331 * disable_receive_sa - disable SA for receive
4332 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004333 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004334 * Returns: 0 on success, -1 on failure
4335 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004336 int (*disable_receive_sa)(void *priv, struct receive_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004337
4338 /**
4339 * create_transmit_sc - create secure connection for transmit
4340 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004341 * @sc: secure channel
4342 * @conf_offset: confidentiality offset (0, 30, or 50)
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004343 * Returns: 0 on success, -1 on failure
4344 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004345 int (*create_transmit_sc)(void *priv, struct transmit_sc *sc,
4346 unsigned int conf_offset);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004347
4348 /**
4349 * delete_transmit_sc - delete secure connection for transmit
4350 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004351 * @sc: secure channel
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004352 * Returns: 0 on success, -1 on failure
4353 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004354 int (*delete_transmit_sc)(void *priv, struct transmit_sc *sc);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004355
4356 /**
4357 * create_transmit_sa - create secure association for transmit
4358 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004359 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004360 * Returns: 0 on success, -1 on failure
4361 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004362 int (*create_transmit_sa)(void *priv, struct transmit_sa *sa);
4363
4364 /**
4365 * delete_transmit_sa - Delete secure association for transmit
4366 * @priv: Private driver interface data from init()
4367 * @sa: Secure association
4368 * Returns: 0 on success, -1 on failure
4369 */
4370 int (*delete_transmit_sa)(void *priv, struct transmit_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004371
4372 /**
4373 * enable_transmit_sa - enable SA for transmit
4374 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004375 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004376 * Returns: 0 on success, -1 on failure
4377 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004378 int (*enable_transmit_sa)(void *priv, struct transmit_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004379
4380 /**
4381 * disable_transmit_sa - disable SA for transmit
4382 * @priv: private driver interface data from init()
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004383 * @sa: secure association
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004384 * Returns: 0 on success, -1 on failure
4385 */
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004386 int (*disable_transmit_sa)(void *priv, struct transmit_sa *sa);
Dmitry Shmidt5a1480c2014-05-12 09:46:02 -07004387#endif /* CONFIG_MACSEC */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08004388
4389 /**
4390 * init_mesh - Driver specific initialization for mesh
4391 * @priv: Private driver interface data
4392 * Returns: 0 on success, -1 on failure
4393 */
4394 int (*init_mesh)(void *priv);
4395
4396 /**
4397 * join_mesh - Join a mesh network
4398 * @priv: Private driver interface data
4399 * @params: Mesh configuration parameters
4400 * Returns: 0 on success, -1 on failure
4401 */
4402 int (*join_mesh)(void *priv,
4403 struct wpa_driver_mesh_join_params *params);
4404
4405 /**
4406 * leave_mesh - Leave a mesh network
4407 * @priv: Private driver interface data
4408 * Returns 0 on success, -1 on failure
4409 */
4410 int (*leave_mesh)(void *priv);
4411
4412 /**
Hai Shalom81f62d82019-07-22 12:10:00 -07004413 * probe_mesh_link - Inject a frame over direct mesh link to a given
4414 * peer skipping the next_hop lookup from mpath table.
4415 * @priv: Private driver interface data
4416 * @addr: Peer MAC address
4417 * @eth: Ethernet frame to be sent
4418 * @len: Ethernet frame lengtn in bytes
4419 * Returns 0 on success, -1 on failure
4420 */
4421 int (*probe_mesh_link)(void *priv, const u8 *addr, const u8 *eth,
4422 size_t len);
4423
4424 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08004425 * do_acs - Automatically select channel
4426 * @priv: Private driver interface data
4427 * @params: Parameters for ACS
4428 * Returns 0 on success, -1 on failure
4429 *
4430 * This command can be used to offload ACS to the driver if the driver
4431 * indicates support for such offloading (WPA_DRIVER_FLAGS_ACS_OFFLOAD).
4432 */
4433 int (*do_acs)(void *priv, struct drv_acs_params *params);
Ravi Joshie6ccb162015-07-16 17:45:41 -07004434
4435 /**
Hai Shalom60840252021-02-19 19:02:11 -08004436 * set_band - Notify driver of band(s) selection
Ravi Joshie6ccb162015-07-16 17:45:41 -07004437 * @priv: Private driver interface data
Hai Shalom60840252021-02-19 19:02:11 -08004438 * @band_mask: The selected band(s) bit mask (from enum set_band)
Ravi Joshie6ccb162015-07-16 17:45:41 -07004439 * Returns 0 on success, -1 on failure
4440 */
Hai Shalom60840252021-02-19 19:02:11 -08004441 int (*set_band)(void *priv, u32 band_mask);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08004442
4443 /**
4444 * get_pref_freq_list - Get preferred frequency list for an interface
4445 * @priv: Private driver interface data
4446 * @if_type: Interface type
4447 * @num: Number of channels
4448 * @freq_list: Preferred channel frequency list encoded in MHz values
4449 * Returns 0 on success, -1 on failure
4450 *
4451 * This command can be used to query the preferred frequency list from
4452 * the driver specific to a particular interface type.
4453 */
4454 int (*get_pref_freq_list)(void *priv, enum wpa_driver_if_type if_type,
4455 unsigned int *num, unsigned int *freq_list);
4456
4457 /**
4458 * set_prob_oper_freq - Indicate probable P2P operating channel
4459 * @priv: Private driver interface data
4460 * @freq: Channel frequency in MHz
4461 * Returns 0 on success, -1 on failure
4462 *
4463 * This command can be used to inform the driver of the operating
4464 * frequency that an ongoing P2P group formation is likely to come up
4465 * on. Local device is assuming P2P Client role.
4466 */
4467 int (*set_prob_oper_freq)(void *priv, unsigned int freq);
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -08004468
4469 /**
4470 * abort_scan - Request the driver to abort an ongoing scan
4471 * @priv: Private driver interface data
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08004472 * @scan_cookie: Cookie identifying the scan request. This is used only
4473 * when the vendor interface QCA_NL80211_VENDOR_SUBCMD_TRIGGER_SCAN
4474 * was used to trigger scan. Otherwise, 0 is used.
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -08004475 * Returns 0 on success, -1 on failure
4476 */
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08004477 int (*abort_scan)(void *priv, u64 scan_cookie);
Dmitry Shmidt849734c2016-05-27 09:59:01 -07004478
4479 /**
4480 * configure_data_frame_filters - Request to configure frame filters
4481 * @priv: Private driver interface data
4482 * @filter_flags: The type of frames to filter (bitfield of
4483 * WPA_DATA_FRAME_FILTER_FLAG_*)
4484 * Returns: 0 on success or -1 on failure
4485 */
4486 int (*configure_data_frame_filters)(void *priv, u32 filter_flags);
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -07004487
4488 /**
4489 * get_ext_capab - Get extended capabilities for the specified interface
4490 * @priv: Private driver interface data
4491 * @type: Interface type for which to get extended capabilities
4492 * @ext_capab: Extended capabilities fetched
4493 * @ext_capab_mask: Extended capabilities mask
4494 * @ext_capab_len: Length of the extended capabilities
4495 * Returns: 0 on success or -1 on failure
4496 */
4497 int (*get_ext_capab)(void *priv, enum wpa_driver_if_type type,
4498 const u8 **ext_capab, const u8 **ext_capab_mask,
4499 unsigned int *ext_capab_len);
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -07004500
4501 /**
4502 * p2p_lo_start - Start offloading P2P listen to device
4503 * @priv: Private driver interface data
4504 * @freq: Listening frequency (MHz) for P2P listen
4505 * @period: Length of the listen operation in milliseconds
4506 * @interval: Interval for running the listen operation in milliseconds
4507 * @count: Number of times to run the listen operation
4508 * @device_types: Device primary and secondary types
4509 * @dev_types_len: Number of bytes for device_types
4510 * @ies: P2P IE and WSC IE for Probe Response frames
4511 * @ies_len: Length of ies in bytes
4512 * Returns: 0 on success or -1 on failure
4513 */
4514 int (*p2p_lo_start)(void *priv, unsigned int freq,
4515 unsigned int period, unsigned int interval,
4516 unsigned int count,
4517 const u8 *device_types, size_t dev_types_len,
4518 const u8 *ies, size_t ies_len);
4519
4520 /**
4521 * p2p_lo_stop - Stop P2P listen offload
4522 * @priv: Private driver interface data
4523 * Returns: 0 on success or -1 on failure
4524 */
4525 int (*p2p_lo_stop)(void *priv);
Dmitry Shmidt7f2c7532016-08-15 09:48:12 -07004526
4527 /**
4528 * set_default_scan_ies - Set default scan IEs
4529 * @priv: Private driver interface data
4530 * @ies: Scan default IEs buffer
4531 * @ies_len: Length of IEs in bytes
4532 * Returns: 0 on success or -1 on failure
4533 *
4534 * The driver can use these by default when there are no scan IEs coming
4535 * in the subsequent scan requests. Also in case of one or more of IEs
4536 * given in set_default_scan_ies() are missing in the subsequent scan
4537 * request, the driver should merge the missing scan IEs in the scan
4538 * request from the IEs set by set_default_scan_ies() in the Probe
4539 * Request frames sent.
4540 */
4541 int (*set_default_scan_ies)(void *priv, const u8 *ies, size_t ies_len);
4542
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08004543 /**
4544 * set_tdls_mode - Set TDLS trigger mode to the host driver
4545 * @priv: Private driver interface data
4546 * @tdls_external_control: Represents if TDLS external trigger control
4547 * mode is enabled/disabled.
4548 *
4549 * This optional callback can be used to configure the TDLS external
4550 * trigger control mode to the host driver.
4551 */
4552 int (*set_tdls_mode)(void *priv, int tdls_external_control);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004553
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07004554 /**
4555 * get_bss_transition_status - Get candidate BSS's transition status
4556 * @priv: Private driver interface data
4557 * @params: Candidate BSS list
4558 *
4559 * Get the accept or reject reason code for a list of BSS transition
4560 * candidates.
4561 */
4562 struct wpa_bss_candidate_info *
4563 (*get_bss_transition_status)(void *priv,
4564 struct wpa_bss_trans_info *params);
4565 /**
4566 * ignore_assoc_disallow - Configure driver to ignore assoc_disallow
4567 * @priv: Private driver interface data
4568 * @ignore_disallow: 0 to not ignore, 1 to ignore
4569 * Returns: 0 on success, -1 on failure
4570 */
4571 int (*ignore_assoc_disallow)(void *priv, int ignore_disallow);
4572
4573 /**
Hai Shalom899fcc72020-10-19 14:38:18 -07004574 * set_bssid_tmp_disallow - Set disallowed BSSIDs to the driver
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07004575 * @priv: Private driver interface data
Hai Shalom899fcc72020-10-19 14:38:18 -07004576 * @num_bssid: Number of temporarily disallowed BSSIDs
4577 * @bssids: List of temporarily disallowed BSSIDs
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07004578 */
Hai Shalom899fcc72020-10-19 14:38:18 -07004579 int (*set_bssid_tmp_disallow)(void *priv, unsigned int num_bssid,
4580 const u8 *bssid);
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07004581
4582 /**
4583 * update_connect_params - Update the connection parameters
4584 * @priv: Private driver interface data
4585 * @params: Association parameters
4586 * @mask: Bit mask indicating which parameters in @params have to be
4587 * updated
4588 * Returns: 0 on success, -1 on failure
4589 *
4590 * Update the connection parameters when in connected state so that the
4591 * driver uses the updated parameters for subsequent roaming. This is
4592 * used only with drivers that implement internal BSS selection and
4593 * roaming.
4594 */
4595 int (*update_connect_params)(
4596 void *priv, struct wpa_driver_associate_params *params,
4597 enum wpa_drv_update_connect_params_mask mask);
Roshan Pius3a1667e2018-07-03 15:17:14 -07004598
4599 /**
4600 * send_external_auth_status - Indicate the status of external
4601 * authentication processing to the host driver.
4602 * @priv: Private driver interface data
4603 * @params: Status of authentication processing.
4604 * Returns: 0 on success, -1 on failure
4605 */
4606 int (*send_external_auth_status)(void *priv,
4607 struct external_auth *params);
Hai Shalom74f70d42019-02-11 14:42:39 -08004608
4609 /**
4610 * set_4addr_mode - Set 4-address mode
4611 * @priv: Private driver interface data
4612 * @bridge_ifname: Bridge interface name
4613 * @val: 0 - disable 4addr mode, 1 - enable 4addr mode
4614 * Returns: 0 on success, < 0 on failure
4615 */
4616 int (*set_4addr_mode)(void *priv, const char *bridge_ifname, int val);
Hai Shalom81f62d82019-07-22 12:10:00 -07004617
4618 /**
4619 * update_dh_ie - Update DH IE
4620 * @priv: Private driver interface data
4621 * @peer_mac: Peer MAC address
4622 * @reason_code: Reacon code
4623 * @ie: DH IE
4624 * @ie_len: DH IE length in bytes
4625 * Returns: 0 on success, -1 on failure
4626 *
4627 * This callback is used to let the driver know the DH processing result
4628 * and DH IE for a pending association.
4629 */
4630 int (*update_dh_ie)(void *priv, const u8 *peer_mac, u16 reason_code,
4631 const u8 *ie, size_t ie_len);
Hai Shalomb755a2a2020-04-23 21:49:02 -07004632
4633 /**
4634 * dpp_listen - Notify driver about start/stop of DPP listen
4635 * @priv: Private driver interface data
4636 * @enable: Whether listen state is enabled (or disabled)
4637 * Returns: 0 on success, -1 on failure
4638 *
4639 * This optional callback can be used to update RX frame filtering to
4640 * explicitly allow reception of broadcast Public Action frames.
4641 */
Hai Shalome21d4e82020-04-29 16:34:06 -07004642 int (*dpp_listen)(void *priv, bool enable);
Hai Shalomc1a21442022-02-04 13:43:00 -08004643
4644#ifdef CONFIG_TESTING_OPTIONS
4645 int (*register_frame)(void *priv, u16 type,
4646 const u8 *match, size_t match_len,
4647 bool multicast);
4648#endif /* CONFIG_TESTING_OPTIONS */
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07004649};
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004650
4651/**
4652 * enum wpa_event_type - Event type for wpa_supplicant_event() calls
4653 */
4654enum wpa_event_type {
4655 /**
4656 * EVENT_ASSOC - Association completed
4657 *
4658 * This event needs to be delivered when the driver completes IEEE
4659 * 802.11 association or reassociation successfully.
4660 * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
4661 * after this event has been generated. In addition, optional
4662 * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
4663 * more information about the association. If the driver interface gets
4664 * both of these events at the same time, it can also include the
4665 * assoc_info data in EVENT_ASSOC call.
4666 */
4667 EVENT_ASSOC,
4668
4669 /**
4670 * EVENT_DISASSOC - Association lost
4671 *
4672 * This event should be called when association is lost either due to
4673 * receiving deauthenticate or disassociate frame from the AP or when
4674 * sending either of these frames to the current AP. If the driver
4675 * supports separate deauthentication event, EVENT_DISASSOC should only
4676 * be used for disassociation and EVENT_DEAUTH for deauthentication.
4677 * In AP mode, union wpa_event_data::disassoc_info is required.
4678 */
4679 EVENT_DISASSOC,
4680
4681 /**
4682 * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
4683 *
4684 * This event must be delivered when a Michael MIC error is detected by
4685 * the local driver. Additional data for event processing is
4686 * provided with union wpa_event_data::michael_mic_failure. This
Sunil Ravia04bd252022-05-02 22:54:18 -07004687 * information is used to request new encryption key and to initiate
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004688 * TKIP countermeasures if needed.
4689 */
4690 EVENT_MICHAEL_MIC_FAILURE,
4691
4692 /**
4693 * EVENT_SCAN_RESULTS - Scan results available
4694 *
4695 * This event must be called whenever scan results are available to be
4696 * fetched with struct wpa_driver_ops::get_scan_results(). This event
4697 * is expected to be used some time after struct wpa_driver_ops::scan()
4698 * is called. If the driver provides an unsolicited event when the scan
4699 * has been completed, this event can be used to trigger
4700 * EVENT_SCAN_RESULTS call. If such event is not available from the
4701 * driver, the driver wrapper code is expected to use a registered
4702 * timeout to generate EVENT_SCAN_RESULTS call after the time that the
4703 * scan is expected to be completed. Optional information about
4704 * completed scan can be provided with union wpa_event_data::scan_info.
4705 */
4706 EVENT_SCAN_RESULTS,
4707
4708 /**
4709 * EVENT_ASSOCINFO - Report optional extra information for association
4710 *
4711 * This event can be used to report extra association information for
4712 * EVENT_ASSOC processing. This extra information includes IEs from
4713 * association frames and Beacon/Probe Response frames in union
4714 * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
4715 * EVENT_ASSOC. Alternatively, the driver interface can include
4716 * assoc_info data in the EVENT_ASSOC call if it has all the
4717 * information available at the same point.
4718 */
4719 EVENT_ASSOCINFO,
4720
4721 /**
4722 * EVENT_INTERFACE_STATUS - Report interface status changes
4723 *
4724 * This optional event can be used to report changes in interface
4725 * status (interface added/removed) using union
4726 * wpa_event_data::interface_status. This can be used to trigger
4727 * wpa_supplicant to stop and re-start processing for the interface,
4728 * e.g., when a cardbus card is ejected/inserted.
4729 */
4730 EVENT_INTERFACE_STATUS,
4731
4732 /**
4733 * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
4734 *
4735 * This event can be used to inform wpa_supplicant about candidates for
4736 * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
4737 * for scan request (ap_scan=2 mode), this event is required for
4738 * pre-authentication. If wpa_supplicant is performing scan request
4739 * (ap_scan=1), this event is optional since scan results can be used
4740 * to add pre-authentication candidates. union
4741 * wpa_event_data::pmkid_candidate is used to report the BSSID of the
4742 * candidate and priority of the candidate, e.g., based on the signal
4743 * strength, in order to try to pre-authenticate first with candidates
4744 * that are most likely targets for re-association.
4745 *
4746 * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
4747 * on the candidate list. In addition, it can be called for the current
4748 * AP and APs that have existing PMKSA cache entries. wpa_supplicant
4749 * will automatically skip pre-authentication in cases where a valid
4750 * PMKSA exists. When more than one candidate exists, this event should
4751 * be generated once for each candidate.
4752 *
4753 * Driver will be notified about successful pre-authentication with
4754 * struct wpa_driver_ops::add_pmkid() calls.
4755 */
4756 EVENT_PMKID_CANDIDATE,
4757
4758 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004759 * EVENT_TDLS - Request TDLS operation
4760 *
4761 * This event can be used to request a TDLS operation to be performed.
4762 */
4763 EVENT_TDLS,
4764
4765 /**
4766 * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
4767 *
4768 * The driver is expected to report the received FT IEs from
4769 * FT authentication sequence from the AP. The FT IEs are included in
4770 * the extra information in union wpa_event_data::ft_ies.
4771 */
4772 EVENT_FT_RESPONSE,
4773
4774 /**
4775 * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
4776 *
4777 * The driver can use this event to inform wpa_supplicant about a STA
4778 * in an IBSS with which protected frames could be exchanged. This
4779 * event starts RSN authentication with the other STA to authenticate
4780 * the STA and set up encryption keys with it.
4781 */
4782 EVENT_IBSS_RSN_START,
4783
4784 /**
4785 * EVENT_AUTH - Authentication result
4786 *
4787 * This event should be called when authentication attempt has been
4788 * completed. This is only used if the driver supports separate
4789 * authentication step (struct wpa_driver_ops::authenticate).
4790 * Information about authentication result is included in
4791 * union wpa_event_data::auth.
4792 */
4793 EVENT_AUTH,
4794
4795 /**
4796 * EVENT_DEAUTH - Authentication lost
4797 *
4798 * This event should be called when authentication is lost either due
4799 * to receiving deauthenticate frame from the AP or when sending that
4800 * frame to the current AP.
4801 * In AP mode, union wpa_event_data::deauth_info is required.
4802 */
4803 EVENT_DEAUTH,
4804
4805 /**
4806 * EVENT_ASSOC_REJECT - Association rejected
4807 *
4808 * This event should be called when (re)association attempt has been
4809 * rejected by the AP. Information about the association response is
4810 * included in union wpa_event_data::assoc_reject.
4811 */
4812 EVENT_ASSOC_REJECT,
4813
4814 /**
4815 * EVENT_AUTH_TIMED_OUT - Authentication timed out
4816 */
4817 EVENT_AUTH_TIMED_OUT,
4818
4819 /**
4820 * EVENT_ASSOC_TIMED_OUT - Association timed out
4821 */
4822 EVENT_ASSOC_TIMED_OUT,
4823
4824 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004825 * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
4826 */
4827 EVENT_WPS_BUTTON_PUSHED,
4828
4829 /**
4830 * EVENT_TX_STATUS - Report TX status
4831 */
4832 EVENT_TX_STATUS,
4833
4834 /**
4835 * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
4836 */
4837 EVENT_RX_FROM_UNKNOWN,
4838
4839 /**
4840 * EVENT_RX_MGMT - Report RX of a management frame
4841 */
4842 EVENT_RX_MGMT,
4843
4844 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004845 * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
4846 *
4847 * This event is used to indicate when the driver has started the
4848 * requested remain-on-channel duration. Information about the
4849 * operation is included in union wpa_event_data::remain_on_channel.
4850 */
4851 EVENT_REMAIN_ON_CHANNEL,
4852
4853 /**
4854 * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
4855 *
4856 * This event is used to indicate when the driver has completed
4857 * remain-on-channel duration, i.e., may noot be available on the
4858 * requested channel anymore. Information about the
4859 * operation is included in union wpa_event_data::remain_on_channel.
4860 */
4861 EVENT_CANCEL_REMAIN_ON_CHANNEL,
4862
4863 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004864 * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
4865 *
4866 * This event is used to indicate when a Probe Request frame has been
4867 * received. Information about the received frame is included in
4868 * union wpa_event_data::rx_probe_req. The driver is required to report
4869 * these events only after successfully completed probe_req_report()
4870 * commands to request the events (i.e., report parameter is non-zero)
4871 * in station mode. In AP mode, Probe Request frames should always be
4872 * reported.
4873 */
4874 EVENT_RX_PROBE_REQ,
4875
4876 /**
4877 * EVENT_NEW_STA - New wired device noticed
4878 *
4879 * This event is used to indicate that a new device has been detected
4880 * in a network that does not use association-like functionality (i.e.,
4881 * mainly wired Ethernet). This can be used to start EAPOL
4882 * authenticator when receiving a frame from a device. The address of
4883 * the device is included in union wpa_event_data::new_sta.
4884 */
4885 EVENT_NEW_STA,
4886
4887 /**
4888 * EVENT_EAPOL_RX - Report received EAPOL frame
4889 *
4890 * When in AP mode with hostapd, this event is required to be used to
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08004891 * deliver the receive EAPOL frames from the driver.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004892 */
4893 EVENT_EAPOL_RX,
4894
4895 /**
4896 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
4897 *
4898 * This event is used to indicate changes in the signal strength
4899 * observed in frames received from the current AP if signal strength
4900 * monitoring has been enabled with signal_monitor().
4901 */
4902 EVENT_SIGNAL_CHANGE,
4903
4904 /**
4905 * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
4906 *
4907 * This event is used to indicate that the interface was enabled after
4908 * having been previously disabled, e.g., due to rfkill.
4909 */
4910 EVENT_INTERFACE_ENABLED,
4911
4912 /**
4913 * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
4914 *
4915 * This event is used to indicate that the interface was disabled,
4916 * e.g., due to rfkill.
4917 */
4918 EVENT_INTERFACE_DISABLED,
4919
4920 /**
4921 * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
4922 *
4923 * This event is used to indicate that the channel list has changed,
4924 * e.g., because of a regulatory domain change triggered by scan
4925 * results including an AP advertising a country code.
4926 */
4927 EVENT_CHANNEL_LIST_CHANGED,
4928
4929 /**
4930 * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
4931 *
4932 * This event is used to indicate that the driver cannot maintain this
4933 * interface in its operation mode anymore. The most likely use for
4934 * this is to indicate that AP mode operation is not available due to
4935 * operating channel would need to be changed to a DFS channel when
4936 * the driver does not support radar detection and another virtual
4937 * interfaces caused the operating channel to change. Other similar
4938 * resource conflicts could also trigger this for station mode
Dmitry Shmidtd30ac602014-06-30 09:54:22 -07004939 * interfaces. This event can be propagated when channel switching
4940 * fails.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004941 */
4942 EVENT_INTERFACE_UNAVAILABLE,
4943
4944 /**
4945 * EVENT_BEST_CHANNEL
4946 *
4947 * Driver generates this event whenever it detects a better channel
4948 * (e.g., based on RSSI or channel use). This information can be used
4949 * to improve channel selection for a new AP/P2P group.
4950 */
4951 EVENT_BEST_CHANNEL,
4952
4953 /**
4954 * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
4955 *
4956 * This event should be called when a Deauthentication frame is dropped
4957 * due to it not being protected (MFP/IEEE 802.11w).
4958 * union wpa_event_data::unprot_deauth is required to provide more
4959 * details of the frame.
4960 */
4961 EVENT_UNPROT_DEAUTH,
4962
4963 /**
4964 * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
4965 *
4966 * This event should be called when a Disassociation frame is dropped
4967 * due to it not being protected (MFP/IEEE 802.11w).
4968 * union wpa_event_data::unprot_disassoc is required to provide more
4969 * details of the frame.
4970 */
4971 EVENT_UNPROT_DISASSOC,
4972
4973 /**
4974 * EVENT_STATION_LOW_ACK
4975 *
4976 * Driver generates this event whenever it detected that a particular
4977 * station was lost. Detection can be through massive transmission
4978 * failures for example.
4979 */
4980 EVENT_STATION_LOW_ACK,
4981
4982 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004983 * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
4984 */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08004985 EVENT_IBSS_PEER_LOST,
4986
4987 /**
4988 * EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
4989 *
4990 * This event carries the new replay counter to notify wpa_supplicant
4991 * of the current EAPOL-Key Replay Counter in case the driver/firmware
4992 * completed Group Key Handshake while the host (including
4993 * wpa_supplicant was sleeping).
4994 */
4995 EVENT_DRIVER_GTK_REKEY,
4996
4997 /**
4998 * EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
4999 */
5000 EVENT_SCHED_SCAN_STOPPED,
5001
5002 /**
5003 * EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
5004 *
5005 * This event indicates that the station responded to the poll
5006 * initiated with @poll_client.
5007 */
5008 EVENT_DRIVER_CLIENT_POLL_OK,
5009
5010 /**
5011 * EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
5012 */
Dmitry Shmidt04949592012-07-19 12:16:46 -07005013 EVENT_EAPOL_TX_STATUS,
5014
5015 /**
5016 * EVENT_CH_SWITCH - AP or GO decided to switch channels
5017 *
5018 * Described in wpa_event_data.ch_switch
5019 * */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07005020 EVENT_CH_SWITCH,
5021
5022 /**
Hai Shalom81f62d82019-07-22 12:10:00 -07005023 * EVENT_CH_SWITCH_STARTED - AP or GO started to switch channels
5024 *
5025 * This is a pre-switch event indicating the shortly following switch
5026 * of operating channels.
5027 *
5028 * Described in wpa_event_data.ch_switch
5029 */
5030 EVENT_CH_SWITCH_STARTED,
5031 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07005032 * EVENT_WNM - Request WNM operation
5033 *
5034 * This event can be used to request a WNM operation to be performed.
5035 */
Dmitry Shmidtf8623282013-02-20 14:34:59 -08005036 EVENT_WNM,
5037
5038 /**
5039 * EVENT_CONNECT_FAILED_REASON - Connection failure reason in AP mode
5040 *
5041 * This event indicates that the driver reported a connection failure
5042 * with the specified client (for example, max client reached, etc.) in
5043 * AP mode.
5044 */
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005045 EVENT_CONNECT_FAILED_REASON,
5046
5047 /**
Dmitry Shmidt7f656022015-02-25 14:36:37 -08005048 * EVENT_DFS_RADAR_DETECTED - Notify of radar detection
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005049 *
5050 * A radar has been detected on the supplied frequency, hostapd should
5051 * react accordingly (e.g., change channel).
5052 */
5053 EVENT_DFS_RADAR_DETECTED,
5054
5055 /**
Dmitry Shmidt7f656022015-02-25 14:36:37 -08005056 * EVENT_DFS_CAC_FINISHED - Notify that channel availability check has been completed
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005057 *
5058 * After a successful CAC, the channel can be marked clear and used.
5059 */
5060 EVENT_DFS_CAC_FINISHED,
5061
5062 /**
Dmitry Shmidt7f656022015-02-25 14:36:37 -08005063 * EVENT_DFS_CAC_ABORTED - Notify that channel availability check has been aborted
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005064 *
5065 * The CAC was not successful, and the channel remains in the previous
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08005066 * state. This may happen due to a radar being detected or other
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005067 * external influences.
5068 */
5069 EVENT_DFS_CAC_ABORTED,
5070
5071 /**
Dmitry Shmidt7f656022015-02-25 14:36:37 -08005072 * EVENT_DFS_NOP_FINISHED - Notify that non-occupancy period is over
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005073 *
5074 * The channel which was previously unavailable is now available again.
5075 */
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07005076 EVENT_DFS_NOP_FINISHED,
5077
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08005078 /**
5079 * EVENT_SURVEY - Received survey data
5080 *
5081 * This event gets triggered when a driver query is issued for survey
5082 * data and the requested data becomes available. The returned data is
5083 * stored in struct survey_results. The results provide at most one
5084 * survey entry for each frequency and at minimum will provide one
5085 * survey entry for one frequency. The survey data can be os_malloc()'d
5086 * and then os_free()'d, so the event callback must only copy data.
5087 */
5088 EVENT_SURVEY,
5089
5090 /**
5091 * EVENT_SCAN_STARTED - Scan started
5092 *
5093 * This indicates that driver has started a scan operation either based
5094 * on a request from wpa_supplicant/hostapd or from another application.
5095 * EVENT_SCAN_RESULTS is used to indicate when the scan has been
5096 * completed (either successfully or by getting cancelled).
5097 */
Dmitry Shmidtcf32e602014-01-28 10:57:39 -08005098 EVENT_SCAN_STARTED,
5099
5100 /**
5101 * EVENT_AVOID_FREQUENCIES - Received avoid frequency range
5102 *
5103 * This event indicates a set of frequency ranges that should be avoided
5104 * to reduce issues due to interference or internal co-existence
5105 * information in the driver.
5106 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08005107 EVENT_AVOID_FREQUENCIES,
5108
5109 /**
5110 * EVENT_NEW_PEER_CANDIDATE - new (unknown) mesh peer notification
5111 */
5112 EVENT_NEW_PEER_CANDIDATE,
5113
5114 /**
5115 * EVENT_ACS_CHANNEL_SELECTED - Received selected channels by ACS
5116 *
5117 * Indicates a pair of primary and secondary channels chosen by ACS
5118 * in device.
5119 */
5120 EVENT_ACS_CHANNEL_SELECTED,
Dmitry Shmidt7f656022015-02-25 14:36:37 -08005121
5122 /**
5123 * EVENT_DFS_CAC_STARTED - Notify that channel availability check has
5124 * been started.
5125 *
5126 * This event indicates that channel availability check has been started
5127 * on a DFS frequency by a driver that supports DFS Offload.
5128 */
5129 EVENT_DFS_CAC_STARTED,
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -07005130
5131 /**
5132 * EVENT_P2P_LO_STOP - Notify that P2P listen offload is stopped
5133 */
5134 EVENT_P2P_LO_STOP,
Paul Stewart092955c2017-02-06 09:13:09 -08005135
5136 /**
5137 * EVENT_BEACON_LOSS - Beacon loss detected
5138 *
5139 * This event indicates that no Beacon frames has been received from
5140 * the current AP. This may indicate that the AP is not anymore in
5141 * range.
5142 */
5143 EVENT_BEACON_LOSS,
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07005144
5145 /**
5146 * EVENT_DFS_PRE_CAC_EXPIRED - Notify that channel availability check
5147 * done previously (Pre-CAC) on the channel has expired. This would
5148 * normally be on a non-ETSI DFS regulatory domain. DFS state of the
5149 * channel will be moved from available to usable. A new CAC has to be
5150 * performed before start operating on this channel.
5151 */
5152 EVENT_DFS_PRE_CAC_EXPIRED,
Roshan Pius3a1667e2018-07-03 15:17:14 -07005153
5154 /**
5155 * EVENT_EXTERNAL_AUTH - This event interface is used by host drivers
5156 * that do not define separate commands for authentication and
5157 * association (~WPA_DRIVER_FLAGS_SME) but offload the 802.11
5158 * authentication to wpa_supplicant. This event carries all the
5159 * necessary information from the host driver for the authentication to
5160 * happen.
5161 */
5162 EVENT_EXTERNAL_AUTH,
5163
5164 /**
5165 * EVENT_PORT_AUTHORIZED - Notification that a connection is authorized
5166 *
5167 * This event should be indicated when the driver completes the 4-way
5168 * handshake. This event should be preceded by an EVENT_ASSOC that
5169 * indicates the completion of IEEE 802.11 association.
5170 */
5171 EVENT_PORT_AUTHORIZED,
5172
5173 /**
5174 * EVENT_STATION_OPMODE_CHANGED - Notify STA's HT/VHT operation mode
5175 * change event.
5176 */
5177 EVENT_STATION_OPMODE_CHANGED,
5178
5179 /**
5180 * EVENT_INTERFACE_MAC_CHANGED - Notify that interface MAC changed
5181 *
5182 * This event is emitted when the MAC changes while the interface is
5183 * enabled. When an interface was disabled and becomes enabled, it
5184 * must be always assumed that the MAC possibly changed.
5185 */
5186 EVENT_INTERFACE_MAC_CHANGED,
5187
5188 /**
5189 * EVENT_WDS_STA_INTERFACE_STATUS - Notify WDS STA interface status
5190 *
5191 * This event is emitted when an interface is added/removed for WDS STA.
5192 */
5193 EVENT_WDS_STA_INTERFACE_STATUS,
Hai Shalom81f62d82019-07-22 12:10:00 -07005194
5195 /**
5196 * EVENT_UPDATE_DH - Notification of updated DH information
5197 */
5198 EVENT_UPDATE_DH,
Hai Shalomfdcde762020-04-02 11:19:20 -07005199
5200 /**
5201 * EVENT_UNPROT_BEACON - Unprotected Beacon frame received
5202 *
5203 * This event should be called when a Beacon frame is dropped due to it
5204 * not being protected correctly. union wpa_event_data::unprot_beacon
5205 * is required to provide more details of the frame.
5206 */
5207 EVENT_UNPROT_BEACON,
Hai Shalomc1a21442022-02-04 13:43:00 -08005208
5209 /**
5210 * EVENT_TX_WAIT_EXPIRE - TX wait timed out
5211 *
5212 * This event is used to indicate when the driver has completed
5213 * wait for a response frame based on a TX request that specified a
5214 * non-zero wait time and that has not been explicitly cancelled.
5215 */
5216 EVENT_TX_WAIT_EXPIRE,
Sunil Ravia04bd252022-05-02 22:54:18 -07005217
5218 /**
5219 * EVENT_BSS_COLOR_COLLISION - Notification of a BSS color collision
5220 */
5221 EVENT_BSS_COLOR_COLLISION,
5222
5223 /**
5224 * EVENT_CCA_STARTED_NOTIFY - Notification that CCA has started
5225 */
5226 EVENT_CCA_STARTED_NOTIFY,
5227
5228 /**
5229 * EVENT_CCA_ABORTED_NOTIFY - Notification that CCA has aborted
5230 */
5231 EVENT_CCA_ABORTED_NOTIFY,
5232
5233 /**
5234 * EVENT_CCA_NOTIFY - Notification that CCA has completed
5235 */
5236 EVENT_CCA_NOTIFY,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005237};
5238
5239
5240/**
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07005241 * struct freq_survey - Channel survey info
5242 *
5243 * @ifidx: Interface index in which this survey was observed
5244 * @freq: Center of frequency of the surveyed channel
5245 * @nf: Channel noise floor in dBm
5246 * @channel_time: Amount of time in ms the radio spent on the channel
5247 * @channel_time_busy: Amount of time in ms the radio detected some signal
5248 * that indicated to the radio the channel was not clear
5249 * @channel_time_rx: Amount of time the radio spent receiving data
5250 * @channel_time_tx: Amount of time the radio spent transmitting data
5251 * @filled: bitmask indicating which fields have been reported, see
5252 * SURVEY_HAS_* defines.
5253 * @list: Internal list pointers
5254 */
5255struct freq_survey {
5256 u32 ifidx;
5257 unsigned int freq;
5258 s8 nf;
5259 u64 channel_time;
5260 u64 channel_time_busy;
5261 u64 channel_time_rx;
5262 u64 channel_time_tx;
5263 unsigned int filled;
5264 struct dl_list list;
5265};
5266
5267#define SURVEY_HAS_NF BIT(0)
5268#define SURVEY_HAS_CHAN_TIME BIT(1)
5269#define SURVEY_HAS_CHAN_TIME_BUSY BIT(2)
5270#define SURVEY_HAS_CHAN_TIME_RX BIT(3)
5271#define SURVEY_HAS_CHAN_TIME_TX BIT(4)
5272
Hai Shalom60840252021-02-19 19:02:11 -08005273/**
5274 * enum sta_connect_fail_reason_codes - STA connect failure reason code values
5275 * @STA_CONNECT_FAIL_REASON_UNSPECIFIED: No reason code specified for
5276 * connection failure.
5277 * @STA_CONNECT_FAIL_REASON_NO_BSS_FOUND: No Probe Response frame received
5278 * for unicast Probe Request frame.
5279 * @STA_CONNECT_FAIL_REASON_AUTH_TX_FAIL: STA failed to send auth request.
5280 * @STA_CONNECT_FAIL_REASON_AUTH_NO_ACK_RECEIVED: AP didn't send ACK for
5281 * auth request.
5282 * @STA_CONNECT_FAIL_REASON_AUTH_NO_RESP_RECEIVED: Auth response is not
5283 * received from AP.
5284 * @STA_CONNECT_FAIL_REASON_ASSOC_REQ_TX_FAIL: STA failed to send
5285 * Association Request frame.
5286 * @STA_CONNECT_FAIL_REASON_ASSOC_NO_ACK_RECEIVED: AP didn't send ACK for
5287 * Association Request frame.
5288 * @STA_CONNECT_FAIL_REASON_ASSOC_NO_RESP_RECEIVED: Association Response
5289 * frame is not received from AP.
5290 */
5291enum sta_connect_fail_reason_codes {
5292 STA_CONNECT_FAIL_REASON_UNSPECIFIED = 0,
5293 STA_CONNECT_FAIL_REASON_NO_BSS_FOUND = 1,
5294 STA_CONNECT_FAIL_REASON_AUTH_TX_FAIL = 2,
5295 STA_CONNECT_FAIL_REASON_AUTH_NO_ACK_RECEIVED = 3,
5296 STA_CONNECT_FAIL_REASON_AUTH_NO_RESP_RECEIVED = 4,
5297 STA_CONNECT_FAIL_REASON_ASSOC_REQ_TX_FAIL = 5,
5298 STA_CONNECT_FAIL_REASON_ASSOC_NO_ACK_RECEIVED = 6,
5299 STA_CONNECT_FAIL_REASON_ASSOC_NO_RESP_RECEIVED = 7,
5300};
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07005301
5302/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005303 * union wpa_event_data - Additional data for wpa_supplicant_event() calls
5304 */
5305union wpa_event_data {
5306 /**
5307 * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
5308 *
5309 * This structure is optional for EVENT_ASSOC calls and required for
5310 * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
5311 * driver interface does not need to generate separate EVENT_ASSOCINFO
5312 * calls.
5313 */
5314 struct assoc_info {
5315 /**
5316 * reassoc - Flag to indicate association or reassociation
5317 */
5318 int reassoc;
5319
5320 /**
5321 * req_ies - (Re)Association Request IEs
5322 *
5323 * If the driver generates WPA/RSN IE, this event data must be
5324 * returned for WPA handshake to have needed information. If
5325 * wpa_supplicant-generated WPA/RSN IE is used, this
5326 * information event is optional.
5327 *
5328 * This should start with the first IE (fixed fields before IEs
5329 * are not included).
5330 */
5331 const u8 *req_ies;
5332
5333 /**
5334 * req_ies_len - Length of req_ies in bytes
5335 */
5336 size_t req_ies_len;
5337
5338 /**
5339 * resp_ies - (Re)Association Response IEs
5340 *
5341 * Optional association data from the driver. This data is not
5342 * required WPA, but may be useful for some protocols and as
5343 * such, should be reported if this is available to the driver
5344 * interface.
5345 *
5346 * This should start with the first IE (fixed fields before IEs
5347 * are not included).
5348 */
5349 const u8 *resp_ies;
5350
5351 /**
5352 * resp_ies_len - Length of resp_ies in bytes
5353 */
5354 size_t resp_ies_len;
5355
5356 /**
Dmitry Shmidt9839ecd2016-11-07 11:05:47 -08005357 * resp_frame - (Re)Association Response frame
5358 */
5359 const u8 *resp_frame;
5360
5361 /**
5362 * resp_frame_len - (Re)Association Response frame length
5363 */
5364 size_t resp_frame_len;
5365
5366 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005367 * beacon_ies - Beacon or Probe Response IEs
5368 *
5369 * Optional Beacon/ProbeResp data: IEs included in Beacon or
5370 * Probe Response frames from the current AP (i.e., the one
5371 * that the client just associated with). This information is
5372 * used to update WPA/RSN IE for the AP. If this field is not
5373 * set, the results from previous scan will be used. If no
5374 * data for the new AP is found, scan results will be requested
5375 * again (without scan request). At this point, the driver is
5376 * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
5377 * used).
5378 *
5379 * This should start with the first IE (fixed fields before IEs
5380 * are not included).
5381 */
5382 const u8 *beacon_ies;
5383
5384 /**
5385 * beacon_ies_len - Length of beacon_ies */
5386 size_t beacon_ies_len;
5387
5388 /**
5389 * freq - Frequency of the operational channel in MHz
5390 */
5391 unsigned int freq;
5392
5393 /**
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08005394 * wmm_params - WMM parameters used in this association.
5395 */
5396 struct wmm_params wmm_params;
5397
5398 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005399 * addr - Station address (for AP mode)
5400 */
5401 const u8 *addr;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08005402
5403 /**
5404 * The following is the key management offload information
5405 * @authorized
5406 * @key_replay_ctr
5407 * @key_replay_ctr_len
5408 * @ptk_kck
5409 * @ptk_kek_len
5410 * @ptk_kek
5411 * @ptk_kek_len
5412 */
5413
5414 /**
5415 * authorized - Status of key management offload,
5416 * 1 = successful
5417 */
5418 int authorized;
5419
5420 /**
5421 * key_replay_ctr - Key replay counter value last used
5422 * in a valid EAPOL-Key frame
5423 */
5424 const u8 *key_replay_ctr;
5425
5426 /**
5427 * key_replay_ctr_len - The length of key_replay_ctr
5428 */
5429 size_t key_replay_ctr_len;
5430
5431 /**
5432 * ptk_kck - The derived PTK KCK
5433 */
5434 const u8 *ptk_kck;
5435
5436 /**
5437 * ptk_kek_len - The length of ptk_kck
5438 */
5439 size_t ptk_kck_len;
5440
5441 /**
5442 * ptk_kek - The derived PTK KEK
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07005443 * This is used in key management offload and also in FILS SK
5444 * offload.
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08005445 */
5446 const u8 *ptk_kek;
5447
5448 /**
5449 * ptk_kek_len - The length of ptk_kek
5450 */
5451 size_t ptk_kek_len;
Dmitry Shmidtd7ff03d2015-12-04 14:49:35 -08005452
5453 /**
5454 * subnet_status - The subnet status:
5455 * 0 = unknown, 1 = unchanged, 2 = changed
5456 */
5457 u8 subnet_status;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07005458
5459 /**
5460 * The following information is used in FILS SK offload
5461 * @fils_erp_next_seq_num
5462 * @fils_pmk
5463 * @fils_pmk_len
5464 * @fils_pmkid
5465 */
5466
5467 /**
5468 * fils_erp_next_seq_num - The next sequence number to use in
5469 * FILS ERP messages
5470 */
5471 u16 fils_erp_next_seq_num;
5472
5473 /**
5474 * fils_pmk - A new PMK if generated in case of FILS
5475 * authentication
5476 */
5477 const u8 *fils_pmk;
5478
5479 /**
5480 * fils_pmk_len - Length of fils_pmk
5481 */
5482 size_t fils_pmk_len;
5483
5484 /**
5485 * fils_pmkid - PMKID used or generated in FILS authentication
5486 */
5487 const u8 *fils_pmkid;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005488 } assoc_info;
5489
5490 /**
5491 * struct disassoc_info - Data for EVENT_DISASSOC events
5492 */
5493 struct disassoc_info {
5494 /**
5495 * addr - Station address (for AP mode)
5496 */
5497 const u8 *addr;
5498
5499 /**
5500 * reason_code - Reason Code (host byte order) used in
5501 * Deauthentication frame
5502 */
5503 u16 reason_code;
5504
5505 /**
5506 * ie - Optional IE(s) in Disassociation frame
5507 */
5508 const u8 *ie;
5509
5510 /**
5511 * ie_len - Length of ie buffer in octets
5512 */
5513 size_t ie_len;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005514
5515 /**
5516 * locally_generated - Whether the frame was locally generated
5517 */
5518 int locally_generated;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005519 } disassoc_info;
5520
5521 /**
5522 * struct deauth_info - Data for EVENT_DEAUTH events
5523 */
5524 struct deauth_info {
5525 /**
5526 * addr - Station address (for AP mode)
5527 */
5528 const u8 *addr;
5529
5530 /**
5531 * reason_code - Reason Code (host byte order) used in
5532 * Deauthentication frame
5533 */
5534 u16 reason_code;
5535
5536 /**
5537 * ie - Optional IE(s) in Deauthentication frame
5538 */
5539 const u8 *ie;
5540
5541 /**
5542 * ie_len - Length of ie buffer in octets
5543 */
5544 size_t ie_len;
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005545
5546 /**
5547 * locally_generated - Whether the frame was locally generated
5548 */
5549 int locally_generated;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005550 } deauth_info;
5551
5552 /**
5553 * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
5554 */
5555 struct michael_mic_failure {
5556 int unicast;
5557 const u8 *src;
5558 } michael_mic_failure;
5559
5560 /**
5561 * struct interface_status - Data for EVENT_INTERFACE_STATUS
5562 */
5563 struct interface_status {
Dmitry Shmidte4663042016-04-04 10:07:49 -07005564 unsigned int ifindex;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005565 char ifname[100];
5566 enum {
5567 EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
5568 } ievent;
5569 } interface_status;
5570
5571 /**
5572 * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
5573 */
5574 struct pmkid_candidate {
5575 /** BSSID of the PMKID candidate */
5576 u8 bssid[ETH_ALEN];
5577 /** Smaller the index, higher the priority */
5578 int index;
5579 /** Whether RSN IE includes pre-authenticate flag */
5580 int preauth;
5581 } pmkid_candidate;
5582
5583 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005584 * struct tdls - Data for EVENT_TDLS
5585 */
5586 struct tdls {
5587 u8 peer[ETH_ALEN];
5588 enum {
5589 TDLS_REQUEST_SETUP,
Dmitry Shmidt4dd28dc2015-03-10 11:21:43 -07005590 TDLS_REQUEST_TEARDOWN,
5591 TDLS_REQUEST_DISCOVER,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005592 } oper;
5593 u16 reason_code; /* for teardown */
5594 } tdls;
5595
5596 /**
Dmitry Shmidt61d9df32012-08-29 16:22:06 -07005597 * struct wnm - Data for EVENT_WNM
5598 */
5599 struct wnm {
5600 u8 addr[ETH_ALEN];
5601 enum {
5602 WNM_OPER_SLEEP,
5603 } oper;
5604 enum {
5605 WNM_SLEEP_ENTER,
5606 WNM_SLEEP_EXIT
5607 } sleep_action;
5608 int sleep_intval;
5609 u16 reason_code;
5610 u8 *buf;
5611 u16 buf_len;
5612 } wnm;
5613
5614 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005615 * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
5616 *
5617 * During FT (IEEE 802.11r) authentication sequence, the driver is
5618 * expected to use this event to report received FT IEs (MDIE, FTIE,
5619 * RSN IE, TIE, possible resource request) to the supplicant. The FT
5620 * IEs for the next message will be delivered through the
5621 * struct wpa_driver_ops::update_ft_ies() callback.
5622 */
5623 struct ft_ies {
5624 const u8 *ies;
5625 size_t ies_len;
5626 int ft_action;
5627 u8 target_ap[ETH_ALEN];
5628 /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
5629 const u8 *ric_ies;
5630 /** Length of ric_ies buffer in octets */
5631 size_t ric_ies_len;
5632 } ft_ies;
5633
5634 /**
5635 * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
5636 */
5637 struct ibss_rsn_start {
5638 u8 peer[ETH_ALEN];
5639 } ibss_rsn_start;
5640
5641 /**
5642 * struct auth_info - Data for EVENT_AUTH events
5643 */
5644 struct auth_info {
5645 u8 peer[ETH_ALEN];
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08005646 u8 bssid[ETH_ALEN];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005647 u16 auth_type;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08005648 u16 auth_transaction;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005649 u16 status_code;
5650 const u8 *ies;
5651 size_t ies_len;
5652 } auth;
5653
5654 /**
5655 * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
5656 */
5657 struct assoc_reject {
5658 /**
5659 * bssid - BSSID of the AP that rejected association
5660 */
5661 const u8 *bssid;
5662
5663 /**
5664 * resp_ies - (Re)Association Response IEs
5665 *
5666 * Optional association data from the driver. This data is not
5667 * required WPA, but may be useful for some protocols and as
5668 * such, should be reported if this is available to the driver
5669 * interface.
5670 *
5671 * This should start with the first IE (fixed fields before IEs
5672 * are not included).
5673 */
5674 const u8 *resp_ies;
5675
5676 /**
5677 * resp_ies_len - Length of resp_ies in bytes
5678 */
5679 size_t resp_ies_len;
5680
5681 /**
5682 * status_code - Status Code from (Re)association Response
5683 */
5684 u16 status_code;
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -07005685
5686 /**
5687 * timed_out - Whether failure is due to timeout (etc.) rather
5688 * than explicit rejection response from the AP.
5689 */
5690 int timed_out;
Dmitry Shmidtebd93af2017-02-21 13:40:44 -08005691
5692 /**
5693 * timeout_reason - Reason for the timeout
5694 */
5695 const char *timeout_reason;
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07005696
5697 /**
5698 * fils_erp_next_seq_num - The next sequence number to use in
5699 * FILS ERP messages
5700 */
5701 u16 fils_erp_next_seq_num;
Hai Shalom60840252021-02-19 19:02:11 -08005702
5703 /**
5704 * reason_code - Connection failure reason code from the driver
5705 */
5706 enum sta_connect_fail_reason_codes reason_code;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005707 } assoc_reject;
5708
5709 struct timeout_event {
5710 u8 addr[ETH_ALEN];
5711 } timeout_event;
5712
5713 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005714 * struct tx_status - Data for EVENT_TX_STATUS events
5715 */
5716 struct tx_status {
5717 u16 type;
5718 u16 stype;
5719 const u8 *dst;
5720 const u8 *data;
5721 size_t data_len;
5722 int ack;
5723 } tx_status;
5724
5725 /**
5726 * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
5727 */
5728 struct rx_from_unknown {
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08005729 const u8 *bssid;
5730 const u8 *addr;
5731 int wds;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005732 } rx_from_unknown;
5733
5734 /**
5735 * struct rx_mgmt - Data for EVENT_RX_MGMT events
5736 */
5737 struct rx_mgmt {
5738 const u8 *frame;
5739 size_t frame_len;
5740 u32 datarate;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005741
5742 /**
Dmitry Shmidt98660862014-03-11 17:26:21 -07005743 * drv_priv - Pointer to store driver private BSS information
5744 *
5745 * If not set to NULL, this is used for comparison with
5746 * hostapd_data->drv_priv to determine which BSS should process
5747 * the frame.
5748 */
5749 void *drv_priv;
5750
5751 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005752 * freq - Frequency (in MHz) on which the frame was received
5753 */
5754 int freq;
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08005755
5756 /**
5757 * ssi_signal - Signal strength in dBm (or 0 if not available)
5758 */
5759 int ssi_signal;
5760 } rx_mgmt;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005761
5762 /**
5763 * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
5764 *
5765 * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
5766 */
5767 struct remain_on_channel {
5768 /**
5769 * freq - Channel frequency in MHz
5770 */
5771 unsigned int freq;
5772
5773 /**
5774 * duration - Duration to remain on the channel in milliseconds
5775 */
5776 unsigned int duration;
5777 } remain_on_channel;
5778
5779 /**
5780 * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
5781 * @aborted: Whether the scan was aborted
5782 * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
5783 * @num_freqs: Number of entries in freqs array
5784 * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
5785 * SSID)
5786 * @num_ssids: Number of entries in ssids array
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08005787 * @external_scan: Whether the scan info is for an external scan
5788 * @nl_scan_event: 1 if the source of this scan event is a normal scan,
5789 * 0 if the source of the scan event is a vendor scan
Dmitry Shmidt29333592017-01-09 12:27:11 -08005790 * @scan_start_tsf: Time when the scan started in terms of TSF of the
5791 * BSS that the interface that requested the scan is connected to
5792 * (if available).
5793 * @scan_start_tsf_bssid: The BSSID according to which %scan_start_tsf
5794 * is set.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005795 */
5796 struct scan_info {
5797 int aborted;
5798 const int *freqs;
5799 size_t num_freqs;
5800 struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
5801 size_t num_ssids;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08005802 int external_scan;
5803 int nl_scan_event;
Dmitry Shmidt29333592017-01-09 12:27:11 -08005804 u64 scan_start_tsf;
5805 u8 scan_start_tsf_bssid[ETH_ALEN];
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005806 } scan_info;
5807
5808 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005809 * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
5810 */
5811 struct rx_probe_req {
5812 /**
5813 * sa - Source address of the received Probe Request frame
5814 */
5815 const u8 *sa;
5816
5817 /**
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08005818 * da - Destination address of the received Probe Request frame
5819 * or %NULL if not available
5820 */
5821 const u8 *da;
5822
5823 /**
5824 * bssid - BSSID of the received Probe Request frame or %NULL
5825 * if not available
5826 */
5827 const u8 *bssid;
5828
5829 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005830 * ie - IEs from the Probe Request body
5831 */
5832 const u8 *ie;
5833
5834 /**
5835 * ie_len - Length of ie buffer in octets
5836 */
5837 size_t ie_len;
Dmitry Shmidt04949592012-07-19 12:16:46 -07005838
5839 /**
5840 * signal - signal strength in dBm (or 0 if not available)
5841 */
5842 int ssi_signal;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005843 } rx_probe_req;
5844
5845 /**
5846 * struct new_sta - Data for EVENT_NEW_STA events
5847 */
5848 struct new_sta {
5849 const u8 *addr;
5850 } new_sta;
5851
5852 /**
5853 * struct eapol_rx - Data for EVENT_EAPOL_RX events
5854 */
5855 struct eapol_rx {
5856 const u8 *src;
5857 const u8 *data;
5858 size_t data_len;
5859 } eapol_rx;
5860
5861 /**
5862 * signal_change - Data for EVENT_SIGNAL_CHANGE events
5863 */
5864 struct wpa_signal_info signal_change;
5865
5866 /**
5867 * struct best_channel - Data for EVENT_BEST_CHANNEL events
5868 * @freq_24: Best 2.4 GHz band channel frequency in MHz
5869 * @freq_5: Best 5 GHz band channel frequency in MHz
5870 * @freq_overall: Best channel frequency in MHz
5871 *
5872 * 0 can be used to indicate no preference in either band.
5873 */
5874 struct best_channel {
5875 int freq_24;
5876 int freq_5;
5877 int freq_overall;
5878 } best_chan;
5879
5880 struct unprot_deauth {
5881 const u8 *sa;
5882 const u8 *da;
5883 u16 reason_code;
5884 } unprot_deauth;
5885
5886 struct unprot_disassoc {
5887 const u8 *sa;
5888 const u8 *da;
5889 u16 reason_code;
5890 } unprot_disassoc;
5891
5892 /**
5893 * struct low_ack - Data for EVENT_STATION_LOW_ACK events
5894 * @addr: station address
Paul Stewart092955c2017-02-06 09:13:09 -08005895 * @num_packets: Number of packets lost (consecutive packets not
5896 * acknowledged)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005897 */
5898 struct low_ack {
5899 u8 addr[ETH_ALEN];
Paul Stewart092955c2017-02-06 09:13:09 -08005900 u32 num_packets;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005901 } low_ack;
5902
5903 /**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07005904 * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
5905 */
5906 struct ibss_peer_lost {
5907 u8 peer[ETH_ALEN];
5908 } ibss_peer_lost;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08005909
5910 /**
5911 * struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
5912 */
5913 struct driver_gtk_rekey {
5914 const u8 *bssid;
5915 const u8 *replay_ctr;
5916 } driver_gtk_rekey;
5917
5918 /**
5919 * struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
5920 * @addr: station address
5921 */
5922 struct client_poll {
5923 u8 addr[ETH_ALEN];
5924 } client_poll;
5925
5926 /**
5927 * struct eapol_tx_status
5928 * @dst: Original destination
5929 * @data: Data starting with IEEE 802.1X header (!)
5930 * @data_len: Length of data
5931 * @ack: Indicates ack or lost frame
5932 *
5933 * This corresponds to hapd_send_eapol if the frame sent
5934 * there isn't just reported as EVENT_TX_STATUS.
5935 */
5936 struct eapol_tx_status {
5937 const u8 *dst;
5938 const u8 *data;
5939 int data_len;
5940 int ack;
5941 } eapol_tx_status;
Dmitry Shmidt04949592012-07-19 12:16:46 -07005942
5943 /**
5944 * struct ch_switch
5945 * @freq: Frequency of new channel in MHz
5946 * @ht_enabled: Whether this is an HT channel
5947 * @ch_offset: Secondary channel offset
Dmitry Shmidt04f534e2013-12-09 15:50:16 -08005948 * @ch_width: Channel width
5949 * @cf1: Center frequency 1
5950 * @cf2: Center frequency 2
Dmitry Shmidt04949592012-07-19 12:16:46 -07005951 */
5952 struct ch_switch {
5953 int freq;
5954 int ht_enabled;
5955 int ch_offset;
Dmitry Shmidt04f534e2013-12-09 15:50:16 -08005956 enum chan_width ch_width;
5957 int cf1;
5958 int cf2;
Dmitry Shmidt04949592012-07-19 12:16:46 -07005959 } ch_switch;
Dmitry Shmidtf8623282013-02-20 14:34:59 -08005960
5961 /**
5962 * struct connect_failed - Data for EVENT_CONNECT_FAILED_REASON
5963 * @addr: Remote client address
5964 * @code: Reason code for connection failure
5965 */
5966 struct connect_failed_reason {
5967 u8 addr[ETH_ALEN];
5968 enum {
5969 MAX_CLIENT_REACHED,
5970 BLOCKED_CLIENT
5971 } code;
5972 } connect_failed_reason;
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005973
5974 /**
5975 * struct dfs_event - Data for radar detected events
5976 * @freq: Frequency of the channel in MHz
5977 */
5978 struct dfs_event {
5979 int freq;
Dmitry Shmidt051af732013-10-22 13:52:46 -07005980 int ht_enabled;
5981 int chan_offset;
5982 enum chan_width chan_width;
5983 int cf1;
5984 int cf2;
Dmitry Shmidtea69e842013-05-13 14:52:28 -07005985 } dfs_event;
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07005986
5987 /**
5988 * survey_results - Survey result data for EVENT_SURVEY
5989 * @freq_filter: Requested frequency survey filter, 0 if request
5990 * was for all survey data
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08005991 * @survey_list: Linked list of survey data (struct freq_survey)
Dmitry Shmidtb7b4d0e2013-08-26 12:09:05 -07005992 */
5993 struct survey_results {
5994 unsigned int freq_filter;
5995 struct dl_list survey_list; /* struct freq_survey */
5996 } survey_results;
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08005997
5998 /**
5999 * channel_list_changed - Data for EVENT_CHANNEL_LIST_CHANGED
6000 * @initiator: Initiator of the regulatory change
Dmitry Shmidt7dba0e52014-04-14 10:49:15 -07006001 * @type: Regulatory change type
6002 * @alpha2: Country code (or "" if not available)
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08006003 */
6004 struct channel_list_changed {
6005 enum reg_change_initiator initiator;
Dmitry Shmidt7dba0e52014-04-14 10:49:15 -07006006 enum reg_type type;
6007 char alpha2[3];
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -08006008 } channel_list_changed;
Dmitry Shmidtcf32e602014-01-28 10:57:39 -08006009
6010 /**
6011 * freq_range - List of frequency ranges
6012 *
6013 * This is used as the data with EVENT_AVOID_FREQUENCIES.
6014 */
6015 struct wpa_freq_range_list freq_range;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08006016
6017 /**
6018 * struct mesh_peer
6019 *
6020 * @peer: Peer address
6021 * @ies: Beacon IEs
6022 * @ie_len: Length of @ies
6023 *
6024 * Notification of new candidate mesh peer.
6025 */
6026 struct mesh_peer {
6027 const u8 *peer;
6028 const u8 *ies;
6029 size_t ie_len;
6030 } mesh_peer;
6031
6032 /**
6033 * struct acs_selected_channels - Data for EVENT_ACS_CHANNEL_SELECTED
Ahmed ElArabawy0ff61c52019-12-26 12:38:39 -08006034 * @pri_freq: Selected primary frequency
6035 * @sec_freq: Selected secondary frequency
Hai Shalomfdcde762020-04-02 11:19:20 -07006036 * @edmg_channel: Selected EDMG channel
Dmitry Shmidtdda10c22015-03-24 16:05:01 -07006037 * @vht_seg0_center_ch: VHT mode Segment0 center channel
Hai Shalomfdcde762020-04-02 11:19:20 -07006038 * The value is the index of the channel center frequency for
6039 * 20 MHz, 40 MHz, and 80 MHz channels. The value is the center
6040 * frequency index of the primary 80 MHz segment for 160 MHz and
6041 * 80+80 MHz channels.
Dmitry Shmidtdda10c22015-03-24 16:05:01 -07006042 * @vht_seg1_center_ch: VHT mode Segment1 center channel
Hai Shalomfdcde762020-04-02 11:19:20 -07006043 * The value is zero for 20 MHz, 40 MHz, and 80 MHz channels. The
6044 * value is the index of the channel center frequency for 160 MHz
6045 * channels and the center frequency index of the secondary 80 MHz
6046 * segment for 80+80 MHz channels.
Dmitry Shmidtdda10c22015-03-24 16:05:01 -07006047 * @ch_width: Selected Channel width by driver. Driver may choose to
6048 * change hostapd configured ACS channel width due driver internal
6049 * channel restrictions.
Dmitry Shmidtb1e52102015-05-29 12:36:29 -07006050 * hw_mode: Selected band (used with hw_mode=any)
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08006051 */
6052 struct acs_selected_channels {
Ahmed ElArabawy0ff61c52019-12-26 12:38:39 -08006053 unsigned int pri_freq;
6054 unsigned int sec_freq;
Hai Shalomfdcde762020-04-02 11:19:20 -07006055 u8 edmg_channel;
Dmitry Shmidtdda10c22015-03-24 16:05:01 -07006056 u8 vht_seg0_center_ch;
6057 u8 vht_seg1_center_ch;
6058 u16 ch_width;
Dmitry Shmidtb1e52102015-05-29 12:36:29 -07006059 enum hostapd_hw_mode hw_mode;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08006060 } acs_selected_channels;
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -07006061
6062 /**
6063 * struct p2p_lo_stop - Reason code for P2P Listen offload stop event
6064 * @reason_code: Reason for stopping offload
6065 * P2P_LO_STOPPED_REASON_COMPLETE: Listen offload finished as
6066 * scheduled.
6067 * P2P_LO_STOPPED_REASON_RECV_STOP_CMD: Host requested offload to
6068 * be stopped.
6069 * P2P_LO_STOPPED_REASON_INVALID_PARAM: Invalid listen offload
6070 * parameters.
6071 * P2P_LO_STOPPED_REASON_NOT_SUPPORTED: Listen offload not
6072 * supported by device.
6073 */
6074 struct p2p_lo_stop {
6075 enum {
6076 P2P_LO_STOPPED_REASON_COMPLETE = 0,
6077 P2P_LO_STOPPED_REASON_RECV_STOP_CMD,
6078 P2P_LO_STOPPED_REASON_INVALID_PARAM,
6079 P2P_LO_STOPPED_REASON_NOT_SUPPORTED,
6080 } reason_code;
6081 } p2p_lo_stop;
Roshan Pius3a1667e2018-07-03 15:17:14 -07006082
6083 /* For EVENT_EXTERNAL_AUTH */
6084 struct external_auth external_auth;
6085
6086 /**
6087 * struct sta_opmode - Station's operation mode change event
6088 * @addr: The station MAC address
6089 * @smps_mode: SMPS mode of the station
6090 * @chan_width: Channel width of the station
6091 * @rx_nss: RX_NSS of the station
6092 *
6093 * This is used as data with EVENT_STATION_OPMODE_CHANGED.
6094 */
6095 struct sta_opmode {
6096 const u8 *addr;
6097 enum smps_mode smps_mode;
6098 enum chan_width chan_width;
6099 u8 rx_nss;
6100 } sta_opmode;
6101
6102 /**
6103 * struct wds_sta_interface - Data for EVENT_WDS_STA_INTERFACE_STATUS.
6104 */
6105 struct wds_sta_interface {
6106 const u8 *sta_addr;
6107 const char *ifname;
6108 enum {
6109 INTERFACE_ADDED,
6110 INTERFACE_REMOVED
6111 } istatus;
6112 } wds_sta_interface;
Hai Shalom81f62d82019-07-22 12:10:00 -07006113
6114 /**
6115 * struct update_dh - Data for EVENT_UPDATE_DH
6116 */
6117 struct update_dh {
6118 const u8 *peer;
6119 const u8 *ie;
6120 size_t ie_len;
6121 } update_dh;
Hai Shalomfdcde762020-04-02 11:19:20 -07006122
6123 /**
6124 * struct unprot_beacon - Data for EVENT_UNPROT_BEACON
6125 */
6126 struct unprot_beacon {
6127 const u8 *sa;
6128 } unprot_beacon;
Sunil Ravia04bd252022-05-02 22:54:18 -07006129
6130 /**
6131 * struct bss_color_collision - Data for EVENT_BSS_COLOR_COLLISION
6132 */
6133 struct bss_color_collision {
6134 u64 bitmap;
6135 } bss_color_collision;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07006136};
6137
6138/**
6139 * wpa_supplicant_event - Report a driver event for wpa_supplicant
6140 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
6141 * with struct wpa_driver_ops::init()
6142 * @event: event type (defined above)
6143 * @data: possible extra data for the event
6144 *
6145 * Driver wrapper code should call this function whenever an event is received
6146 * from the driver.
6147 */
6148void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
6149 union wpa_event_data *data);
6150
Dmitry Shmidte4663042016-04-04 10:07:49 -07006151/**
6152 * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
6153 * @ctx: Context pointer (wpa_s); this is the ctx variable registered
6154 * with struct wpa_driver_ops::init()
6155 * @event: event type (defined above)
6156 * @data: possible extra data for the event
6157 *
6158 * Same as wpa_supplicant_event(), but we search for the interface in
6159 * wpa_global.
6160 */
6161void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
6162 union wpa_event_data *data);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07006163
6164/*
6165 * The following inline functions are provided for convenience to simplify
6166 * event indication for some of the common events.
6167 */
6168
6169static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
6170 size_t ielen, int reassoc)
6171{
6172 union wpa_event_data event;
6173 os_memset(&event, 0, sizeof(event));
6174 event.assoc_info.reassoc = reassoc;
6175 event.assoc_info.req_ies = ie;
6176 event.assoc_info.req_ies_len = ielen;
6177 event.assoc_info.addr = addr;
6178 wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
6179}
6180
6181static inline void drv_event_disassoc(void *ctx, const u8 *addr)
6182{
6183 union wpa_event_data event;
6184 os_memset(&event, 0, sizeof(event));
6185 event.disassoc_info.addr = addr;
6186 wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
6187}
6188
6189static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
6190 size_t data_len)
6191{
6192 union wpa_event_data event;
6193 os_memset(&event, 0, sizeof(event));
6194 event.eapol_rx.src = src;
6195 event.eapol_rx.data = data;
6196 event.eapol_rx.data_len = data_len;
6197 wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
6198}
6199
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -08006200/* driver_common.c */
6201void wpa_scan_results_free(struct wpa_scan_results *res);
6202
6203/* Convert wpa_event_type to a string for logging */
6204const char * event_to_string(enum wpa_event_type event);
6205
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07006206/* Convert chan_width to a string for logging and control interfaces */
6207const char * channel_width_to_string(enum chan_width width);
6208
Hai Shalom74f70d42019-02-11 14:42:39 -08006209int channel_width_to_int(enum chan_width width);
6210
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08006211int ht_supported(const struct hostapd_hw_modes *mode);
6212int vht_supported(const struct hostapd_hw_modes *mode);
6213
6214struct wowlan_triggers *
6215wpa_get_wowlan_triggers(const char *wowlan_triggers,
6216 const struct wpa_driver_capa *capa);
Dmitry Shmidt58d12ad2016-07-28 10:07:03 -07006217/* Convert driver flag to string */
6218const char * driver_flag_to_string(u64 flag);
Hai Shalomb755a2a2020-04-23 21:49:02 -07006219const char * driver_flag2_to_string(u64 flag2);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08006220
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08006221/* NULL terminated array of linked in driver wrappers */
Dmitry Shmidt1d755d02015-04-28 10:34:29 -07006222extern const struct wpa_driver_ops *const wpa_drivers[];
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -08006223
Dmitry Shmidt4ae50e62016-06-27 13:48:39 -07006224
6225/* Available drivers */
6226
6227#ifdef CONFIG_DRIVER_WEXT
6228extern const struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
6229#endif /* CONFIG_DRIVER_WEXT */
6230#ifdef CONFIG_DRIVER_NL80211
6231/* driver_nl80211.c */
6232extern const struct wpa_driver_ops wpa_driver_nl80211_ops;
6233#endif /* CONFIG_DRIVER_NL80211 */
6234#ifdef CONFIG_DRIVER_HOSTAP
6235extern const struct wpa_driver_ops wpa_driver_hostap_ops; /* driver_hostap.c */
6236#endif /* CONFIG_DRIVER_HOSTAP */
6237#ifdef CONFIG_DRIVER_BSD
6238extern const struct wpa_driver_ops wpa_driver_bsd_ops; /* driver_bsd.c */
6239#endif /* CONFIG_DRIVER_BSD */
6240#ifdef CONFIG_DRIVER_OPENBSD
6241/* driver_openbsd.c */
6242extern const struct wpa_driver_ops wpa_driver_openbsd_ops;
6243#endif /* CONFIG_DRIVER_OPENBSD */
6244#ifdef CONFIG_DRIVER_NDIS
6245extern struct wpa_driver_ops wpa_driver_ndis_ops; /* driver_ndis.c */
6246#endif /* CONFIG_DRIVER_NDIS */
6247#ifdef CONFIG_DRIVER_WIRED
6248extern const struct wpa_driver_ops wpa_driver_wired_ops; /* driver_wired.c */
6249#endif /* CONFIG_DRIVER_WIRED */
6250#ifdef CONFIG_DRIVER_MACSEC_QCA
6251/* driver_macsec_qca.c */
6252extern const struct wpa_driver_ops wpa_driver_macsec_qca_ops;
6253#endif /* CONFIG_DRIVER_MACSEC_QCA */
Dmitry Shmidtabb90a32016-12-05 15:34:39 -08006254#ifdef CONFIG_DRIVER_MACSEC_LINUX
6255/* driver_macsec_linux.c */
6256extern const struct wpa_driver_ops wpa_driver_macsec_linux_ops;
6257#endif /* CONFIG_DRIVER_MACSEC_LINUX */
Dmitry Shmidt4ae50e62016-06-27 13:48:39 -07006258#ifdef CONFIG_DRIVER_ROBOSWITCH
6259/* driver_roboswitch.c */
6260extern const struct wpa_driver_ops wpa_driver_roboswitch_ops;
6261#endif /* CONFIG_DRIVER_ROBOSWITCH */
6262#ifdef CONFIG_DRIVER_ATHEROS
6263/* driver_atheros.c */
6264extern const struct wpa_driver_ops wpa_driver_atheros_ops;
6265#endif /* CONFIG_DRIVER_ATHEROS */
6266#ifdef CONFIG_DRIVER_NONE
6267extern const struct wpa_driver_ops wpa_driver_none_ops; /* driver_none.c */
6268#endif /* CONFIG_DRIVER_NONE */
6269
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07006270#endif /* DRIVER_H */