wpa_supplicant_i.h 28 KB

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