wpa_supplicant_i.h 32 KB

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