wpa_supplicant_i.h 39 KB

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