wpa_supplicant_i.h 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  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 - Additional 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. #ifdef CONFIG_P2P
  363. char *conf_p2p_dev;
  364. #endif /* CONFIG_P2P */
  365. struct wpa_config *conf;
  366. int countermeasures;
  367. struct os_reltime last_michael_mic_error;
  368. u8 bssid[ETH_ALEN];
  369. u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
  370. * field contains the target BSSID. */
  371. int reassociate; /* reassociation requested */
  372. int disconnected; /* all connections disabled; i.e., do no reassociate
  373. * before this has been cleared */
  374. struct wpa_ssid *current_ssid;
  375. struct wpa_ssid *last_ssid;
  376. struct wpa_bss *current_bss;
  377. int ap_ies_from_associnfo;
  378. unsigned int assoc_freq;
  379. /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
  380. int pairwise_cipher;
  381. int group_cipher;
  382. int key_mgmt;
  383. int wpa_proto;
  384. int mgmt_group_cipher;
  385. void *drv_priv; /* private data used by driver_ops */
  386. void *global_drv_priv;
  387. u8 *bssid_filter;
  388. size_t bssid_filter_count;
  389. u8 *disallow_aps_bssid;
  390. size_t disallow_aps_bssid_count;
  391. struct wpa_ssid_value *disallow_aps_ssid;
  392. size_t disallow_aps_ssid_count;
  393. enum { WPA_SETBAND_AUTO, WPA_SETBAND_5G, WPA_SETBAND_2G } setband;
  394. /* Preferred network for the next connection attempt */
  395. struct wpa_ssid *next_ssid;
  396. /* previous scan was wildcard when interleaving between
  397. * wildcard scans and specific SSID scan when max_ssids=1 */
  398. int prev_scan_wildcard;
  399. struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
  400. * NULL = not yet initialized (start
  401. * with wildcard SSID)
  402. * WILDCARD_SSID_SCAN = wildcard
  403. * SSID was used in the previous scan
  404. */
  405. #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
  406. struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
  407. int sched_scan_timeout;
  408. int sched_scan_interval;
  409. int first_sched_scan;
  410. int sched_scan_timed_out;
  411. void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
  412. struct wpa_scan_results *scan_res);
  413. struct dl_list bss; /* struct wpa_bss::list */
  414. struct dl_list bss_id; /* struct wpa_bss::list_id */
  415. size_t num_bss;
  416. unsigned int bss_update_idx;
  417. unsigned int bss_next_id;
  418. /*
  419. * Pointers to BSS entries in the order they were in the last scan
  420. * results.
  421. */
  422. struct wpa_bss **last_scan_res;
  423. unsigned int last_scan_res_used;
  424. unsigned int last_scan_res_size;
  425. struct os_reltime last_scan;
  426. struct wpa_driver_ops *driver;
  427. int interface_removed; /* whether the network interface has been
  428. * removed */
  429. struct wpa_sm *wpa;
  430. struct eapol_sm *eapol;
  431. struct ctrl_iface_priv *ctrl_iface;
  432. enum wpa_states wpa_state;
  433. struct wpa_radio_work *scan_work;
  434. int scanning;
  435. int sched_scanning;
  436. int new_connection;
  437. int eapol_received; /* number of EAPOL packets received after the
  438. * previous association event */
  439. struct scard_data *scard;
  440. char imsi[20];
  441. int mnc_len;
  442. unsigned char last_eapol_src[ETH_ALEN];
  443. unsigned int keys_cleared; /* bitfield of key indexes that the driver is
  444. * known not to be configured with a key */
  445. struct wpa_blacklist *blacklist;
  446. /**
  447. * extra_blacklist_count - Sum of blacklist counts after last connection
  448. *
  449. * This variable is used to maintain a count of temporary blacklisting
  450. * failures (maximum number for any BSS) over blacklist clear
  451. * operations. This is needed for figuring out whether there has been
  452. * failures prior to the last blacklist clear operation which happens
  453. * whenever no other not-blacklisted BSS candidates are available. This
  454. * gets cleared whenever a connection has been established successfully.
  455. */
  456. int extra_blacklist_count;
  457. /**
  458. * scan_req - Type of the scan request
  459. */
  460. enum scan_req_type {
  461. /**
  462. * NORMAL_SCAN_REQ - Normal scan request
  463. *
  464. * This is used for scans initiated by wpa_supplicant to find an
  465. * AP for a connection.
  466. */
  467. NORMAL_SCAN_REQ,
  468. /**
  469. * INITIAL_SCAN_REQ - Initial scan request
  470. *
  471. * This is used for the first scan on an interface to force at
  472. * least one scan to be run even if the configuration does not
  473. * include any enabled networks.
  474. */
  475. INITIAL_SCAN_REQ,
  476. /**
  477. * MANUAL_SCAN_REQ - Manual scan request
  478. *
  479. * This is used for scans where the user request a scan or
  480. * a specific wpa_supplicant operation (e.g., WPS) requires scan
  481. * to be run.
  482. */
  483. MANUAL_SCAN_REQ
  484. } scan_req, last_scan_req;
  485. struct os_reltime scan_trigger_time, scan_start_time;
  486. int scan_runs; /* number of scan runs since WPS was started */
  487. int *next_scan_freqs;
  488. int *manual_scan_freqs;
  489. int *manual_sched_scan_freqs;
  490. unsigned int manual_scan_passive:1;
  491. unsigned int manual_scan_use_id:1;
  492. unsigned int manual_scan_only_new:1;
  493. unsigned int own_scan_requested:1;
  494. unsigned int own_scan_running:1;
  495. unsigned int external_scan_running:1;
  496. unsigned int clear_driver_scan_cache:1;
  497. unsigned int manual_scan_id;
  498. int scan_interval; /* time in sec between scans to find suitable AP */
  499. int normal_scans; /* normal scans run before sched_scan */
  500. int scan_for_connection; /* whether the scan request was triggered for
  501. * finding a connection */
  502. #define MAX_SCAN_ID 16
  503. int scan_id[MAX_SCAN_ID];
  504. unsigned int scan_id_count;
  505. unsigned int drv_flags;
  506. unsigned int drv_enc;
  507. /*
  508. * A bitmap of supported protocols for probe response offload. See
  509. * struct wpa_driver_capa in driver.h
  510. */
  511. unsigned int probe_resp_offloads;
  512. /* extended capabilities supported by the driver */
  513. const u8 *extended_capa, *extended_capa_mask;
  514. unsigned int extended_capa_len;
  515. int max_scan_ssids;
  516. int max_sched_scan_ssids;
  517. int sched_scan_supported;
  518. unsigned int max_match_sets;
  519. unsigned int max_remain_on_chan;
  520. unsigned int max_stations;
  521. int pending_mic_error_report;
  522. int pending_mic_error_pairwise;
  523. int mic_errors_seen; /* Michael MIC errors with the current PTK */
  524. struct wps_context *wps;
  525. int wps_success; /* WPS success event received */
  526. struct wps_er *wps_er;
  527. unsigned int wps_run;
  528. int blacklist_cleared;
  529. struct wpabuf *pending_eapol_rx;
  530. struct os_reltime pending_eapol_rx_time;
  531. u8 pending_eapol_rx_src[ETH_ALEN];
  532. unsigned int last_eapol_matches_bssid:1;
  533. unsigned int eap_expected_failure:1;
  534. unsigned int reattach:1; /* reassociation to the same BSS requested */
  535. unsigned int mac_addr_changed:1;
  536. struct os_reltime last_mac_addr_change;
  537. int last_mac_addr_style;
  538. struct ibss_rsn *ibss_rsn;
  539. int set_sta_uapsd;
  540. int sta_uapsd;
  541. int set_ap_uapsd;
  542. int ap_uapsd;
  543. #ifdef CONFIG_SME
  544. struct {
  545. u8 ssid[32];
  546. size_t ssid_len;
  547. int freq;
  548. u8 assoc_req_ie[200];
  549. size_t assoc_req_ie_len;
  550. int mfp;
  551. int ft_used;
  552. u8 mobility_domain[2];
  553. u8 *ft_ies;
  554. size_t ft_ies_len;
  555. u8 prev_bssid[ETH_ALEN];
  556. int prev_bssid_set;
  557. int auth_alg;
  558. int proto;
  559. int sa_query_count; /* number of pending SA Query requests;
  560. * 0 = no SA Query in progress */
  561. int sa_query_timed_out;
  562. u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
  563. * sa_query_count octets of pending
  564. * SA Query transaction identifiers */
  565. struct os_reltime sa_query_start;
  566. struct os_reltime last_unprot_disconnect;
  567. u8 sched_obss_scan;
  568. u16 obss_scan_int;
  569. u16 bss_max_idle_period;
  570. #ifdef CONFIG_SAE
  571. struct sae_data sae;
  572. struct wpabuf *sae_token;
  573. int sae_group_index;
  574. #endif /* CONFIG_SAE */
  575. } sme;
  576. #endif /* CONFIG_SME */
  577. #ifdef CONFIG_AP
  578. struct hostapd_iface *ap_iface;
  579. void (*ap_configured_cb)(void *ctx, void *data);
  580. void *ap_configured_cb_ctx;
  581. void *ap_configured_cb_data;
  582. #endif /* CONFIG_AP */
  583. unsigned int off_channel_freq;
  584. struct wpabuf *pending_action_tx;
  585. u8 pending_action_src[ETH_ALEN];
  586. u8 pending_action_dst[ETH_ALEN];
  587. u8 pending_action_bssid[ETH_ALEN];
  588. unsigned int pending_action_freq;
  589. int pending_action_no_cck;
  590. int pending_action_without_roc;
  591. unsigned int pending_action_tx_done:1;
  592. void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
  593. unsigned int freq, const u8 *dst,
  594. const u8 *src, const u8 *bssid,
  595. const u8 *data, size_t data_len,
  596. enum offchannel_send_action_result
  597. result);
  598. unsigned int roc_waiting_drv_freq;
  599. int action_tx_wait_time;
  600. int p2p_mgmt;
  601. #ifdef CONFIG_P2P
  602. struct p2p_go_neg_results *go_params;
  603. int create_p2p_iface;
  604. u8 pending_interface_addr[ETH_ALEN];
  605. char pending_interface_name[100];
  606. int pending_interface_type;
  607. int p2p_group_idx;
  608. unsigned int pending_listen_freq;
  609. unsigned int pending_listen_duration;
  610. enum {
  611. NOT_P2P_GROUP_INTERFACE,
  612. P2P_GROUP_INTERFACE_PENDING,
  613. P2P_GROUP_INTERFACE_GO,
  614. P2P_GROUP_INTERFACE_CLIENT
  615. } p2p_group_interface;
  616. struct p2p_group *p2p_group;
  617. int p2p_long_listen; /* remaining time in long Listen state in ms */
  618. char p2p_pin[10];
  619. int p2p_wps_method;
  620. u8 p2p_auth_invite[ETH_ALEN];
  621. int p2p_sd_over_ctrl_iface;
  622. int p2p_in_provisioning;
  623. int p2p_in_invitation;
  624. int p2p_invite_go_freq;
  625. int pending_invite_ssid_id;
  626. int show_group_started;
  627. u8 go_dev_addr[ETH_ALEN];
  628. int pending_pd_before_join;
  629. u8 pending_join_iface_addr[ETH_ALEN];
  630. u8 pending_join_dev_addr[ETH_ALEN];
  631. int pending_join_wps_method;
  632. u8 p2p_join_ssid[32];
  633. size_t p2p_join_ssid_len;
  634. int p2p_join_scan_count;
  635. int auto_pd_scan_retry;
  636. int force_long_sd;
  637. u16 pending_pd_config_methods;
  638. enum {
  639. NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN
  640. } pending_pd_use;
  641. /*
  642. * Whether cross connection is disallowed by the AP to which this
  643. * interface is associated (only valid if there is an association).
  644. */
  645. int cross_connect_disallowed;
  646. /*
  647. * Whether this P2P group is configured to use cross connection (only
  648. * valid if this is P2P GO interface). The actual cross connect packet
  649. * forwarding may not be configured depending on the uplink status.
  650. */
  651. int cross_connect_enabled;
  652. /* Whether cross connection forwarding is in use at the moment. */
  653. int cross_connect_in_use;
  654. /*
  655. * Uplink interface name for cross connection
  656. */
  657. char cross_connect_uplink[100];
  658. unsigned int p2p_auto_join:1;
  659. unsigned int p2p_auto_pd:1;
  660. unsigned int p2p_persistent_group:1;
  661. unsigned int p2p_fallback_to_go_neg:1;
  662. unsigned int p2p_pd_before_go_neg:1;
  663. unsigned int p2p_go_ht40:1;
  664. unsigned int p2p_go_vht:1;
  665. unsigned int user_initiated_pd:1;
  666. unsigned int p2p_go_group_formation_completed:1;
  667. unsigned int waiting_presence_resp;
  668. int p2p_first_connection_timeout;
  669. unsigned int p2p_nfc_tag_enabled:1;
  670. unsigned int p2p_peer_oob_pk_hash_known:1;
  671. unsigned int p2p_disable_ip_addr_req:1;
  672. int p2p_persistent_go_freq;
  673. int p2p_persistent_id;
  674. int p2p_go_intent;
  675. int p2p_connect_freq;
  676. struct os_reltime p2p_auto_started;
  677. struct wpa_ssid *p2p_last_4way_hs_fail;
  678. struct wpa_radio_work *p2p_scan_work;
  679. struct wpa_radio_work *p2p_listen_work;
  680. struct wpa_radio_work *p2p_send_action_work;
  681. u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
  682. struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
  683. * formation */
  684. u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
  685. u8 p2p_ip_addr_info[3 * 4];
  686. #endif /* CONFIG_P2P */
  687. struct wpa_ssid *bgscan_ssid;
  688. const struct bgscan_ops *bgscan;
  689. void *bgscan_priv;
  690. const struct autoscan_ops *autoscan;
  691. struct wpa_driver_scan_params *autoscan_params;
  692. void *autoscan_priv;
  693. struct wpa_ssid *connect_without_scan;
  694. struct wps_ap_info *wps_ap;
  695. size_t num_wps_ap;
  696. int wps_ap_iter;
  697. int after_wps;
  698. int known_wps_freq;
  699. unsigned int wps_freq;
  700. int wps_fragment_size;
  701. int auto_reconnect_disabled;
  702. /* Channel preferences for AP/P2P GO use */
  703. int best_24_freq;
  704. int best_5_freq;
  705. int best_overall_freq;
  706. struct gas_query *gas;
  707. #ifdef CONFIG_INTERWORKING
  708. unsigned int fetch_anqp_in_progress:1;
  709. unsigned int network_select:1;
  710. unsigned int auto_select:1;
  711. unsigned int auto_network_select:1;
  712. unsigned int fetch_all_anqp:1;
  713. unsigned int fetch_osu_info:1;
  714. unsigned int fetch_osu_icon_in_progress:1;
  715. struct wpa_bss *interworking_gas_bss;
  716. unsigned int osu_icon_id;
  717. struct osu_provider *osu_prov;
  718. size_t osu_prov_count;
  719. struct os_reltime osu_icon_fetch_start;
  720. unsigned int num_osu_scans;
  721. unsigned int num_prov_found;
  722. #endif /* CONFIG_INTERWORKING */
  723. unsigned int drv_capa_known;
  724. struct {
  725. struct hostapd_hw_modes *modes;
  726. u16 num_modes;
  727. u16 flags;
  728. } hw;
  729. #ifdef CONFIG_MACSEC
  730. struct ieee802_1x_kay *kay;
  731. #endif /* CONFIG_MACSEC */
  732. int pno;
  733. int pno_sched_pending;
  734. /* WLAN_REASON_* reason codes. Negative if locally generated. */
  735. int disconnect_reason;
  736. struct ext_password_data *ext_pw;
  737. struct wpabuf *last_gas_resp, *prev_gas_resp;
  738. u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
  739. u8 last_gas_dialog_token, prev_gas_dialog_token;
  740. unsigned int no_keep_alive:1;
  741. unsigned int ext_mgmt_frame_handling:1;
  742. #ifdef CONFIG_WNM
  743. u8 wnm_dialog_token;
  744. u8 wnm_reply;
  745. u8 wnm_num_neighbor_report;
  746. u8 wnm_mode;
  747. u16 wnm_dissoc_timer;
  748. u8 wnm_validity_interval;
  749. u8 wnm_bss_termination_duration[12];
  750. struct neighbor_report *wnm_neighbor_report_elements;
  751. #endif /* CONFIG_WNM */
  752. #ifdef CONFIG_TESTING_GET_GTK
  753. u8 last_gtk[32];
  754. size_t last_gtk_len;
  755. #endif /* CONFIG_TESTING_GET_GTK */
  756. unsigned int num_multichan_concurrent;
  757. struct wpa_radio_work *connect_work;
  758. unsigned int ext_work_id;
  759. struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
  760. };
  761. /* wpa_supplicant.c */
  762. void wpa_supplicant_apply_ht_overrides(
  763. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  764. struct wpa_driver_associate_params *params);
  765. void wpa_supplicant_apply_vht_overrides(
  766. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  767. struct wpa_driver_associate_params *params);
  768. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  769. int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
  770. struct wpa_ssid *ssid);
  771. int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
  772. const char * wpa_supplicant_state_txt(enum wpa_states state);
  773. int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
  774. int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
  775. int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
  776. struct wpa_bss *bss, struct wpa_ssid *ssid,
  777. u8 *wpa_ie, size_t *wpa_ie_len);
  778. void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
  779. struct wpa_bss *bss,
  780. struct wpa_ssid *ssid);
  781. void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
  782. struct wpa_ssid *ssid);
  783. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
  784. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  785. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  786. int sec, int usec);
  787. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  788. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  789. enum wpa_states state);
  790. struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
  791. const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
  792. void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
  793. void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
  794. int reason_code);
  795. void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
  796. struct wpa_ssid *ssid);
  797. void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
  798. struct wpa_ssid *ssid);
  799. void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
  800. struct wpa_ssid *ssid);
  801. int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
  802. const char *pkcs11_engine_path,
  803. const char *pkcs11_module_path);
  804. int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
  805. int ap_scan);
  806. int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
  807. unsigned int expire_age);
  808. int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
  809. unsigned int expire_count);
  810. int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
  811. int scan_interval);
  812. int wpa_supplicant_set_debug_params(struct wpa_global *global,
  813. int debug_level, int debug_timestamp,
  814. int debug_show_keys);
  815. void free_hw_features(struct wpa_supplicant *wpa_s);
  816. void wpa_show_license(void);
  817. struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
  818. struct wpa_interface *iface);
  819. int wpa_supplicant_remove_iface(struct wpa_global *global,
  820. struct wpa_supplicant *wpa_s,
  821. int terminate);
  822. struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
  823. const char *ifname);
  824. struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
  825. int wpa_supplicant_run(struct wpa_global *global);
  826. void wpa_supplicant_deinit(struct wpa_global *global);
  827. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  828. struct wpa_ssid *ssid);
  829. void wpa_supplicant_terminate_proc(struct wpa_global *global);
  830. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  831. const u8 *buf, size_t len);
  832. void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
  833. void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
  834. void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  835. int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
  836. int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
  837. void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
  838. void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
  839. struct wpa_ssid *ssid, int clear_failures);
  840. int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
  841. int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
  842. size_t ssid_len);
  843. void wpas_request_connection(struct wpa_supplicant *wpa_s);
  844. int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
  845. int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
  846. int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
  847. /**
  848. * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
  849. * @wpa_s: Pointer to wpa_supplicant data
  850. * @ssid: Pointer to the network block the reply is for
  851. * @field: field the response is a reply for
  852. * @value: value (ie, password, etc) for @field
  853. * Returns: 0 on success, non-zero on error
  854. *
  855. * Helper function to handle replies to control interface requests.
  856. */
  857. int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
  858. struct wpa_ssid *ssid,
  859. const char *field,
  860. const char *value);
  861. /* events.c */
  862. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
  863. int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
  864. struct wpa_bss *selected,
  865. struct wpa_ssid *ssid);
  866. void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
  867. void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
  868. void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
  869. int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
  870. struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
  871. struct wpa_ssid **selected_ssid);
  872. /* eap_register.c */
  873. int eap_register_methods(void);
  874. /**
  875. * Utility method to tell if a given network is a persistent group
  876. * @ssid: Network object
  877. * Returns: 1 if network is a persistent group, 0 otherwise
  878. */
  879. static inline int network_is_persistent_group(struct wpa_ssid *ssid)
  880. {
  881. return ((ssid->disabled == 2) || ssid->p2p_persistent_group);
  882. }
  883. int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  884. int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
  885. void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
  886. struct wpa_used_freq_data *freqs_data,
  887. unsigned int len);
  888. int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
  889. struct wpa_used_freq_data *freqs_data,
  890. unsigned int len);
  891. int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
  892. int *freq_array, unsigned int len);
  893. #endif /* WPA_SUPPLICANT_I_H */