wpa_supplicant_i.h 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475
  1. /*
  2. * wpa_supplicant - Internal definitions
  3. * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef WPA_SUPPLICANT_I_H
  9. #define WPA_SUPPLICANT_I_H
  10. #include "utils/bitfield.h"
  11. #include "utils/list.h"
  12. #include "common/defs.h"
  13. #include "common/sae.h"
  14. #include "common/wpa_ctrl.h"
  15. #include "wps/wps_defs.h"
  16. #include "config_ssid.h"
  17. #include "wmm_ac.h"
  18. extern const char *const wpa_supplicant_version;
  19. extern const char *const wpa_supplicant_license;
  20. #ifndef CONFIG_NO_STDOUT_DEBUG
  21. extern const char *const wpa_supplicant_full_license1;
  22. extern const char *const wpa_supplicant_full_license2;
  23. extern const char *const wpa_supplicant_full_license3;
  24. extern const char *const wpa_supplicant_full_license4;
  25. extern const char *const wpa_supplicant_full_license5;
  26. #endif /* CONFIG_NO_STDOUT_DEBUG */
  27. struct wpa_sm;
  28. struct wpa_supplicant;
  29. struct ibss_rsn;
  30. struct scan_info;
  31. struct wpa_bss;
  32. struct wpa_scan_results;
  33. struct hostapd_hw_modes;
  34. struct wpa_driver_associate_params;
  35. /*
  36. * Forward declarations of private structures used within the ctrl_iface
  37. * backends. Other parts of wpa_supplicant do not have access to data stored in
  38. * these structures.
  39. */
  40. struct ctrl_iface_priv;
  41. struct ctrl_iface_global_priv;
  42. struct wpas_dbus_priv;
  43. struct wpas_binder_priv;
  44. /**
  45. * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
  46. */
  47. struct wpa_interface {
  48. /**
  49. * confname - Configuration name (file or profile) name
  50. *
  51. * This can also be %NULL when a configuration file is not used. In
  52. * that case, ctrl_interface must be set to allow the interface to be
  53. * configured.
  54. */
  55. const char *confname;
  56. /**
  57. * confanother - Additional configuration name (file or profile) name
  58. *
  59. * This can also be %NULL when the additional configuration file is not
  60. * used.
  61. */
  62. const char *confanother;
  63. /**
  64. * ctrl_interface - Control interface parameter
  65. *
  66. * If a configuration file is not used, this variable can be used to
  67. * set the ctrl_interface parameter that would have otherwise been read
  68. * from the configuration file. If both confname and ctrl_interface are
  69. * set, ctrl_interface is used to override the value from configuration
  70. * file.
  71. */
  72. const char *ctrl_interface;
  73. /**
  74. * driver - Driver interface name, or %NULL to use the default driver
  75. */
  76. const char *driver;
  77. /**
  78. * driver_param - Driver interface parameters
  79. *
  80. * If a configuration file is not used, this variable can be used to
  81. * set the driver_param parameters that would have otherwise been read
  82. * from the configuration file. If both confname and driver_param are
  83. * set, driver_param is used to override the value from configuration
  84. * file.
  85. */
  86. const char *driver_param;
  87. /**
  88. * ifname - Interface name
  89. */
  90. const char *ifname;
  91. /**
  92. * bridge_ifname - Optional bridge interface name
  93. *
  94. * If the driver interface (ifname) is included in a Linux bridge
  95. * device, the bridge interface may need to be used for receiving EAPOL
  96. * frames. This can be enabled by setting this variable to enable
  97. * receiving of EAPOL frames from an additional interface.
  98. */
  99. const char *bridge_ifname;
  100. /**
  101. * p2p_mgmt - Interface used for P2P management (P2P Device operations)
  102. *
  103. * Indicates whether wpas_p2p_init() must be called for this interface.
  104. * This is used only when the driver supports a dedicated P2P Device
  105. * interface that is not a network interface.
  106. */
  107. int p2p_mgmt;
  108. };
  109. /**
  110. * struct wpa_params - Parameters for wpa_supplicant_init()
  111. */
  112. struct wpa_params {
  113. /**
  114. * daemonize - Run %wpa_supplicant in the background
  115. */
  116. int daemonize;
  117. /**
  118. * wait_for_monitor - Wait for a monitor program before starting
  119. */
  120. int wait_for_monitor;
  121. /**
  122. * pid_file - Path to a PID (process ID) file
  123. *
  124. * If this and daemonize are set, process ID of the background process
  125. * will be written to the specified file.
  126. */
  127. char *pid_file;
  128. /**
  129. * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
  130. */
  131. int wpa_debug_level;
  132. /**
  133. * wpa_debug_show_keys - Whether keying material is included in debug
  134. *
  135. * This parameter can be used to allow keying material to be included
  136. * in debug messages. This is a security risk and this option should
  137. * not be enabled in normal configuration. If needed during
  138. * development or while troubleshooting, this option can provide more
  139. * details for figuring out what is happening.
  140. */
  141. int wpa_debug_show_keys;
  142. /**
  143. * wpa_debug_timestamp - Whether to include timestamp in debug messages
  144. */
  145. int wpa_debug_timestamp;
  146. /**
  147. * ctrl_interface - Global ctrl_iface path/parameter
  148. */
  149. char *ctrl_interface;
  150. /**
  151. * ctrl_interface_group - Global ctrl_iface group
  152. */
  153. char *ctrl_interface_group;
  154. /**
  155. * dbus_ctrl_interface - Enable the DBus control interface
  156. */
  157. int dbus_ctrl_interface;
  158. /**
  159. * wpa_debug_file_path - Path of debug file or %NULL to use stdout
  160. */
  161. const char *wpa_debug_file_path;
  162. /**
  163. * wpa_debug_syslog - Enable log output through syslog
  164. */
  165. int wpa_debug_syslog;
  166. /**
  167. * wpa_debug_tracing - Enable log output through Linux tracing
  168. */
  169. int wpa_debug_tracing;
  170. /**
  171. * override_driver - Optional driver parameter override
  172. *
  173. * This parameter can be used to override the driver parameter in
  174. * dynamic interface addition to force a specific driver wrapper to be
  175. * used instead.
  176. */
  177. char *override_driver;
  178. /**
  179. * override_ctrl_interface - Optional ctrl_interface override
  180. *
  181. * This parameter can be used to override the ctrl_interface parameter
  182. * in dynamic interface addition to force a control interface to be
  183. * created.
  184. */
  185. char *override_ctrl_interface;
  186. /**
  187. * entropy_file - Optional entropy file
  188. *
  189. * This parameter can be used to configure wpa_supplicant to maintain
  190. * its internal entropy store over restarts.
  191. */
  192. char *entropy_file;
  193. #ifdef CONFIG_P2P
  194. /**
  195. * conf_p2p_dev - Configuration file used to hold the
  196. * P2P Device configuration parameters.
  197. *
  198. * This can also be %NULL. In such a case, if a P2P Device dedicated
  199. * interfaces is created, the main configuration file will be used.
  200. */
  201. char *conf_p2p_dev;
  202. #endif /* CONFIG_P2P */
  203. #ifdef CONFIG_MATCH_IFACE
  204. /**
  205. * match_ifaces - Interface descriptions to match
  206. */
  207. struct wpa_interface *match_ifaces;
  208. /**
  209. * match_iface_count - Number of defined matching interfaces
  210. */
  211. int match_iface_count;
  212. #endif /* CONFIG_MATCH_IFACE */
  213. };
  214. struct p2p_srv_bonjour {
  215. struct dl_list list;
  216. struct wpabuf *query;
  217. struct wpabuf *resp;
  218. };
  219. struct p2p_srv_upnp {
  220. struct dl_list list;
  221. u8 version;
  222. char *service;
  223. };
  224. /**
  225. * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
  226. *
  227. * This structure is initialized by calling wpa_supplicant_init() when starting
  228. * %wpa_supplicant.
  229. */
  230. struct wpa_global {
  231. struct wpa_supplicant *ifaces;
  232. struct wpa_params params;
  233. struct ctrl_iface_global_priv *ctrl_iface;
  234. struct wpas_dbus_priv *dbus;
  235. struct wpas_binder_priv *binder;
  236. void **drv_priv;
  237. size_t drv_count;
  238. struct os_time suspend_time;
  239. struct p2p_data *p2p;
  240. struct wpa_supplicant *p2p_init_wpa_s;
  241. struct wpa_supplicant *p2p_group_formation;
  242. struct wpa_supplicant *p2p_invite_group;
  243. u8 p2p_dev_addr[ETH_ALEN];
  244. struct os_reltime p2p_go_wait_client;
  245. struct dl_list p2p_srv_bonjour; /* struct p2p_srv_bonjour */
  246. struct dl_list p2p_srv_upnp; /* struct p2p_srv_upnp */
  247. int p2p_disabled;
  248. int cross_connection;
  249. struct wpa_freq_range_list p2p_disallow_freq;
  250. struct wpa_freq_range_list p2p_go_avoid_freq;
  251. enum wpa_conc_pref {
  252. WPA_CONC_PREF_NOT_SET,
  253. WPA_CONC_PREF_STA,
  254. WPA_CONC_PREF_P2P
  255. } conc_pref;
  256. unsigned int p2p_per_sta_psk:1;
  257. unsigned int p2p_fail_on_wps_complete:1;
  258. unsigned int p2p_24ghz_social_channels:1;
  259. unsigned int pending_p2ps_group:1;
  260. unsigned int pending_group_iface_for_p2ps:1;
  261. unsigned int pending_p2ps_group_freq;
  262. #ifdef CONFIG_WIFI_DISPLAY
  263. int wifi_display;
  264. #define MAX_WFD_SUBELEMS 12
  265. struct wpabuf *wfd_subelem[MAX_WFD_SUBELEMS];
  266. #endif /* CONFIG_WIFI_DISPLAY */
  267. struct psk_list_entry *add_psk; /* From group formation */
  268. };
  269. /**
  270. * struct wpa_radio - Internal data for per-radio information
  271. *
  272. * This structure is used to share data about configured interfaces
  273. * (struct wpa_supplicant) that share the same physical radio, e.g., to allow
  274. * better coordination of offchannel operations.
  275. */
  276. struct wpa_radio {
  277. char name[16]; /* from driver_ops get_radio_name() or empty if not
  278. * available */
  279. unsigned int external_scan_running:1;
  280. unsigned int num_active_works;
  281. struct dl_list ifaces; /* struct wpa_supplicant::radio_list entries */
  282. struct dl_list work; /* struct wpa_radio_work::list entries */
  283. };
  284. #define MAX_ACTIVE_WORKS 2
  285. /**
  286. * struct wpa_radio_work - Radio work item
  287. */
  288. struct wpa_radio_work {
  289. struct dl_list list;
  290. unsigned int freq; /* known frequency (MHz) or 0 for multiple/unknown */
  291. const char *type;
  292. struct wpa_supplicant *wpa_s;
  293. void (*cb)(struct wpa_radio_work *work, int deinit);
  294. void *ctx;
  295. unsigned int started:1;
  296. struct os_reltime time;
  297. unsigned int bands;
  298. };
  299. int radio_add_work(struct wpa_supplicant *wpa_s, unsigned int freq,
  300. const char *type, int next,
  301. void (*cb)(struct wpa_radio_work *work, int deinit),
  302. void *ctx);
  303. void radio_work_done(struct wpa_radio_work *work);
  304. void radio_remove_works(struct wpa_supplicant *wpa_s,
  305. const char *type, int remove_all);
  306. void radio_work_check_next(struct wpa_supplicant *wpa_s);
  307. struct wpa_radio_work *
  308. radio_work_pending(struct wpa_supplicant *wpa_s, const char *type);
  309. struct wpa_connect_work {
  310. unsigned int sme:1;
  311. unsigned int bss_removed:1;
  312. struct wpa_bss *bss;
  313. struct wpa_ssid *ssid;
  314. };
  315. int wpas_valid_bss_ssid(struct wpa_supplicant *wpa_s, struct wpa_bss *test_bss,
  316. struct wpa_ssid *test_ssid);
  317. void wpas_connect_work_free(struct wpa_connect_work *cwork);
  318. void wpas_connect_work_done(struct wpa_supplicant *wpa_s);
  319. struct wpa_external_work {
  320. unsigned int id;
  321. char type[100];
  322. unsigned int timeout;
  323. };
  324. enum wpa_radio_work_band wpas_freq_to_band(int freq);
  325. unsigned int wpas_get_bands(struct wpa_supplicant *wpa_s, const int *freqs);
  326. /**
  327. * offchannel_send_action_result - Result of offchannel send Action frame
  328. */
  329. enum offchannel_send_action_result {
  330. OFFCHANNEL_SEND_ACTION_SUCCESS /**< Frame was send and acknowledged */,
  331. OFFCHANNEL_SEND_ACTION_NO_ACK /**< Frame was sent, but not acknowledged
  332. */,
  333. OFFCHANNEL_SEND_ACTION_FAILED /**< Frame was not sent due to a failure
  334. */
  335. };
  336. struct wps_ap_info {
  337. u8 bssid[ETH_ALEN];
  338. enum wps_ap_info_type {
  339. WPS_AP_NOT_SEL_REG,
  340. WPS_AP_SEL_REG,
  341. WPS_AP_SEL_REG_OUR
  342. } type;
  343. unsigned int tries;
  344. struct os_reltime last_attempt;
  345. unsigned int pbc_active;
  346. u8 uuid[WPS_UUID_LEN];
  347. };
  348. #define WPA_FREQ_USED_BY_INFRA_STATION BIT(0)
  349. #define WPA_FREQ_USED_BY_P2P_CLIENT BIT(1)
  350. struct wpa_used_freq_data {
  351. int freq;
  352. unsigned int flags;
  353. };
  354. #define RRM_NEIGHBOR_REPORT_TIMEOUT 1 /* 1 second for AP to send a report */
  355. /*
  356. * struct rrm_data - Data used for managing RRM features
  357. */
  358. struct rrm_data {
  359. /* rrm_used - indication regarding the current connection */
  360. unsigned int rrm_used:1;
  361. /*
  362. * notify_neighbor_rep - Callback for notifying report requester
  363. */
  364. void (*notify_neighbor_rep)(void *ctx, struct wpabuf *neighbor_rep);
  365. /*
  366. * neighbor_rep_cb_ctx - Callback context
  367. * Received in the callback registration, and sent to the callback
  368. * function as a parameter.
  369. */
  370. void *neighbor_rep_cb_ctx;
  371. /* next_neighbor_rep_token - Next request's dialog token */
  372. u8 next_neighbor_rep_token;
  373. /* token - Dialog token of the current radio measurement */
  374. u8 token;
  375. /* destination address of the current radio measurement request */
  376. u8 dst_addr[ETH_ALEN];
  377. };
  378. enum wpa_supplicant_test_failure {
  379. WPAS_TEST_FAILURE_NONE,
  380. WPAS_TEST_FAILURE_SCAN_TRIGGER,
  381. };
  382. struct icon_entry {
  383. struct dl_list list;
  384. u8 bssid[ETH_ALEN];
  385. u8 dialog_token;
  386. char *file_name;
  387. u8 *image;
  388. size_t image_len;
  389. };
  390. struct wpa_bss_tmp_disallowed {
  391. struct dl_list list;
  392. u8 bssid[ETH_ALEN];
  393. };
  394. struct beacon_rep_data {
  395. u8 token;
  396. struct wpa_driver_scan_params scan_params;
  397. u8 ssid[SSID_MAX_LEN];
  398. size_t ssid_len;
  399. u8 bssid[ETH_ALEN];
  400. enum beacon_report_detail report_detail;
  401. struct bitfield *eids;
  402. };
  403. struct external_pmksa_cache {
  404. struct dl_list list;
  405. void *pmksa_cache;
  406. };
  407. struct fils_hlp_req {
  408. struct dl_list list;
  409. u8 dst[ETH_ALEN];
  410. struct wpabuf *pkt;
  411. };
  412. /**
  413. * struct wpa_supplicant - Internal data for wpa_supplicant interface
  414. *
  415. * This structure contains the internal data for core wpa_supplicant code. This
  416. * should be only used directly from the core code. However, a pointer to this
  417. * data is used from other files as an arbitrary context pointer in calls to
  418. * core functions.
  419. */
  420. struct wpa_supplicant {
  421. struct wpa_global *global;
  422. struct wpa_radio *radio; /* shared radio context */
  423. struct dl_list radio_list; /* list head: struct wpa_radio::ifaces */
  424. struct wpa_supplicant *parent;
  425. struct wpa_supplicant *p2pdev;
  426. struct wpa_supplicant *next;
  427. struct l2_packet_data *l2;
  428. struct l2_packet_data *l2_br;
  429. unsigned char own_addr[ETH_ALEN];
  430. unsigned char perm_addr[ETH_ALEN];
  431. char ifname[100];
  432. #ifdef CONFIG_MATCH_IFACE
  433. int matched;
  434. #endif /* CONFIG_MATCH_IFACE */
  435. #ifdef CONFIG_CTRL_IFACE_DBUS
  436. char *dbus_path;
  437. #endif /* CONFIG_CTRL_IFACE_DBUS */
  438. #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
  439. char *dbus_new_path;
  440. char *dbus_groupobj_path;
  441. #ifdef CONFIG_AP
  442. char *preq_notify_peer;
  443. #endif /* CONFIG_AP */
  444. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  445. #ifdef CONFIG_CTRL_IFACE_BINDER
  446. const void *binder_object_key;
  447. #endif /* CONFIG_CTRL_IFACE_BINDER */
  448. char bridge_ifname[16];
  449. char *confname;
  450. char *confanother;
  451. struct wpa_config *conf;
  452. int countermeasures;
  453. struct os_reltime last_michael_mic_error;
  454. u8 bssid[ETH_ALEN];
  455. u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
  456. * field contains the target BSSID. */
  457. int reassociate; /* reassociation requested */
  458. unsigned int reassoc_same_bss:1; /* reassociating to the same BSS */
  459. unsigned int reassoc_same_ess:1; /* reassociating to the same ESS */
  460. int disconnected; /* all connections disabled; i.e., do no reassociate
  461. * before this has been cleared */
  462. struct wpa_ssid *current_ssid;
  463. struct wpa_ssid *last_ssid;
  464. struct wpa_bss *current_bss;
  465. int ap_ies_from_associnfo;
  466. unsigned int assoc_freq;
  467. /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
  468. int pairwise_cipher;
  469. int group_cipher;
  470. int key_mgmt;
  471. int wpa_proto;
  472. int mgmt_group_cipher;
  473. void *drv_priv; /* private data used by driver_ops */
  474. void *global_drv_priv;
  475. u8 *bssid_filter;
  476. size_t bssid_filter_count;
  477. u8 *disallow_aps_bssid;
  478. size_t disallow_aps_bssid_count;
  479. struct wpa_ssid_value *disallow_aps_ssid;
  480. size_t disallow_aps_ssid_count;
  481. enum set_band setband;
  482. /* Preferred network for the next connection attempt */
  483. struct wpa_ssid *next_ssid;
  484. /* previous scan was wildcard when interleaving between
  485. * wildcard scans and specific SSID scan when max_ssids=1 */
  486. int prev_scan_wildcard;
  487. struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
  488. * NULL = not yet initialized (start
  489. * with wildcard SSID)
  490. * WILDCARD_SSID_SCAN = wildcard
  491. * SSID was used in the previous scan
  492. */
  493. #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
  494. struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
  495. int sched_scan_timeout;
  496. int first_sched_scan;
  497. int sched_scan_timed_out;
  498. struct sched_scan_plan *sched_scan_plans;
  499. size_t sched_scan_plans_num;
  500. void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
  501. struct wpa_scan_results *scan_res);
  502. struct dl_list bss; /* struct wpa_bss::list */
  503. struct dl_list bss_id; /* struct wpa_bss::list_id */
  504. size_t num_bss;
  505. unsigned int bss_update_idx;
  506. unsigned int bss_next_id;
  507. /*
  508. * Pointers to BSS entries in the order they were in the last scan
  509. * results.
  510. */
  511. struct wpa_bss **last_scan_res;
  512. unsigned int last_scan_res_used;
  513. unsigned int last_scan_res_size;
  514. struct os_reltime last_scan;
  515. const struct wpa_driver_ops *driver;
  516. int interface_removed; /* whether the network interface has been
  517. * removed */
  518. struct wpa_sm *wpa;
  519. struct eapol_sm *eapol;
  520. struct ctrl_iface_priv *ctrl_iface;
  521. enum wpa_states wpa_state;
  522. struct wpa_radio_work *scan_work;
  523. int scanning;
  524. int sched_scanning;
  525. unsigned int sched_scan_stop_req:1;
  526. int new_connection;
  527. int eapol_received; /* number of EAPOL packets received after the
  528. * previous association event */
  529. struct scard_data *scard;
  530. char imsi[20];
  531. int mnc_len;
  532. unsigned char last_eapol_src[ETH_ALEN];
  533. unsigned int keys_cleared; /* bitfield of key indexes that the driver is
  534. * known not to be configured with a key */
  535. struct wpa_blacklist *blacklist;
  536. /**
  537. * extra_blacklist_count - Sum of blacklist counts after last connection
  538. *
  539. * This variable is used to maintain a count of temporary blacklisting
  540. * failures (maximum number for any BSS) over blacklist clear
  541. * operations. This is needed for figuring out whether there has been
  542. * failures prior to the last blacklist clear operation which happens
  543. * whenever no other not-blacklisted BSS candidates are available. This
  544. * gets cleared whenever a connection has been established successfully.
  545. */
  546. int extra_blacklist_count;
  547. /**
  548. * scan_req - Type of the scan request
  549. */
  550. enum scan_req_type {
  551. /**
  552. * NORMAL_SCAN_REQ - Normal scan request
  553. *
  554. * This is used for scans initiated by wpa_supplicant to find an
  555. * AP for a connection.
  556. */
  557. NORMAL_SCAN_REQ,
  558. /**
  559. * INITIAL_SCAN_REQ - Initial scan request
  560. *
  561. * This is used for the first scan on an interface to force at
  562. * least one scan to be run even if the configuration does not
  563. * include any enabled networks.
  564. */
  565. INITIAL_SCAN_REQ,
  566. /**
  567. * MANUAL_SCAN_REQ - Manual scan request
  568. *
  569. * This is used for scans where the user request a scan or
  570. * a specific wpa_supplicant operation (e.g., WPS) requires scan
  571. * to be run.
  572. */
  573. MANUAL_SCAN_REQ
  574. } scan_req, last_scan_req;
  575. enum wpa_states scan_prev_wpa_state;
  576. struct os_reltime scan_trigger_time, scan_start_time;
  577. /* Minimum freshness requirement for connection purposes */
  578. struct os_reltime scan_min_time;
  579. int scan_runs; /* number of scan runs since WPS was started */
  580. int *next_scan_freqs;
  581. int *select_network_scan_freqs;
  582. int *manual_scan_freqs;
  583. int *manual_sched_scan_freqs;
  584. unsigned int manual_scan_passive:1;
  585. unsigned int manual_scan_use_id:1;
  586. unsigned int manual_scan_only_new:1;
  587. unsigned int own_scan_requested:1;
  588. unsigned int own_scan_running:1;
  589. unsigned int clear_driver_scan_cache:1;
  590. unsigned int manual_scan_id;
  591. int scan_interval; /* time in sec between scans to find suitable AP */
  592. int normal_scans; /* normal scans run before sched_scan */
  593. int scan_for_connection; /* whether the scan request was triggered for
  594. * finding a connection */
  595. /*
  596. * A unique cookie representing the vendor scan request. This cookie is
  597. * returned from the driver interface. 0 indicates that there is no
  598. * pending vendor scan request.
  599. */
  600. u64 curr_scan_cookie;
  601. #define MAX_SCAN_ID 16
  602. int scan_id[MAX_SCAN_ID];
  603. unsigned int scan_id_count;
  604. u8 next_scan_bssid[ETH_ALEN];
  605. struct wpa_ssid_value *ssids_from_scan_req;
  606. unsigned int num_ssids_from_scan_req;
  607. u64 drv_flags;
  608. unsigned int drv_enc;
  609. unsigned int drv_smps_modes;
  610. unsigned int drv_rrm_flags;
  611. /*
  612. * A bitmap of supported protocols for probe response offload. See
  613. * struct wpa_driver_capa in driver.h
  614. */
  615. unsigned int probe_resp_offloads;
  616. /* extended capabilities supported by the driver */
  617. const u8 *extended_capa, *extended_capa_mask;
  618. unsigned int extended_capa_len;
  619. int max_scan_ssids;
  620. int max_sched_scan_ssids;
  621. unsigned int max_sched_scan_plans;
  622. unsigned int max_sched_scan_plan_interval;
  623. unsigned int max_sched_scan_plan_iterations;
  624. int sched_scan_supported;
  625. unsigned int max_match_sets;
  626. unsigned int max_remain_on_chan;
  627. unsigned int max_stations;
  628. int pending_mic_error_report;
  629. int pending_mic_error_pairwise;
  630. int mic_errors_seen; /* Michael MIC errors with the current PTK */
  631. struct wps_context *wps;
  632. int wps_success; /* WPS success event received */
  633. struct wps_er *wps_er;
  634. unsigned int wps_run;
  635. struct os_reltime wps_pin_start_time;
  636. int blacklist_cleared;
  637. struct wpabuf *pending_eapol_rx;
  638. struct os_reltime pending_eapol_rx_time;
  639. u8 pending_eapol_rx_src[ETH_ALEN];
  640. unsigned int last_eapol_matches_bssid:1;
  641. unsigned int eap_expected_failure:1;
  642. unsigned int reattach:1; /* reassociation to the same BSS requested */
  643. unsigned int mac_addr_changed:1;
  644. unsigned int added_vif:1;
  645. unsigned int wnmsleep_used:1;
  646. struct os_reltime last_mac_addr_change;
  647. int last_mac_addr_style;
  648. struct ibss_rsn *ibss_rsn;
  649. int set_sta_uapsd;
  650. int sta_uapsd;
  651. int set_ap_uapsd;
  652. int ap_uapsd;
  653. int auth_alg;
  654. u16 last_owe_group;
  655. #ifdef CONFIG_SME
  656. struct {
  657. u8 ssid[SSID_MAX_LEN];
  658. size_t ssid_len;
  659. int freq;
  660. u8 assoc_req_ie[1500];
  661. size_t assoc_req_ie_len;
  662. int mfp;
  663. int ft_used;
  664. u8 mobility_domain[2];
  665. u8 *ft_ies;
  666. size_t ft_ies_len;
  667. u8 prev_bssid[ETH_ALEN];
  668. int prev_bssid_set;
  669. int auth_alg;
  670. int proto;
  671. int sa_query_count; /* number of pending SA Query requests;
  672. * 0 = no SA Query in progress */
  673. int sa_query_timed_out;
  674. u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
  675. * sa_query_count octets of pending
  676. * SA Query transaction identifiers */
  677. struct os_reltime sa_query_start;
  678. struct os_reltime last_unprot_disconnect;
  679. enum { HT_SEC_CHAN_UNKNOWN,
  680. HT_SEC_CHAN_ABOVE,
  681. HT_SEC_CHAN_BELOW } ht_sec_chan;
  682. u8 sched_obss_scan;
  683. u16 obss_scan_int;
  684. u16 bss_max_idle_period;
  685. #ifdef CONFIG_SAE
  686. struct sae_data sae;
  687. struct wpabuf *sae_token;
  688. int sae_group_index;
  689. unsigned int sae_pmksa_caching:1;
  690. #endif /* CONFIG_SAE */
  691. } sme;
  692. #endif /* CONFIG_SME */
  693. #ifdef CONFIG_AP
  694. struct hostapd_iface *ap_iface;
  695. void (*ap_configured_cb)(void *ctx, void *data);
  696. void *ap_configured_cb_ctx;
  697. void *ap_configured_cb_data;
  698. #endif /* CONFIG_AP */
  699. struct hostapd_iface *ifmsh;
  700. #ifdef CONFIG_MESH
  701. struct mesh_rsn *mesh_rsn;
  702. int mesh_if_idx;
  703. unsigned int mesh_if_created:1;
  704. unsigned int mesh_ht_enabled:1;
  705. unsigned int mesh_vht_enabled:1;
  706. #ifdef CONFIG_PMKSA_CACHE_EXTERNAL
  707. /* struct external_pmksa_cache::list */
  708. struct dl_list mesh_external_pmksa_cache;
  709. #endif /* CONFIG_PMKSA_CACHE_EXTERNAL */
  710. #endif /* CONFIG_MESH */
  711. unsigned int off_channel_freq;
  712. struct wpabuf *pending_action_tx;
  713. u8 pending_action_src[ETH_ALEN];
  714. u8 pending_action_dst[ETH_ALEN];
  715. u8 pending_action_bssid[ETH_ALEN];
  716. unsigned int pending_action_freq;
  717. int pending_action_no_cck;
  718. int pending_action_without_roc;
  719. unsigned int pending_action_tx_done:1;
  720. void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
  721. unsigned int freq, const u8 *dst,
  722. const u8 *src, const u8 *bssid,
  723. const u8 *data, size_t data_len,
  724. enum offchannel_send_action_result
  725. result);
  726. unsigned int roc_waiting_drv_freq;
  727. int action_tx_wait_time;
  728. int action_tx_wait_time_used;
  729. int p2p_mgmt;
  730. #ifdef CONFIG_P2P
  731. struct p2p_go_neg_results *go_params;
  732. int create_p2p_iface;
  733. u8 pending_interface_addr[ETH_ALEN];
  734. char pending_interface_name[100];
  735. int pending_interface_type;
  736. int p2p_group_idx;
  737. unsigned int pending_listen_freq;
  738. unsigned int pending_listen_duration;
  739. enum {
  740. NOT_P2P_GROUP_INTERFACE,
  741. P2P_GROUP_INTERFACE_PENDING,
  742. P2P_GROUP_INTERFACE_GO,
  743. P2P_GROUP_INTERFACE_CLIENT
  744. } p2p_group_interface;
  745. struct p2p_group *p2p_group;
  746. int p2p_long_listen; /* remaining time in long Listen state in ms */
  747. char p2p_pin[10];
  748. int p2p_wps_method;
  749. u8 p2p_auth_invite[ETH_ALEN];
  750. int p2p_sd_over_ctrl_iface;
  751. int p2p_in_provisioning;
  752. int p2p_in_invitation;
  753. int p2p_invite_go_freq;
  754. int pending_invite_ssid_id;
  755. int show_group_started;
  756. u8 go_dev_addr[ETH_ALEN];
  757. int pending_pd_before_join;
  758. u8 pending_join_iface_addr[ETH_ALEN];
  759. u8 pending_join_dev_addr[ETH_ALEN];
  760. int pending_join_wps_method;
  761. u8 p2p_join_ssid[SSID_MAX_LEN];
  762. size_t p2p_join_ssid_len;
  763. int p2p_join_scan_count;
  764. int auto_pd_scan_retry;
  765. int force_long_sd;
  766. u16 pending_pd_config_methods;
  767. enum {
  768. NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN, AUTO_PD_ASP
  769. } pending_pd_use;
  770. /*
  771. * Whether cross connection is disallowed by the AP to which this
  772. * interface is associated (only valid if there is an association).
  773. */
  774. int cross_connect_disallowed;
  775. /*
  776. * Whether this P2P group is configured to use cross connection (only
  777. * valid if this is P2P GO interface). The actual cross connect packet
  778. * forwarding may not be configured depending on the uplink status.
  779. */
  780. int cross_connect_enabled;
  781. /* Whether cross connection forwarding is in use at the moment. */
  782. int cross_connect_in_use;
  783. /*
  784. * Uplink interface name for cross connection
  785. */
  786. char cross_connect_uplink[100];
  787. unsigned int p2p_auto_join:1;
  788. unsigned int p2p_auto_pd:1;
  789. unsigned int p2p_go_do_acs:1;
  790. unsigned int p2p_persistent_group:1;
  791. unsigned int p2p_fallback_to_go_neg:1;
  792. unsigned int p2p_pd_before_go_neg:1;
  793. unsigned int p2p_go_ht40:1;
  794. unsigned int p2p_go_vht:1;
  795. unsigned int user_initiated_pd:1;
  796. unsigned int p2p_go_group_formation_completed:1;
  797. unsigned int group_formation_reported:1;
  798. unsigned int waiting_presence_resp;
  799. int p2p_first_connection_timeout;
  800. unsigned int p2p_nfc_tag_enabled:1;
  801. unsigned int p2p_peer_oob_pk_hash_known:1;
  802. unsigned int p2p_disable_ip_addr_req:1;
  803. unsigned int p2ps_method_config_any:1;
  804. unsigned int p2p_cli_probe:1;
  805. enum hostapd_hw_mode p2p_go_acs_band;
  806. int p2p_persistent_go_freq;
  807. int p2p_persistent_id;
  808. int p2p_go_intent;
  809. int p2p_connect_freq;
  810. struct os_reltime p2p_auto_started;
  811. struct wpa_ssid *p2p_last_4way_hs_fail;
  812. struct wpa_radio_work *p2p_scan_work;
  813. struct wpa_radio_work *p2p_listen_work;
  814. struct wpa_radio_work *p2p_send_action_work;
  815. u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
  816. struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
  817. * formation */
  818. u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
  819. u8 p2p_ip_addr_info[3 * 4];
  820. /* group common frequencies */
  821. int *p2p_group_common_freqs;
  822. unsigned int p2p_group_common_freqs_num;
  823. u8 p2ps_join_addr[ETH_ALEN];
  824. unsigned int p2p_go_max_oper_chwidth;
  825. unsigned int p2p_go_vht_center_freq2;
  826. int p2p_lo_started;
  827. #endif /* CONFIG_P2P */
  828. struct wpa_ssid *bgscan_ssid;
  829. const struct bgscan_ops *bgscan;
  830. void *bgscan_priv;
  831. const struct autoscan_ops *autoscan;
  832. struct wpa_driver_scan_params *autoscan_params;
  833. void *autoscan_priv;
  834. struct wpa_ssid *connect_without_scan;
  835. struct wps_ap_info *wps_ap;
  836. size_t num_wps_ap;
  837. int wps_ap_iter;
  838. int after_wps;
  839. int known_wps_freq;
  840. unsigned int wps_freq;
  841. int wps_fragment_size;
  842. int auto_reconnect_disabled;
  843. /* Channel preferences for AP/P2P GO use */
  844. int best_24_freq;
  845. int best_5_freq;
  846. int best_overall_freq;
  847. struct gas_query *gas;
  848. struct gas_server *gas_server;
  849. #ifdef CONFIG_INTERWORKING
  850. unsigned int fetch_anqp_in_progress:1;
  851. unsigned int network_select:1;
  852. unsigned int auto_select:1;
  853. unsigned int auto_network_select:1;
  854. unsigned int interworking_fast_assoc_tried:1;
  855. unsigned int fetch_all_anqp:1;
  856. unsigned int fetch_osu_info:1;
  857. unsigned int fetch_osu_waiting_scan:1;
  858. unsigned int fetch_osu_icon_in_progress:1;
  859. struct wpa_bss *interworking_gas_bss;
  860. unsigned int osu_icon_id;
  861. struct dl_list icon_head; /* struct icon_entry */
  862. struct osu_provider *osu_prov;
  863. size_t osu_prov_count;
  864. struct os_reltime osu_icon_fetch_start;
  865. unsigned int num_osu_scans;
  866. unsigned int num_prov_found;
  867. #endif /* CONFIG_INTERWORKING */
  868. unsigned int drv_capa_known;
  869. struct {
  870. struct hostapd_hw_modes *modes;
  871. u16 num_modes;
  872. u16 flags;
  873. } hw;
  874. enum local_hw_capab {
  875. CAPAB_NO_HT_VHT,
  876. CAPAB_HT,
  877. CAPAB_HT40,
  878. CAPAB_VHT,
  879. } hw_capab;
  880. #ifdef CONFIG_MACSEC
  881. struct ieee802_1x_kay *kay;
  882. #endif /* CONFIG_MACSEC */
  883. int pno;
  884. int pno_sched_pending;
  885. /* WLAN_REASON_* reason codes. Negative if locally generated. */
  886. int disconnect_reason;
  887. /* WLAN_STATUS_* status codes from (Re)Association Response frame. */
  888. u16 assoc_status_code;
  889. struct ext_password_data *ext_pw;
  890. struct wpabuf *last_gas_resp, *prev_gas_resp;
  891. u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
  892. u8 last_gas_dialog_token, prev_gas_dialog_token;
  893. unsigned int no_keep_alive:1;
  894. unsigned int ext_mgmt_frame_handling:1;
  895. unsigned int ext_eapol_frame_io:1;
  896. unsigned int wmm_ac_supported:1;
  897. unsigned int ext_work_in_progress:1;
  898. unsigned int own_disconnect_req:1;
  899. unsigned int ignore_post_flush_scan_res:1;
  900. #define MAC_ADDR_RAND_SCAN BIT(0)
  901. #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)
  902. #define MAC_ADDR_RAND_PNO BIT(2)
  903. #define MAC_ADDR_RAND_ALL (MAC_ADDR_RAND_SCAN | \
  904. MAC_ADDR_RAND_SCHED_SCAN | \
  905. MAC_ADDR_RAND_PNO)
  906. unsigned int mac_addr_rand_supported;
  907. unsigned int mac_addr_rand_enable;
  908. /* MAC Address followed by mask (2 * ETH_ALEN) */
  909. u8 *mac_addr_scan;
  910. u8 *mac_addr_sched_scan;
  911. u8 *mac_addr_pno;
  912. #ifdef CONFIG_WNM
  913. u8 wnm_dialog_token;
  914. u8 wnm_reply;
  915. u8 wnm_num_neighbor_report;
  916. u8 wnm_mode;
  917. u16 wnm_dissoc_timer;
  918. u8 wnm_bss_termination_duration[12];
  919. struct neighbor_report *wnm_neighbor_report_elements;
  920. struct os_reltime wnm_cand_valid_until;
  921. u8 wnm_cand_from_bss[ETH_ALEN];
  922. #ifdef CONFIG_MBO
  923. unsigned int wnm_mbo_trans_reason_present:1;
  924. u8 wnm_mbo_transition_reason;
  925. #endif /* CONFIG_MBO */
  926. #endif /* CONFIG_WNM */
  927. #ifdef CONFIG_TESTING_GET_GTK
  928. u8 last_gtk[32];
  929. size_t last_gtk_len;
  930. #endif /* CONFIG_TESTING_GET_GTK */
  931. unsigned int num_multichan_concurrent;
  932. struct wpa_radio_work *connect_work;
  933. unsigned int ext_work_id;
  934. struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
  935. #ifdef CONFIG_TESTING_OPTIONS
  936. struct l2_packet_data *l2_test;
  937. unsigned int extra_roc_dur;
  938. enum wpa_supplicant_test_failure test_failure;
  939. char *get_pref_freq_list_override;
  940. unsigned int reject_btm_req_reason;
  941. unsigned int p2p_go_csa_on_inv:1;
  942. unsigned int ignore_auth_resp:1;
  943. unsigned int ignore_assoc_disallow:1;
  944. unsigned int testing_resend_assoc:1;
  945. struct wpabuf *sae_commit_override;
  946. enum wpa_alg last_tk_alg;
  947. u8 last_tk_addr[ETH_ALEN];
  948. int last_tk_key_idx;
  949. u8 last_tk[WPA_TK_MAX_LEN];
  950. size_t last_tk_len;
  951. struct wpabuf *last_assoc_req_wpa_ie;
  952. #endif /* CONFIG_TESTING_OPTIONS */
  953. struct wmm_ac_assoc_data *wmm_ac_assoc_info;
  954. struct wmm_tspec_element *tspecs[WMM_AC_NUM][TS_DIR_IDX_COUNT];
  955. struct wmm_ac_addts_request *addts_request;
  956. u8 wmm_ac_last_dialog_token;
  957. struct wmm_tspec_element *last_tspecs;
  958. u8 last_tspecs_count;
  959. struct rrm_data rrm;
  960. struct beacon_rep_data beacon_rep_data;
  961. #ifdef CONFIG_FST
  962. struct fst_iface *fst;
  963. const struct wpabuf *fst_ies;
  964. struct wpabuf *received_mb_ies;
  965. #endif /* CONFIG_FST */
  966. #ifdef CONFIG_MBO
  967. /* Multiband operation non-preferred channel */
  968. struct wpa_mbo_non_pref_channel {
  969. enum mbo_non_pref_chan_reason reason;
  970. u8 oper_class;
  971. u8 chan;
  972. u8 preference;
  973. } *non_pref_chan;
  974. size_t non_pref_chan_num;
  975. u8 mbo_wnm_token;
  976. /**
  977. * enable_oce - Enable OCE if it is enabled by user and device also
  978. * supports OCE.
  979. * User can enable OCE with wpa_config's 'oce' parameter as follows -
  980. * - Set BIT(0) to enable OCE in non-AP STA mode.
  981. * - Set BIT(1) to enable OCE in STA-CFON mode.
  982. */
  983. u8 enable_oce;
  984. #endif /* CONFIG_MBO */
  985. /*
  986. * This should be under CONFIG_MBO, but it is left out to allow using
  987. * the bss_temp_disallowed list for other purposes as well.
  988. */
  989. struct dl_list bss_tmp_disallowed;
  990. /*
  991. * Content of a measurement report element with type 8 (LCI),
  992. * own location.
  993. */
  994. struct wpabuf *lci;
  995. struct os_reltime lci_time;
  996. struct os_reltime beacon_rep_scan;
  997. /* FILS HLP requests (struct fils_hlp_req) */
  998. struct dl_list fils_hlp_req;
  999. struct sched_scan_relative_params {
  1000. /**
  1001. * relative_rssi_set - Enable relatively preferred BSS reporting
  1002. *
  1003. * 0 = Disable reporting relatively preferred BSSs
  1004. * 1 = Enable reporting relatively preferred BSSs
  1005. */
  1006. int relative_rssi_set;
  1007. /**
  1008. * relative_rssi - Relative RSSI for reporting better BSSs
  1009. *
  1010. * Amount of RSSI by which a BSS should be better than the
  1011. * current connected BSS so that the new BSS can be reported
  1012. * to user space. This applies to sched_scan operations.
  1013. */
  1014. int relative_rssi;
  1015. /**
  1016. * relative_adjust_band - Band in which RSSI is to be adjusted
  1017. */
  1018. enum set_band relative_adjust_band;
  1019. /**
  1020. * relative_adjust_rssi - RSSI adjustment
  1021. *
  1022. * An amount of relative_adjust_rssi should be added to the
  1023. * BSSs that belong to the relative_adjust_band while comparing
  1024. * with other bands for BSS reporting.
  1025. */
  1026. int relative_adjust_rssi;
  1027. } srp;
  1028. /* RIC elements for FT protocol */
  1029. struct wpabuf *ric_ies;
  1030. #ifdef CONFIG_DPP
  1031. struct dl_list dpp_bootstrap; /* struct dpp_bootstrap_info */
  1032. struct dl_list dpp_configurator; /* struct dpp_configurator */
  1033. int dpp_init_done;
  1034. struct dpp_authentication *dpp_auth;
  1035. struct wpa_radio_work *dpp_listen_work;
  1036. unsigned int dpp_pending_listen_freq;
  1037. unsigned int dpp_listen_freq;
  1038. u8 dpp_allowed_roles;
  1039. int dpp_qr_mutual;
  1040. int dpp_netrole_ap;
  1041. int dpp_auth_ok_on_ack;
  1042. int dpp_in_response_listen;
  1043. int dpp_gas_client;
  1044. int dpp_gas_dialog_token;
  1045. u8 dpp_intro_bssid[ETH_ALEN];
  1046. void *dpp_intro_network;
  1047. struct dpp_pkex *dpp_pkex;
  1048. struct dpp_bootstrap_info *dpp_pkex_bi;
  1049. char *dpp_pkex_code;
  1050. char *dpp_pkex_identifier;
  1051. char *dpp_pkex_auth_cmd;
  1052. char *dpp_configurator_params;
  1053. struct os_reltime dpp_last_init;
  1054. struct os_reltime dpp_init_iter_start;
  1055. unsigned int dpp_init_max_tries;
  1056. unsigned int dpp_init_retry_time;
  1057. unsigned int dpp_resp_wait_time;
  1058. unsigned int dpp_resp_max_tries;
  1059. unsigned int dpp_resp_retry_time;
  1060. #ifdef CONFIG_TESTING_OPTIONS
  1061. char *dpp_config_obj_override;
  1062. char *dpp_discovery_override;
  1063. char *dpp_groups_override;
  1064. unsigned int dpp_ignore_netaccesskey_mismatch:1;
  1065. #endif /* CONFIG_TESTING_OPTIONS */
  1066. #endif /* CONFIG_DPP */
  1067. #ifdef CONFIG_FILS
  1068. unsigned int disable_fils:1;
  1069. #endif /* CONFIG_FILS */
  1070. };
  1071. /* wpa_supplicant.c */
  1072. void wpa_supplicant_apply_ht_overrides(
  1073. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1074. struct wpa_driver_associate_params *params);
  1075. void wpa_supplicant_apply_vht_overrides(
  1076. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1077. struct wpa_driver_associate_params *params);
  1078. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1079. int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
  1080. struct wpa_ssid *ssid);
  1081. int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
  1082. const char * wpa_supplicant_state_txt(enum wpa_states state);
  1083. int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
  1084. int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
  1085. int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
  1086. struct wpa_bss *bss, struct wpa_ssid *ssid,
  1087. u8 *wpa_ie, size_t *wpa_ie_len);
  1088. void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
  1089. struct wpa_bss *bss,
  1090. struct wpa_ssid *ssid);
  1091. void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
  1092. struct wpa_ssid *ssid);
  1093. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
  1094. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  1095. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  1096. int sec, int usec);
  1097. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  1098. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  1099. enum wpa_states state);
  1100. struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
  1101. const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
  1102. void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
  1103. void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
  1104. int reason_code);
  1105. struct wpa_ssid * wpa_supplicant_add_network(struct wpa_supplicant *wpa_s);
  1106. int wpa_supplicant_remove_network(struct wpa_supplicant *wpa_s, int id);
  1107. void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
  1108. struct wpa_ssid *ssid);
  1109. void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
  1110. struct wpa_ssid *ssid);
  1111. void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
  1112. struct wpa_ssid *ssid);
  1113. int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
  1114. const char *pkcs11_engine_path,
  1115. const char *pkcs11_module_path);
  1116. int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
  1117. int ap_scan);
  1118. int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
  1119. unsigned int expire_age);
  1120. int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
  1121. unsigned int expire_count);
  1122. int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
  1123. int scan_interval);
  1124. int wpa_supplicant_set_debug_params(struct wpa_global *global,
  1125. int debug_level, int debug_timestamp,
  1126. int debug_show_keys);
  1127. void free_hw_features(struct wpa_supplicant *wpa_s);
  1128. void wpa_show_license(void);
  1129. struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global,
  1130. const char *ifname);
  1131. struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
  1132. struct wpa_interface *iface,
  1133. struct wpa_supplicant *parent);
  1134. int wpa_supplicant_remove_iface(struct wpa_global *global,
  1135. struct wpa_supplicant *wpa_s,
  1136. int terminate);
  1137. struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
  1138. const char *ifname);
  1139. struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
  1140. int wpa_supplicant_run(struct wpa_global *global);
  1141. void wpa_supplicant_deinit(struct wpa_global *global);
  1142. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  1143. struct wpa_ssid *ssid);
  1144. void wpa_supplicant_terminate_proc(struct wpa_global *global);
  1145. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  1146. const u8 *buf, size_t len);
  1147. void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
  1148. void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
  1149. void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1150. int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
  1151. int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
  1152. void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
  1153. void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
  1154. struct wpa_ssid *ssid, int clear_failures);
  1155. int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1156. int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
  1157. size_t ssid_len);
  1158. void wpas_request_connection(struct wpa_supplicant *wpa_s);
  1159. void wpas_request_disconnection(struct wpa_supplicant *wpa_s);
  1160. int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
  1161. int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
  1162. int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
  1163. void add_freq(int *freqs, int *num_freqs, int freq);
  1164. void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
  1165. void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
  1166. const u8 *report, size_t report_len);
  1167. int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
  1168. const struct wpa_ssid_value *ssid,
  1169. int lci, int civic,
  1170. void (*cb)(void *ctx,
  1171. struct wpabuf *neighbor_rep),
  1172. void *cb_ctx);
  1173. void wpas_rrm_handle_radio_measurement_request(struct wpa_supplicant *wpa_s,
  1174. const u8 *src, const u8 *dst,
  1175. const u8 *frame, size_t len);
  1176. void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
  1177. const u8 *src,
  1178. const u8 *frame, size_t len,
  1179. int rssi);
  1180. void wpas_rrm_refuse_request(struct wpa_supplicant *wpa_s);
  1181. int wpas_beacon_rep_scan_process(struct wpa_supplicant *wpa_s,
  1182. struct wpa_scan_results *scan_res,
  1183. struct scan_info *info);
  1184. void wpas_clear_beacon_rep_data(struct wpa_supplicant *wpa_s);
  1185. void wpas_flush_fils_hlp_req(struct wpa_supplicant *wpa_s);
  1186. /* MBO functions */
  1187. int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len);
  1188. const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr);
  1189. int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
  1190. const char *non_pref_chan);
  1191. void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);
  1192. void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie,
  1193. size_t len);
  1194. size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos,
  1195. size_t len,
  1196. enum mbo_transition_reject_reason reason);
  1197. void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa);
  1198. struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s,
  1199. struct wpa_bss *bss, u32 mbo_subtypes);
  1200. void mbo_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
  1201. struct wpa_bss *bss, const u8 *sa,
  1202. const u8 *data, size_t slen);
  1203. /* op_classes.c */
  1204. enum chan_allowed {
  1205. NOT_ALLOWED, NO_IR, ALLOWED
  1206. };
  1207. enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 channel,
  1208. u8 bw);
  1209. size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos,
  1210. size_t len);
  1211. /**
  1212. * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
  1213. * @wpa_s: Pointer to wpa_supplicant data
  1214. * @ssid: Pointer to the network block the reply is for
  1215. * @field: field the response is a reply for
  1216. * @value: value (ie, password, etc) for @field
  1217. * Returns: 0 on success, non-zero on error
  1218. *
  1219. * Helper function to handle replies to control interface requests.
  1220. */
  1221. int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
  1222. struct wpa_ssid *ssid,
  1223. const char *field,
  1224. const char *value);
  1225. void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
  1226. const struct wpa_ssid *ssid,
  1227. struct hostapd_freq_params *freq);
  1228. /* events.c */
  1229. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
  1230. int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
  1231. struct wpa_bss *selected,
  1232. struct wpa_ssid *ssid);
  1233. void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
  1234. void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
  1235. void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
  1236. int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
  1237. struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
  1238. struct wpa_ssid **selected_ssid);
  1239. int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1240. /* eap_register.c */
  1241. int eap_register_methods(void);
  1242. /**
  1243. * Utility method to tell if a given network is for persistent group storage
  1244. * @ssid: Network object
  1245. * Returns: 1 if network is a persistent group, 0 otherwise
  1246. */
  1247. static inline int network_is_persistent_group(struct wpa_ssid *ssid)
  1248. {
  1249. return ssid->disabled == 2 && ssid->p2p_persistent_group;
  1250. }
  1251. int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1252. int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1253. int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
  1254. void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
  1255. struct wpa_used_freq_data *freqs_data,
  1256. unsigned int len);
  1257. int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
  1258. struct wpa_used_freq_data *freqs_data,
  1259. unsigned int len);
  1260. int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
  1261. int *freq_array, unsigned int len);
  1262. void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx);
  1263. void wpas_vendor_elem_update(struct wpa_supplicant *wpa_s);
  1264. struct wpa_supplicant * wpas_vendor_elem(struct wpa_supplicant *wpa_s,
  1265. enum wpa_vendor_elem_frame frame);
  1266. int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame,
  1267. const u8 *elem, size_t len);
  1268. #ifdef CONFIG_FST
  1269. struct fst_wpa_obj;
  1270. void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s,
  1271. struct fst_wpa_obj *iface_obj);
  1272. #endif /* CONFIG_FST */
  1273. int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd);
  1274. struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
  1275. u16 num_modes, enum hostapd_hw_mode mode);
  1276. void wpa_bss_tmp_disallow(struct wpa_supplicant *wpa_s, const u8 *bssid,
  1277. unsigned int sec);
  1278. int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1279. struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
  1280. int i, struct wpa_bss *bss,
  1281. struct wpa_ssid *group,
  1282. int only_first_ssid, int debug_print);
  1283. int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s,
  1284. enum wpa_driver_if_type if_type,
  1285. unsigned int *num,
  1286. unsigned int *freq_list);
  1287. #endif /* WPA_SUPPLICANT_I_H */