wpa_supplicant_i.h 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  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. extern const char *wpa_supplicant_version;
  17. extern const char *wpa_supplicant_license;
  18. #ifndef CONFIG_NO_STDOUT_DEBUG
  19. extern const char *wpa_supplicant_full_license1;
  20. extern const char *wpa_supplicant_full_license2;
  21. extern const char *wpa_supplicant_full_license3;
  22. extern const char *wpa_supplicant_full_license4;
  23. extern const char *wpa_supplicant_full_license5;
  24. #endif /* CONFIG_NO_STDOUT_DEBUG */
  25. struct wpa_sm;
  26. struct wpa_supplicant;
  27. struct ibss_rsn;
  28. struct scan_info;
  29. struct wpa_bss;
  30. struct wpa_scan_results;
  31. struct hostapd_hw_modes;
  32. struct wpa_driver_associate_params;
  33. /*
  34. * Forward declarations of private structures used within the ctrl_iface
  35. * backends. Other parts of wpa_supplicant do not have access to data stored in
  36. * these structures.
  37. */
  38. struct ctrl_iface_priv;
  39. struct ctrl_iface_global_priv;
  40. struct wpas_dbus_priv;
  41. /**
  42. * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
  43. */
  44. struct wpa_interface {
  45. /**
  46. * confname - Configuration name (file or profile) name
  47. *
  48. * This can also be %NULL when a configuration file is not used. In
  49. * that case, ctrl_interface must be set to allow the interface to be
  50. * configured.
  51. */
  52. const char *confname;
  53. /**
  54. * confanother - Additional configuration name (file or profile) name
  55. *
  56. * This can also be %NULL when the additional configuration file is not
  57. * used.
  58. */
  59. const char *confanother;
  60. #ifdef CONFIG_P2P
  61. /**
  62. * conf_p2p_dev - Configuration file used to hold the
  63. * P2P Device configuration parameters.
  64. *
  65. * This can also be %NULL. In such a case, if a P2P Device dedicated
  66. * interfaces is created, the main configuration file will be used.
  67. */
  68. const char *conf_p2p_dev;
  69. #endif /* CONFIG_P2P */
  70. /**
  71. * ctrl_interface - Control interface parameter
  72. *
  73. * If a configuration file is not used, this variable can be used to
  74. * set the ctrl_interface parameter that would have otherwise been read
  75. * from the configuration file. If both confname and ctrl_interface are
  76. * set, ctrl_interface is used to override the value from configuration
  77. * file.
  78. */
  79. const char *ctrl_interface;
  80. /**
  81. * driver - Driver interface name, or %NULL to use the default driver
  82. */
  83. const char *driver;
  84. /**
  85. * driver_param - Driver interface parameters
  86. *
  87. * If a configuration file is not used, this variable can be used to
  88. * set the driver_param parameters that would have otherwise been read
  89. * from the configuration file. If both confname and driver_param are
  90. * set, driver_param is used to override the value from configuration
  91. * file.
  92. */
  93. const char *driver_param;
  94. /**
  95. * ifname - Interface name
  96. */
  97. const char *ifname;
  98. /**
  99. * bridge_ifname - Optional bridge interface name
  100. *
  101. * If the driver interface (ifname) is included in a Linux bridge
  102. * device, the bridge interface may need to be used for receiving EAPOL
  103. * frames. This can be enabled by setting this variable to enable
  104. * receiving of EAPOL frames from an additional interface.
  105. */
  106. const char *bridge_ifname;
  107. /**
  108. * p2p_mgmt - Interface used for P2P management (P2P Device operations)
  109. *
  110. * Indicates whether wpas_p2p_init() must be called for this interface.
  111. * This is used only when the driver supports a dedicated P2P Device
  112. * interface that is not a network interface.
  113. */
  114. int p2p_mgmt;
  115. };
  116. /**
  117. * struct wpa_params - Parameters for wpa_supplicant_init()
  118. */
  119. struct wpa_params {
  120. /**
  121. * daemonize - Run %wpa_supplicant in the background
  122. */
  123. int daemonize;
  124. /**
  125. * wait_for_monitor - Wait for a monitor program before starting
  126. */
  127. int wait_for_monitor;
  128. /**
  129. * pid_file - Path to a PID (process ID) file
  130. *
  131. * If this and daemonize are set, process ID of the background process
  132. * will be written to the specified file.
  133. */
  134. char *pid_file;
  135. /**
  136. * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
  137. */
  138. int wpa_debug_level;
  139. /**
  140. * wpa_debug_show_keys - Whether keying material is included in debug
  141. *
  142. * This parameter can be used to allow keying material to be included
  143. * in debug messages. This is a security risk and this option should
  144. * not be enabled in normal configuration. If needed during
  145. * development or while troubleshooting, this option can provide more
  146. * details for figuring out what is happening.
  147. */
  148. int wpa_debug_show_keys;
  149. /**
  150. * wpa_debug_timestamp - Whether to include timestamp in debug messages
  151. */
  152. int wpa_debug_timestamp;
  153. /**
  154. * ctrl_interface - Global ctrl_iface path/parameter
  155. */
  156. char *ctrl_interface;
  157. /**
  158. * ctrl_interface_group - Global ctrl_iface group
  159. */
  160. char *ctrl_interface_group;
  161. /**
  162. * dbus_ctrl_interface - Enable the DBus control interface
  163. */
  164. int dbus_ctrl_interface;
  165. /**
  166. * wpa_debug_file_path - Path of debug file or %NULL to use stdout
  167. */
  168. const char *wpa_debug_file_path;
  169. /**
  170. * wpa_debug_syslog - Enable log output through syslog
  171. */
  172. int wpa_debug_syslog;
  173. /**
  174. * wpa_debug_tracing - Enable log output through Linux tracing
  175. */
  176. int wpa_debug_tracing;
  177. /**
  178. * override_driver - Optional driver parameter override
  179. *
  180. * This parameter can be used to override the driver parameter in
  181. * dynamic interface addition to force a specific driver wrapper to be
  182. * used instead.
  183. */
  184. char *override_driver;
  185. /**
  186. * override_ctrl_interface - Optional ctrl_interface override
  187. *
  188. * This parameter can be used to override the ctrl_interface parameter
  189. * in dynamic interface addition to force a control interface to be
  190. * created.
  191. */
  192. char *override_ctrl_interface;
  193. /**
  194. * entropy_file - Optional entropy file
  195. *
  196. * This parameter can be used to configure wpa_supplicant to maintain
  197. * its internal entropy store over restarts.
  198. */
  199. char *entropy_file;
  200. };
  201. struct p2p_srv_bonjour {
  202. struct dl_list list;
  203. struct wpabuf *query;
  204. struct wpabuf *resp;
  205. };
  206. struct p2p_srv_upnp {
  207. struct dl_list list;
  208. u8 version;
  209. char *service;
  210. };
  211. /**
  212. * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
  213. *
  214. * This structure is initialized by calling wpa_supplicant_init() when starting
  215. * %wpa_supplicant.
  216. */
  217. struct wpa_global {
  218. struct wpa_supplicant *ifaces;
  219. struct wpa_params params;
  220. struct ctrl_iface_global_priv *ctrl_iface;
  221. struct wpas_dbus_priv *dbus;
  222. void **drv_priv;
  223. size_t drv_count;
  224. struct os_time suspend_time;
  225. struct p2p_data *p2p;
  226. struct wpa_supplicant *p2p_init_wpa_s;
  227. struct wpa_supplicant *p2p_group_formation;
  228. struct wpa_supplicant *p2p_invite_group;
  229. u8 p2p_dev_addr[ETH_ALEN];
  230. struct os_reltime p2p_go_wait_client;
  231. struct dl_list p2p_srv_bonjour; /* struct p2p_srv_bonjour */
  232. struct dl_list p2p_srv_upnp; /* struct p2p_srv_upnp */
  233. int p2p_disabled;
  234. int cross_connection;
  235. struct wpa_freq_range_list p2p_disallow_freq;
  236. struct wpa_freq_range_list p2p_go_avoid_freq;
  237. enum wpa_conc_pref {
  238. WPA_CONC_PREF_NOT_SET,
  239. WPA_CONC_PREF_STA,
  240. WPA_CONC_PREF_P2P
  241. } conc_pref;
  242. unsigned int p2p_per_sta_psk:1;
  243. unsigned int p2p_fail_on_wps_complete:1;
  244. #ifdef CONFIG_WIFI_DISPLAY
  245. int wifi_display;
  246. #define MAX_WFD_SUBELEMS 10
  247. struct wpabuf *wfd_subelem[MAX_WFD_SUBELEMS];
  248. #endif /* CONFIG_WIFI_DISPLAY */
  249. struct psk_list_entry *add_psk; /* From group formation */
  250. };
  251. /**
  252. * struct wpa_radio - Internal data for per-radio information
  253. *
  254. * This structure is used to share data about configured interfaces
  255. * (struct wpa_supplicant) that share the same physical radio, e.g., to allow
  256. * better coordination of offchannel operations.
  257. */
  258. struct wpa_radio {
  259. char name[16]; /* from driver_ops get_radio_name() or empty if not
  260. * available */
  261. struct dl_list ifaces; /* struct wpa_supplicant::radio_list entries */
  262. struct dl_list work; /* struct wpa_radio_work::list entries */
  263. };
  264. /**
  265. * struct wpa_radio_work - Radio work item
  266. */
  267. struct wpa_radio_work {
  268. struct dl_list list;
  269. unsigned int freq; /* known frequency (MHz) or 0 for multiple/unknown */
  270. const char *type;
  271. struct wpa_supplicant *wpa_s;
  272. void (*cb)(struct wpa_radio_work *work, int deinit);
  273. void *ctx;
  274. unsigned int started:1;
  275. struct os_reltime time;
  276. };
  277. int radio_add_work(struct wpa_supplicant *wpa_s, unsigned int freq,
  278. const char *type, int next,
  279. void (*cb)(struct wpa_radio_work *work, int deinit),
  280. void *ctx);
  281. void radio_work_done(struct wpa_radio_work *work);
  282. void radio_remove_works(struct wpa_supplicant *wpa_s,
  283. const char *type, int remove_all);
  284. void radio_work_check_next(struct wpa_supplicant *wpa_s);
  285. int radio_work_pending(struct wpa_supplicant *wpa_s, const char *type);
  286. struct wpa_connect_work {
  287. unsigned int sme:1;
  288. struct wpa_bss *bss;
  289. struct wpa_ssid *ssid;
  290. };
  291. int wpas_valid_bss_ssid(struct wpa_supplicant *wpa_s, struct wpa_bss *test_bss,
  292. struct wpa_ssid *test_ssid);
  293. void wpas_connect_work_free(struct wpa_connect_work *cwork);
  294. void wpas_connect_work_done(struct wpa_supplicant *wpa_s);
  295. struct wpa_external_work {
  296. unsigned int id;
  297. char type[100];
  298. unsigned int timeout;
  299. };
  300. /**
  301. * offchannel_send_action_result - Result of offchannel send Action frame
  302. */
  303. enum offchannel_send_action_result {
  304. OFFCHANNEL_SEND_ACTION_SUCCESS /**< Frame was send and acknowledged */,
  305. OFFCHANNEL_SEND_ACTION_NO_ACK /**< Frame was sent, but not acknowledged
  306. */,
  307. OFFCHANNEL_SEND_ACTION_FAILED /**< Frame was not sent due to a failure
  308. */
  309. };
  310. struct wps_ap_info {
  311. u8 bssid[ETH_ALEN];
  312. enum wps_ap_info_type {
  313. WPS_AP_NOT_SEL_REG,
  314. WPS_AP_SEL_REG,
  315. WPS_AP_SEL_REG_OUR
  316. } type;
  317. unsigned int tries;
  318. struct os_reltime last_attempt;
  319. };
  320. struct wpa_ssid_value {
  321. u8 ssid[32];
  322. size_t ssid_len;
  323. };
  324. #define WPA_FREQ_USED_BY_INFRA_STATION BIT(0)
  325. #define WPA_FREQ_USED_BY_P2P_CLIENT BIT(1)
  326. struct wpa_used_freq_data {
  327. int freq;
  328. unsigned int flags;
  329. };
  330. /**
  331. * struct wpa_supplicant - Internal data for wpa_supplicant interface
  332. *
  333. * This structure contains the internal data for core wpa_supplicant code. This
  334. * should be only used directly from the core code. However, a pointer to this
  335. * data is used from other files as an arbitrary context pointer in calls to
  336. * core functions.
  337. */
  338. struct wpa_supplicant {
  339. struct wpa_global *global;
  340. struct wpa_radio *radio; /* shared radio context */
  341. struct dl_list radio_list; /* list head: struct wpa_radio::ifaces */
  342. struct wpa_supplicant *parent;
  343. struct wpa_supplicant *next;
  344. struct l2_packet_data *l2;
  345. struct l2_packet_data *l2_br;
  346. unsigned char own_addr[ETH_ALEN];
  347. unsigned char perm_addr[ETH_ALEN];
  348. char ifname[100];
  349. #ifdef CONFIG_CTRL_IFACE_DBUS
  350. char *dbus_path;
  351. #endif /* CONFIG_CTRL_IFACE_DBUS */
  352. #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
  353. char *dbus_new_path;
  354. char *dbus_groupobj_path;
  355. #ifdef CONFIG_AP
  356. char *preq_notify_peer;
  357. #endif /* CONFIG_AP */
  358. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  359. char bridge_ifname[16];
  360. char *confname;
  361. char *confanother;
  362. struct wpa_config *conf;
  363. int countermeasures;
  364. struct os_reltime last_michael_mic_error;
  365. u8 bssid[ETH_ALEN];
  366. u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
  367. * field contains the target BSSID. */
  368. int reassociate; /* reassociation requested */
  369. int disconnected; /* all connections disabled; i.e., do no reassociate
  370. * before this has been cleared */
  371. struct wpa_ssid *current_ssid;
  372. struct wpa_ssid *last_ssid;
  373. struct wpa_bss *current_bss;
  374. int ap_ies_from_associnfo;
  375. unsigned int assoc_freq;
  376. /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
  377. int pairwise_cipher;
  378. int group_cipher;
  379. int key_mgmt;
  380. int wpa_proto;
  381. int mgmt_group_cipher;
  382. void *drv_priv; /* private data used by driver_ops */
  383. void *global_drv_priv;
  384. u8 *bssid_filter;
  385. size_t bssid_filter_count;
  386. u8 *disallow_aps_bssid;
  387. size_t disallow_aps_bssid_count;
  388. struct wpa_ssid_value *disallow_aps_ssid;
  389. size_t disallow_aps_ssid_count;
  390. enum { WPA_SETBAND_AUTO, WPA_SETBAND_5G, WPA_SETBAND_2G } setband;
  391. /* Preferred network for the next connection attempt */
  392. struct wpa_ssid *next_ssid;
  393. /* previous scan was wildcard when interleaving between
  394. * wildcard scans and specific SSID scan when max_ssids=1 */
  395. int prev_scan_wildcard;
  396. struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
  397. * NULL = not yet initialized (start
  398. * with wildcard SSID)
  399. * WILDCARD_SSID_SCAN = wildcard
  400. * SSID was used in the previous scan
  401. */
  402. #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
  403. struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
  404. int sched_scan_timeout;
  405. int sched_scan_interval;
  406. int first_sched_scan;
  407. int sched_scan_timed_out;
  408. void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
  409. struct wpa_scan_results *scan_res);
  410. struct dl_list bss; /* struct wpa_bss::list */
  411. struct dl_list bss_id; /* struct wpa_bss::list_id */
  412. size_t num_bss;
  413. unsigned int bss_update_idx;
  414. unsigned int bss_next_id;
  415. /*
  416. * Pointers to BSS entries in the order they were in the last scan
  417. * results.
  418. */
  419. struct wpa_bss **last_scan_res;
  420. unsigned int last_scan_res_used;
  421. unsigned int last_scan_res_size;
  422. struct os_reltime last_scan;
  423. struct wpa_driver_ops *driver;
  424. int interface_removed; /* whether the network interface has been
  425. * removed */
  426. struct wpa_sm *wpa;
  427. struct eapol_sm *eapol;
  428. struct ctrl_iface_priv *ctrl_iface;
  429. enum wpa_states wpa_state;
  430. struct wpa_radio_work *scan_work;
  431. int scanning;
  432. int sched_scanning;
  433. int new_connection;
  434. int eapol_received; /* number of EAPOL packets received after the
  435. * previous association event */
  436. struct scard_data *scard;
  437. char imsi[20];
  438. int mnc_len;
  439. unsigned char last_eapol_src[ETH_ALEN];
  440. unsigned int keys_cleared; /* bitfield of key indexes that the driver is
  441. * known not to be configured with a key */
  442. struct wpa_blacklist *blacklist;
  443. /**
  444. * extra_blacklist_count - Sum of blacklist counts after last connection
  445. *
  446. * This variable is used to maintain a count of temporary blacklisting
  447. * failures (maximum number for any BSS) over blacklist clear
  448. * operations. This is needed for figuring out whether there has been
  449. * failures prior to the last blacklist clear operation which happens
  450. * whenever no other not-blacklisted BSS candidates are available. This
  451. * gets cleared whenever a connection has been established successfully.
  452. */
  453. int extra_blacklist_count;
  454. /**
  455. * scan_req - Type of the scan request
  456. */
  457. enum scan_req_type {
  458. /**
  459. * NORMAL_SCAN_REQ - Normal scan request
  460. *
  461. * This is used for scans initiated by wpa_supplicant to find an
  462. * AP for a connection.
  463. */
  464. NORMAL_SCAN_REQ,
  465. /**
  466. * INITIAL_SCAN_REQ - Initial scan request
  467. *
  468. * This is used for the first scan on an interface to force at
  469. * least one scan to be run even if the configuration does not
  470. * include any enabled networks.
  471. */
  472. INITIAL_SCAN_REQ,
  473. /**
  474. * MANUAL_SCAN_REQ - Manual scan request
  475. *
  476. * This is used for scans where the user request a scan or
  477. * a specific wpa_supplicant operation (e.g., WPS) requires scan
  478. * to be run.
  479. */
  480. MANUAL_SCAN_REQ
  481. } scan_req, last_scan_req;
  482. struct os_reltime scan_trigger_time, scan_start_time;
  483. int scan_runs; /* number of scan runs since WPS was started */
  484. int *next_scan_freqs;
  485. int *manual_scan_freqs;
  486. int *manual_sched_scan_freqs;
  487. unsigned int manual_scan_passive:1;
  488. unsigned int manual_scan_use_id:1;
  489. unsigned int manual_scan_only_new:1;
  490. unsigned int own_scan_requested:1;
  491. unsigned int own_scan_running:1;
  492. unsigned int external_scan_running:1;
  493. unsigned int clear_driver_scan_cache:1;
  494. unsigned int manual_scan_id;
  495. int scan_interval; /* time in sec between scans to find suitable AP */
  496. int normal_scans; /* normal scans run before sched_scan */
  497. int scan_for_connection; /* whether the scan request was triggered for
  498. * finding a connection */
  499. #define MAX_SCAN_ID 16
  500. int scan_id[MAX_SCAN_ID];
  501. unsigned int scan_id_count;
  502. unsigned int drv_flags;
  503. unsigned int drv_enc;
  504. /*
  505. * A bitmap of supported protocols for probe response offload. See
  506. * struct wpa_driver_capa in driver.h
  507. */
  508. unsigned int probe_resp_offloads;
  509. /* extended capabilities supported by the driver */
  510. const u8 *extended_capa, *extended_capa_mask;
  511. unsigned int extended_capa_len;
  512. int max_scan_ssids;
  513. int max_sched_scan_ssids;
  514. int sched_scan_supported;
  515. unsigned int max_match_sets;
  516. unsigned int max_remain_on_chan;
  517. unsigned int max_stations;
  518. int pending_mic_error_report;
  519. int pending_mic_error_pairwise;
  520. int mic_errors_seen; /* Michael MIC errors with the current PTK */
  521. struct wps_context *wps;
  522. int wps_success; /* WPS success event received */
  523. struct wps_er *wps_er;
  524. unsigned int wps_run;
  525. int blacklist_cleared;
  526. struct wpabuf *pending_eapol_rx;
  527. struct os_reltime pending_eapol_rx_time;
  528. u8 pending_eapol_rx_src[ETH_ALEN];
  529. unsigned int last_eapol_matches_bssid:1;
  530. unsigned int eap_expected_failure:1;
  531. unsigned int reattach:1; /* reassociation to the same BSS requested */
  532. unsigned int mac_addr_changed:1;
  533. struct os_reltime last_mac_addr_change;
  534. int last_mac_addr_style;
  535. struct ibss_rsn *ibss_rsn;
  536. int set_sta_uapsd;
  537. int sta_uapsd;
  538. int set_ap_uapsd;
  539. int ap_uapsd;
  540. #ifdef CONFIG_SME
  541. struct {
  542. u8 ssid[32];
  543. size_t ssid_len;
  544. int freq;
  545. u8 assoc_req_ie[200];
  546. size_t assoc_req_ie_len;
  547. int mfp;
  548. int ft_used;
  549. u8 mobility_domain[2];
  550. u8 *ft_ies;
  551. size_t ft_ies_len;
  552. u8 prev_bssid[ETH_ALEN];
  553. int prev_bssid_set;
  554. int auth_alg;
  555. int proto;
  556. int sa_query_count; /* number of pending SA Query requests;
  557. * 0 = no SA Query in progress */
  558. int sa_query_timed_out;
  559. u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
  560. * sa_query_count octets of pending
  561. * SA Query transaction identifiers */
  562. struct os_reltime sa_query_start;
  563. struct os_reltime last_unprot_disconnect;
  564. u8 sched_obss_scan;
  565. u16 obss_scan_int;
  566. u16 bss_max_idle_period;
  567. #ifdef CONFIG_SAE
  568. struct sae_data sae;
  569. struct wpabuf *sae_token;
  570. int sae_group_index;
  571. #endif /* CONFIG_SAE */
  572. } sme;
  573. #endif /* CONFIG_SME */
  574. #ifdef CONFIG_AP
  575. struct hostapd_iface *ap_iface;
  576. void (*ap_configured_cb)(void *ctx, void *data);
  577. void *ap_configured_cb_ctx;
  578. void *ap_configured_cb_data;
  579. #endif /* CONFIG_AP */
  580. unsigned int off_channel_freq;
  581. struct wpabuf *pending_action_tx;
  582. u8 pending_action_src[ETH_ALEN];
  583. u8 pending_action_dst[ETH_ALEN];
  584. u8 pending_action_bssid[ETH_ALEN];
  585. unsigned int pending_action_freq;
  586. int pending_action_no_cck;
  587. int pending_action_without_roc;
  588. unsigned int pending_action_tx_done:1;
  589. void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
  590. unsigned int freq, const u8 *dst,
  591. const u8 *src, const u8 *bssid,
  592. const u8 *data, size_t data_len,
  593. enum offchannel_send_action_result
  594. result);
  595. unsigned int roc_waiting_drv_freq;
  596. int action_tx_wait_time;
  597. int p2p_mgmt;
  598. #ifdef CONFIG_P2P
  599. struct p2p_go_neg_results *go_params;
  600. int create_p2p_iface;
  601. u8 pending_interface_addr[ETH_ALEN];
  602. char pending_interface_name[100];
  603. int pending_interface_type;
  604. int p2p_group_idx;
  605. unsigned int pending_listen_freq;
  606. unsigned int pending_listen_duration;
  607. enum {
  608. NOT_P2P_GROUP_INTERFACE,
  609. P2P_GROUP_INTERFACE_PENDING,
  610. P2P_GROUP_INTERFACE_GO,
  611. P2P_GROUP_INTERFACE_CLIENT
  612. } p2p_group_interface;
  613. struct p2p_group *p2p_group;
  614. int p2p_long_listen; /* remaining time in long Listen state in ms */
  615. char p2p_pin[10];
  616. int p2p_wps_method;
  617. u8 p2p_auth_invite[ETH_ALEN];
  618. int p2p_sd_over_ctrl_iface;
  619. int p2p_in_provisioning;
  620. int p2p_in_invitation;
  621. int p2p_invite_go_freq;
  622. int pending_invite_ssid_id;
  623. int show_group_started;
  624. u8 go_dev_addr[ETH_ALEN];
  625. int pending_pd_before_join;
  626. u8 pending_join_iface_addr[ETH_ALEN];
  627. u8 pending_join_dev_addr[ETH_ALEN];
  628. int pending_join_wps_method;
  629. u8 p2p_join_ssid[32];
  630. size_t p2p_join_ssid_len;
  631. int p2p_join_scan_count;
  632. int auto_pd_scan_retry;
  633. int force_long_sd;
  634. u16 pending_pd_config_methods;
  635. enum {
  636. NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN
  637. } pending_pd_use;
  638. /*
  639. * Whether cross connection is disallowed by the AP to which this
  640. * interface is associated (only valid if there is an association).
  641. */
  642. int cross_connect_disallowed;
  643. /*
  644. * Whether this P2P group is configured to use cross connection (only
  645. * valid if this is P2P GO interface). The actual cross connect packet
  646. * forwarding may not be configured depending on the uplink status.
  647. */
  648. int cross_connect_enabled;
  649. /* Whether cross connection forwarding is in use at the moment. */
  650. int cross_connect_in_use;
  651. /*
  652. * Uplink interface name for cross connection
  653. */
  654. char cross_connect_uplink[100];
  655. unsigned int p2p_auto_join:1;
  656. unsigned int p2p_auto_pd:1;
  657. unsigned int p2p_persistent_group:1;
  658. unsigned int p2p_fallback_to_go_neg:1;
  659. unsigned int p2p_pd_before_go_neg:1;
  660. unsigned int p2p_go_ht40:1;
  661. unsigned int p2p_go_vht:1;
  662. unsigned int user_initiated_pd:1;
  663. unsigned int p2p_go_group_formation_completed:1;
  664. unsigned int waiting_presence_resp;
  665. int p2p_first_connection_timeout;
  666. unsigned int p2p_nfc_tag_enabled:1;
  667. unsigned int p2p_peer_oob_pk_hash_known:1;
  668. unsigned int p2p_disable_ip_addr_req:1;
  669. int p2p_persistent_go_freq;
  670. int p2p_persistent_id;
  671. int p2p_go_intent;
  672. int p2p_connect_freq;
  673. struct os_reltime p2p_auto_started;
  674. struct wpa_ssid *p2p_last_4way_hs_fail;
  675. struct wpa_radio_work *p2p_scan_work;
  676. struct wpa_radio_work *p2p_listen_work;
  677. struct wpa_radio_work *p2p_send_action_work;
  678. u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
  679. struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
  680. * formation */
  681. u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
  682. u8 p2p_ip_addr_info[3 * 4];
  683. #endif /* CONFIG_P2P */
  684. struct wpa_ssid *bgscan_ssid;
  685. const struct bgscan_ops *bgscan;
  686. void *bgscan_priv;
  687. const struct autoscan_ops *autoscan;
  688. struct wpa_driver_scan_params *autoscan_params;
  689. void *autoscan_priv;
  690. struct wpa_ssid *connect_without_scan;
  691. struct wps_ap_info *wps_ap;
  692. size_t num_wps_ap;
  693. int wps_ap_iter;
  694. int after_wps;
  695. int known_wps_freq;
  696. unsigned int wps_freq;
  697. int wps_fragment_size;
  698. int auto_reconnect_disabled;
  699. /* Channel preferences for AP/P2P GO use */
  700. int best_24_freq;
  701. int best_5_freq;
  702. int best_overall_freq;
  703. struct gas_query *gas;
  704. #ifdef CONFIG_INTERWORKING
  705. unsigned int fetch_anqp_in_progress:1;
  706. unsigned int network_select:1;
  707. unsigned int auto_select:1;
  708. unsigned int auto_network_select:1;
  709. unsigned int fetch_all_anqp:1;
  710. unsigned int fetch_osu_info:1;
  711. unsigned int fetch_osu_icon_in_progress:1;
  712. struct wpa_bss *interworking_gas_bss;
  713. unsigned int osu_icon_id;
  714. struct osu_provider *osu_prov;
  715. size_t osu_prov_count;
  716. struct os_reltime osu_icon_fetch_start;
  717. unsigned int num_osu_scans;
  718. unsigned int num_prov_found;
  719. #endif /* CONFIG_INTERWORKING */
  720. unsigned int drv_capa_known;
  721. struct {
  722. struct hostapd_hw_modes *modes;
  723. u16 num_modes;
  724. u16 flags;
  725. } hw;
  726. #ifdef CONFIG_MACSEC
  727. struct ieee802_1x_kay *kay;
  728. #endif /* CONFIG_MACSEC */
  729. int pno;
  730. int pno_sched_pending;
  731. /* WLAN_REASON_* reason codes. Negative if locally generated. */
  732. int disconnect_reason;
  733. struct ext_password_data *ext_pw;
  734. struct wpabuf *last_gas_resp, *prev_gas_resp;
  735. u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
  736. u8 last_gas_dialog_token, prev_gas_dialog_token;
  737. unsigned int no_keep_alive:1;
  738. unsigned int ext_mgmt_frame_handling:1;
  739. #ifdef CONFIG_WNM
  740. u8 wnm_dialog_token;
  741. u8 wnm_reply;
  742. u8 wnm_num_neighbor_report;
  743. u8 wnm_mode;
  744. u16 wnm_dissoc_timer;
  745. u8 wnm_validity_interval;
  746. u8 wnm_bss_termination_duration[12];
  747. struct neighbor_report *wnm_neighbor_report_elements;
  748. #endif /* CONFIG_WNM */
  749. #ifdef CONFIG_TESTING_GET_GTK
  750. u8 last_gtk[32];
  751. size_t last_gtk_len;
  752. #endif /* CONFIG_TESTING_GET_GTK */
  753. unsigned int num_multichan_concurrent;
  754. struct wpa_radio_work *connect_work;
  755. unsigned int ext_work_id;
  756. struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
  757. };
  758. /* wpa_supplicant.c */
  759. void wpa_supplicant_apply_ht_overrides(
  760. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  761. struct wpa_driver_associate_params *params);
  762. void wpa_supplicant_apply_vht_overrides(
  763. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  764. struct wpa_driver_associate_params *params);
  765. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  766. int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
  767. struct wpa_ssid *ssid);
  768. int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
  769. const char * wpa_supplicant_state_txt(enum wpa_states state);
  770. int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
  771. int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
  772. int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
  773. struct wpa_bss *bss, struct wpa_ssid *ssid,
  774. u8 *wpa_ie, size_t *wpa_ie_len);
  775. void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
  776. struct wpa_bss *bss,
  777. struct wpa_ssid *ssid);
  778. void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
  779. struct wpa_ssid *ssid);
  780. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
  781. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  782. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  783. int sec, int usec);
  784. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  785. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  786. enum wpa_states state);
  787. struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
  788. const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
  789. void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
  790. void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
  791. int reason_code);
  792. void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
  793. struct wpa_ssid *ssid);
  794. void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
  795. struct wpa_ssid *ssid);
  796. void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
  797. struct wpa_ssid *ssid);
  798. int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
  799. const char *pkcs11_engine_path,
  800. const char *pkcs11_module_path);
  801. int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
  802. int ap_scan);
  803. int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
  804. unsigned int expire_age);
  805. int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
  806. unsigned int expire_count);
  807. int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
  808. int scan_interval);
  809. int wpa_supplicant_set_debug_params(struct wpa_global *global,
  810. int debug_level, int debug_timestamp,
  811. int debug_show_keys);
  812. void free_hw_features(struct wpa_supplicant *wpa_s);
  813. void wpa_show_license(void);
  814. struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
  815. struct wpa_interface *iface);
  816. int wpa_supplicant_remove_iface(struct wpa_global *global,
  817. struct wpa_supplicant *wpa_s,
  818. int terminate);
  819. struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
  820. const char *ifname);
  821. struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
  822. int wpa_supplicant_run(struct wpa_global *global);
  823. void wpa_supplicant_deinit(struct wpa_global *global);
  824. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  825. struct wpa_ssid *ssid);
  826. void wpa_supplicant_terminate_proc(struct wpa_global *global);
  827. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  828. const u8 *buf, size_t len);
  829. void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
  830. void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
  831. void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  832. int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
  833. int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
  834. void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
  835. void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
  836. struct wpa_ssid *ssid, int clear_failures);
  837. int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
  838. int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
  839. size_t ssid_len);
  840. void wpas_request_connection(struct wpa_supplicant *wpa_s);
  841. int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
  842. int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
  843. int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
  844. /**
  845. * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
  846. * @wpa_s: Pointer to wpa_supplicant data
  847. * @ssid: Pointer to the network block the reply is for
  848. * @field: field the response is a reply for
  849. * @value: value (ie, password, etc) for @field
  850. * Returns: 0 on success, non-zero on error
  851. *
  852. * Helper function to handle replies to control interface requests.
  853. */
  854. int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
  855. struct wpa_ssid *ssid,
  856. const char *field,
  857. const char *value);
  858. /* events.c */
  859. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
  860. int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
  861. struct wpa_bss *selected,
  862. struct wpa_ssid *ssid);
  863. void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
  864. void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
  865. void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
  866. int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
  867. struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
  868. struct wpa_ssid **selected_ssid);
  869. int ht_supported(const struct hostapd_hw_modes *mode);
  870. int vht_supported(const struct hostapd_hw_modes *mode);
  871. /* eap_register.c */
  872. int eap_register_methods(void);
  873. /**
  874. * Utility method to tell if a given network is a persistent group
  875. * @ssid: Network object
  876. * Returns: 1 if network is a persistent group, 0 otherwise
  877. */
  878. static inline int network_is_persistent_group(struct wpa_ssid *ssid)
  879. {
  880. return ((ssid->disabled == 2) || ssid->p2p_persistent_group);
  881. }
  882. int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  883. int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
  884. void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
  885. struct wpa_used_freq_data *freqs_data,
  886. unsigned int len);
  887. int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
  888. struct wpa_used_freq_data *freqs_data,
  889. unsigned int len);
  890. int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
  891. int *freq_array, unsigned int len);
  892. #endif /* WPA_SUPPLICANT_I_H */