wpa_supplicant_i.h 29 KB

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