wpa_supplicant_i.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145
  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. unsigned int pending_p2ps_group:1;
  247. unsigned int pending_group_iface_for_p2ps:1;
  248. #ifdef CONFIG_WIFI_DISPLAY
  249. int wifi_display;
  250. #define MAX_WFD_SUBELEMS 10
  251. struct wpabuf *wfd_subelem[MAX_WFD_SUBELEMS];
  252. #endif /* CONFIG_WIFI_DISPLAY */
  253. struct psk_list_entry *add_psk; /* From group formation */
  254. };
  255. /**
  256. * struct wpa_radio - Internal data for per-radio information
  257. *
  258. * This structure is used to share data about configured interfaces
  259. * (struct wpa_supplicant) that share the same physical radio, e.g., to allow
  260. * better coordination of offchannel operations.
  261. */
  262. struct wpa_radio {
  263. char name[16]; /* from driver_ops get_radio_name() or empty if not
  264. * available */
  265. unsigned int external_scan_running:1;
  266. struct dl_list ifaces; /* struct wpa_supplicant::radio_list entries */
  267. struct dl_list work; /* struct wpa_radio_work::list entries */
  268. };
  269. /**
  270. * struct wpa_radio_work - Radio work item
  271. */
  272. struct wpa_radio_work {
  273. struct dl_list list;
  274. unsigned int freq; /* known frequency (MHz) or 0 for multiple/unknown */
  275. const char *type;
  276. struct wpa_supplicant *wpa_s;
  277. void (*cb)(struct wpa_radio_work *work, int deinit);
  278. void *ctx;
  279. unsigned int started:1;
  280. struct os_reltime time;
  281. };
  282. int radio_add_work(struct wpa_supplicant *wpa_s, unsigned int freq,
  283. const char *type, int next,
  284. void (*cb)(struct wpa_radio_work *work, int deinit),
  285. void *ctx);
  286. void radio_work_done(struct wpa_radio_work *work);
  287. void radio_remove_works(struct wpa_supplicant *wpa_s,
  288. const char *type, int remove_all);
  289. void radio_work_check_next(struct wpa_supplicant *wpa_s);
  290. struct wpa_radio_work *
  291. radio_work_pending(struct wpa_supplicant *wpa_s, const char *type);
  292. struct wpa_connect_work {
  293. unsigned int sme:1;
  294. unsigned int bss_removed:1;
  295. struct wpa_bss *bss;
  296. struct wpa_ssid *ssid;
  297. };
  298. int wpas_valid_bss_ssid(struct wpa_supplicant *wpa_s, struct wpa_bss *test_bss,
  299. struct wpa_ssid *test_ssid);
  300. void wpas_connect_work_free(struct wpa_connect_work *cwork);
  301. void wpas_connect_work_done(struct wpa_supplicant *wpa_s);
  302. struct wpa_external_work {
  303. unsigned int id;
  304. char type[100];
  305. unsigned int timeout;
  306. };
  307. /**
  308. * offchannel_send_action_result - Result of offchannel send Action frame
  309. */
  310. enum offchannel_send_action_result {
  311. OFFCHANNEL_SEND_ACTION_SUCCESS /**< Frame was send and acknowledged */,
  312. OFFCHANNEL_SEND_ACTION_NO_ACK /**< Frame was sent, but not acknowledged
  313. */,
  314. OFFCHANNEL_SEND_ACTION_FAILED /**< Frame was not sent due to a failure
  315. */
  316. };
  317. struct wps_ap_info {
  318. u8 bssid[ETH_ALEN];
  319. enum wps_ap_info_type {
  320. WPS_AP_NOT_SEL_REG,
  321. WPS_AP_SEL_REG,
  322. WPS_AP_SEL_REG_OUR
  323. } type;
  324. unsigned int tries;
  325. struct os_reltime last_attempt;
  326. };
  327. struct wpa_ssid_value {
  328. u8 ssid[32];
  329. size_t ssid_len;
  330. };
  331. #define WPA_FREQ_USED_BY_INFRA_STATION BIT(0)
  332. #define WPA_FREQ_USED_BY_P2P_CLIENT BIT(1)
  333. struct wpa_used_freq_data {
  334. int freq;
  335. unsigned int flags;
  336. };
  337. #define RRM_NEIGHBOR_REPORT_TIMEOUT 1 /* 1 second for AP to send a report */
  338. /*
  339. * struct rrm_data - Data used for managing RRM features
  340. */
  341. struct rrm_data {
  342. /* rrm_used - indication regarding the current connection */
  343. unsigned int rrm_used:1;
  344. /*
  345. * notify_neighbor_rep - Callback for notifying report requester
  346. */
  347. void (*notify_neighbor_rep)(void *ctx, struct wpabuf *neighbor_rep);
  348. /*
  349. * neighbor_rep_cb_ctx - Callback context
  350. * Received in the callback registration, and sent to the callback
  351. * function as a parameter.
  352. */
  353. void *neighbor_rep_cb_ctx;
  354. /* next_neighbor_rep_token - Next request's dialog token */
  355. u8 next_neighbor_rep_token;
  356. };
  357. enum wpa_supplicant_test_failure {
  358. WPAS_TEST_FAILURE_NONE,
  359. WPAS_TEST_FAILURE_SCAN_TRIGGER,
  360. };
  361. /**
  362. * struct wpa_supplicant - Internal data for wpa_supplicant interface
  363. *
  364. * This structure contains the internal data for core wpa_supplicant code. This
  365. * should be only used directly from the core code. However, a pointer to this
  366. * data is used from other files as an arbitrary context pointer in calls to
  367. * core functions.
  368. */
  369. struct wpa_supplicant {
  370. struct wpa_global *global;
  371. struct wpa_radio *radio; /* shared radio context */
  372. struct dl_list radio_list; /* list head: struct wpa_radio::ifaces */
  373. struct wpa_supplicant *parent;
  374. struct wpa_supplicant *next;
  375. struct l2_packet_data *l2;
  376. struct l2_packet_data *l2_br;
  377. unsigned char own_addr[ETH_ALEN];
  378. unsigned char perm_addr[ETH_ALEN];
  379. char ifname[100];
  380. #ifdef CONFIG_CTRL_IFACE_DBUS
  381. char *dbus_path;
  382. #endif /* CONFIG_CTRL_IFACE_DBUS */
  383. #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
  384. char *dbus_new_path;
  385. char *dbus_groupobj_path;
  386. #ifdef CONFIG_AP
  387. char *preq_notify_peer;
  388. #endif /* CONFIG_AP */
  389. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  390. char bridge_ifname[16];
  391. char *confname;
  392. char *confanother;
  393. struct wpa_config *conf;
  394. int countermeasures;
  395. struct os_reltime last_michael_mic_error;
  396. u8 bssid[ETH_ALEN];
  397. u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
  398. * field contains the target BSSID. */
  399. int reassociate; /* reassociation requested */
  400. int reassoc_same_bss; /* reassociating to the same bss */
  401. int disconnected; /* all connections disabled; i.e., do no reassociate
  402. * before this has been cleared */
  403. struct wpa_ssid *current_ssid;
  404. struct wpa_ssid *last_ssid;
  405. struct wpa_bss *current_bss;
  406. int ap_ies_from_associnfo;
  407. unsigned int assoc_freq;
  408. /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
  409. int pairwise_cipher;
  410. int group_cipher;
  411. int key_mgmt;
  412. int wpa_proto;
  413. int mgmt_group_cipher;
  414. void *drv_priv; /* private data used by driver_ops */
  415. void *global_drv_priv;
  416. u8 *bssid_filter;
  417. size_t bssid_filter_count;
  418. u8 *disallow_aps_bssid;
  419. size_t disallow_aps_bssid_count;
  420. struct wpa_ssid_value *disallow_aps_ssid;
  421. size_t disallow_aps_ssid_count;
  422. enum { WPA_SETBAND_AUTO, WPA_SETBAND_5G, WPA_SETBAND_2G } setband;
  423. /* Preferred network for the next connection attempt */
  424. struct wpa_ssid *next_ssid;
  425. /* previous scan was wildcard when interleaving between
  426. * wildcard scans and specific SSID scan when max_ssids=1 */
  427. int prev_scan_wildcard;
  428. struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
  429. * NULL = not yet initialized (start
  430. * with wildcard SSID)
  431. * WILDCARD_SSID_SCAN = wildcard
  432. * SSID was used in the previous scan
  433. */
  434. #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
  435. struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
  436. int sched_scan_timeout;
  437. int sched_scan_interval;
  438. int first_sched_scan;
  439. int sched_scan_timed_out;
  440. void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
  441. struct wpa_scan_results *scan_res);
  442. struct dl_list bss; /* struct wpa_bss::list */
  443. struct dl_list bss_id; /* struct wpa_bss::list_id */
  444. size_t num_bss;
  445. unsigned int bss_update_idx;
  446. unsigned int bss_next_id;
  447. /*
  448. * Pointers to BSS entries in the order they were in the last scan
  449. * results.
  450. */
  451. struct wpa_bss **last_scan_res;
  452. unsigned int last_scan_res_used;
  453. unsigned int last_scan_res_size;
  454. struct os_reltime last_scan;
  455. struct wpa_driver_ops *driver;
  456. int interface_removed; /* whether the network interface has been
  457. * removed */
  458. struct wpa_sm *wpa;
  459. struct eapol_sm *eapol;
  460. struct ctrl_iface_priv *ctrl_iface;
  461. enum wpa_states wpa_state;
  462. struct wpa_radio_work *scan_work;
  463. int scanning;
  464. int sched_scanning;
  465. int new_connection;
  466. int eapol_received; /* number of EAPOL packets received after the
  467. * previous association event */
  468. struct scard_data *scard;
  469. char imsi[20];
  470. int mnc_len;
  471. unsigned char last_eapol_src[ETH_ALEN];
  472. unsigned int keys_cleared; /* bitfield of key indexes that the driver is
  473. * known not to be configured with a key */
  474. struct wpa_blacklist *blacklist;
  475. /**
  476. * extra_blacklist_count - Sum of blacklist counts after last connection
  477. *
  478. * This variable is used to maintain a count of temporary blacklisting
  479. * failures (maximum number for any BSS) over blacklist clear
  480. * operations. This is needed for figuring out whether there has been
  481. * failures prior to the last blacklist clear operation which happens
  482. * whenever no other not-blacklisted BSS candidates are available. This
  483. * gets cleared whenever a connection has been established successfully.
  484. */
  485. int extra_blacklist_count;
  486. /**
  487. * scan_req - Type of the scan request
  488. */
  489. enum scan_req_type {
  490. /**
  491. * NORMAL_SCAN_REQ - Normal scan request
  492. *
  493. * This is used for scans initiated by wpa_supplicant to find an
  494. * AP for a connection.
  495. */
  496. NORMAL_SCAN_REQ,
  497. /**
  498. * INITIAL_SCAN_REQ - Initial scan request
  499. *
  500. * This is used for the first scan on an interface to force at
  501. * least one scan to be run even if the configuration does not
  502. * include any enabled networks.
  503. */
  504. INITIAL_SCAN_REQ,
  505. /**
  506. * MANUAL_SCAN_REQ - Manual scan request
  507. *
  508. * This is used for scans where the user request a scan or
  509. * a specific wpa_supplicant operation (e.g., WPS) requires scan
  510. * to be run.
  511. */
  512. MANUAL_SCAN_REQ
  513. } scan_req, last_scan_req;
  514. enum wpa_states scan_prev_wpa_state;
  515. struct os_reltime scan_trigger_time, scan_start_time;
  516. int scan_runs; /* number of scan runs since WPS was started */
  517. int *next_scan_freqs;
  518. int *manual_scan_freqs;
  519. int *manual_sched_scan_freqs;
  520. unsigned int manual_scan_passive:1;
  521. unsigned int manual_scan_use_id:1;
  522. unsigned int manual_scan_only_new:1;
  523. unsigned int own_scan_requested:1;
  524. unsigned int own_scan_running:1;
  525. unsigned int clear_driver_scan_cache:1;
  526. unsigned int manual_scan_id;
  527. int scan_interval; /* time in sec between scans to find suitable AP */
  528. int normal_scans; /* normal scans run before sched_scan */
  529. int scan_for_connection; /* whether the scan request was triggered for
  530. * finding a connection */
  531. #define MAX_SCAN_ID 16
  532. int scan_id[MAX_SCAN_ID];
  533. unsigned int scan_id_count;
  534. u64 drv_flags;
  535. unsigned int drv_enc;
  536. unsigned int drv_smps_modes;
  537. unsigned int drv_rrm_flags;
  538. /*
  539. * A bitmap of supported protocols for probe response offload. See
  540. * struct wpa_driver_capa in driver.h
  541. */
  542. unsigned int probe_resp_offloads;
  543. /* extended capabilities supported by the driver */
  544. const u8 *extended_capa, *extended_capa_mask;
  545. unsigned int extended_capa_len;
  546. int max_scan_ssids;
  547. int max_sched_scan_ssids;
  548. int sched_scan_supported;
  549. unsigned int max_match_sets;
  550. unsigned int max_remain_on_chan;
  551. unsigned int max_stations;
  552. int pending_mic_error_report;
  553. int pending_mic_error_pairwise;
  554. int mic_errors_seen; /* Michael MIC errors with the current PTK */
  555. struct wps_context *wps;
  556. int wps_success; /* WPS success event received */
  557. struct wps_er *wps_er;
  558. unsigned int wps_run;
  559. int blacklist_cleared;
  560. struct wpabuf *pending_eapol_rx;
  561. struct os_reltime pending_eapol_rx_time;
  562. u8 pending_eapol_rx_src[ETH_ALEN];
  563. unsigned int last_eapol_matches_bssid:1;
  564. unsigned int eap_expected_failure:1;
  565. unsigned int reattach:1; /* reassociation to the same BSS requested */
  566. unsigned int mac_addr_changed:1;
  567. unsigned int added_vif:1;
  568. struct os_reltime last_mac_addr_change;
  569. int last_mac_addr_style;
  570. struct ibss_rsn *ibss_rsn;
  571. int set_sta_uapsd;
  572. int sta_uapsd;
  573. int set_ap_uapsd;
  574. int ap_uapsd;
  575. #ifdef CONFIG_SME
  576. struct {
  577. u8 ssid[32];
  578. size_t ssid_len;
  579. int freq;
  580. u8 assoc_req_ie[200];
  581. size_t assoc_req_ie_len;
  582. int mfp;
  583. int ft_used;
  584. u8 mobility_domain[2];
  585. u8 *ft_ies;
  586. size_t ft_ies_len;
  587. u8 prev_bssid[ETH_ALEN];
  588. int prev_bssid_set;
  589. int auth_alg;
  590. int proto;
  591. int sa_query_count; /* number of pending SA Query requests;
  592. * 0 = no SA Query in progress */
  593. int sa_query_timed_out;
  594. u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
  595. * sa_query_count octets of pending
  596. * SA Query transaction identifiers */
  597. struct os_reltime sa_query_start;
  598. struct os_reltime last_unprot_disconnect;
  599. enum { HT_SEC_CHAN_UNKNOWN,
  600. HT_SEC_CHAN_ABOVE,
  601. HT_SEC_CHAN_BELOW } ht_sec_chan;
  602. u8 sched_obss_scan;
  603. u16 obss_scan_int;
  604. u16 bss_max_idle_period;
  605. #ifdef CONFIG_SAE
  606. struct sae_data sae;
  607. struct wpabuf *sae_token;
  608. int sae_group_index;
  609. unsigned int sae_pmksa_caching:1;
  610. #endif /* CONFIG_SAE */
  611. } sme;
  612. #endif /* CONFIG_SME */
  613. #ifdef CONFIG_AP
  614. struct hostapd_iface *ap_iface;
  615. void (*ap_configured_cb)(void *ctx, void *data);
  616. void *ap_configured_cb_ctx;
  617. void *ap_configured_cb_data;
  618. #endif /* CONFIG_AP */
  619. struct hostapd_iface *ifmsh;
  620. #ifdef CONFIG_MESH
  621. struct mesh_rsn *mesh_rsn;
  622. int mesh_if_idx;
  623. unsigned int mesh_if_created:1;
  624. unsigned int mesh_ht_enabled:1;
  625. int mesh_auth_block_duration; /* sec */
  626. #endif /* CONFIG_MESH */
  627. unsigned int off_channel_freq;
  628. struct wpabuf *pending_action_tx;
  629. u8 pending_action_src[ETH_ALEN];
  630. u8 pending_action_dst[ETH_ALEN];
  631. u8 pending_action_bssid[ETH_ALEN];
  632. unsigned int pending_action_freq;
  633. int pending_action_no_cck;
  634. int pending_action_without_roc;
  635. unsigned int pending_action_tx_done:1;
  636. void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
  637. unsigned int freq, const u8 *dst,
  638. const u8 *src, const u8 *bssid,
  639. const u8 *data, size_t data_len,
  640. enum offchannel_send_action_result
  641. result);
  642. unsigned int roc_waiting_drv_freq;
  643. int action_tx_wait_time;
  644. int p2p_mgmt;
  645. #ifdef CONFIG_P2P
  646. struct wpa_supplicant *p2p_dev;
  647. struct p2p_go_neg_results *go_params;
  648. int create_p2p_iface;
  649. u8 pending_interface_addr[ETH_ALEN];
  650. char pending_interface_name[100];
  651. int pending_interface_type;
  652. int p2p_group_idx;
  653. unsigned int pending_listen_freq;
  654. unsigned int pending_listen_duration;
  655. enum {
  656. NOT_P2P_GROUP_INTERFACE,
  657. P2P_GROUP_INTERFACE_PENDING,
  658. P2P_GROUP_INTERFACE_GO,
  659. P2P_GROUP_INTERFACE_CLIENT
  660. } p2p_group_interface;
  661. struct p2p_group *p2p_group;
  662. int p2p_long_listen; /* remaining time in long Listen state in ms */
  663. char p2p_pin[10];
  664. int p2p_wps_method;
  665. u8 p2p_auth_invite[ETH_ALEN];
  666. int p2p_sd_over_ctrl_iface;
  667. int p2p_in_provisioning;
  668. int p2p_in_invitation;
  669. int p2p_invite_go_freq;
  670. int pending_invite_ssid_id;
  671. int show_group_started;
  672. u8 go_dev_addr[ETH_ALEN];
  673. int pending_pd_before_join;
  674. u8 pending_join_iface_addr[ETH_ALEN];
  675. u8 pending_join_dev_addr[ETH_ALEN];
  676. int pending_join_wps_method;
  677. u8 p2p_join_ssid[32];
  678. size_t p2p_join_ssid_len;
  679. int p2p_join_scan_count;
  680. int auto_pd_scan_retry;
  681. int force_long_sd;
  682. u16 pending_pd_config_methods;
  683. enum {
  684. NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN, AUTO_PD_ASP
  685. } pending_pd_use;
  686. /*
  687. * Whether cross connection is disallowed by the AP to which this
  688. * interface is associated (only valid if there is an association).
  689. */
  690. int cross_connect_disallowed;
  691. /*
  692. * Whether this P2P group is configured to use cross connection (only
  693. * valid if this is P2P GO interface). The actual cross connect packet
  694. * forwarding may not be configured depending on the uplink status.
  695. */
  696. int cross_connect_enabled;
  697. /* Whether cross connection forwarding is in use at the moment. */
  698. int cross_connect_in_use;
  699. /*
  700. * Uplink interface name for cross connection
  701. */
  702. char cross_connect_uplink[100];
  703. unsigned int p2p_auto_join:1;
  704. unsigned int p2p_auto_pd:1;
  705. unsigned int p2p_persistent_group:1;
  706. unsigned int p2p_fallback_to_go_neg:1;
  707. unsigned int p2p_pd_before_go_neg:1;
  708. unsigned int p2p_go_ht40:1;
  709. unsigned int p2p_go_vht:1;
  710. unsigned int user_initiated_pd:1;
  711. unsigned int p2p_go_group_formation_completed:1;
  712. unsigned int group_formation_reported:1;
  713. unsigned int waiting_presence_resp;
  714. int p2p_first_connection_timeout;
  715. unsigned int p2p_nfc_tag_enabled:1;
  716. unsigned int p2p_peer_oob_pk_hash_known:1;
  717. unsigned int p2p_disable_ip_addr_req:1;
  718. unsigned int p2ps_join_addr_valid:1;
  719. int p2p_persistent_go_freq;
  720. int p2p_persistent_id;
  721. int p2p_go_intent;
  722. int p2p_connect_freq;
  723. struct os_reltime p2p_auto_started;
  724. struct wpa_ssid *p2p_last_4way_hs_fail;
  725. struct wpa_radio_work *p2p_scan_work;
  726. struct wpa_radio_work *p2p_listen_work;
  727. struct wpa_radio_work *p2p_send_action_work;
  728. u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
  729. struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
  730. * formation */
  731. u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
  732. u8 p2p_ip_addr_info[3 * 4];
  733. /* group common frequencies */
  734. int *p2p_group_common_freqs;
  735. unsigned int p2p_group_common_freqs_num;
  736. u8 p2ps_join_addr[ETH_ALEN];
  737. #endif /* CONFIG_P2P */
  738. struct wpa_ssid *bgscan_ssid;
  739. const struct bgscan_ops *bgscan;
  740. void *bgscan_priv;
  741. const struct autoscan_ops *autoscan;
  742. struct wpa_driver_scan_params *autoscan_params;
  743. void *autoscan_priv;
  744. struct wpa_ssid *connect_without_scan;
  745. struct wps_ap_info *wps_ap;
  746. size_t num_wps_ap;
  747. int wps_ap_iter;
  748. int after_wps;
  749. int known_wps_freq;
  750. unsigned int wps_freq;
  751. int wps_fragment_size;
  752. int auto_reconnect_disabled;
  753. /* Channel preferences for AP/P2P GO use */
  754. int best_24_freq;
  755. int best_5_freq;
  756. int best_overall_freq;
  757. struct gas_query *gas;
  758. #ifdef CONFIG_INTERWORKING
  759. unsigned int fetch_anqp_in_progress:1;
  760. unsigned int network_select:1;
  761. unsigned int auto_select:1;
  762. unsigned int auto_network_select:1;
  763. unsigned int interworking_fast_assoc_tried:1;
  764. unsigned int fetch_all_anqp:1;
  765. unsigned int fetch_osu_info:1;
  766. unsigned int fetch_osu_waiting_scan:1;
  767. unsigned int fetch_osu_icon_in_progress:1;
  768. struct wpa_bss *interworking_gas_bss;
  769. unsigned int osu_icon_id;
  770. struct osu_provider *osu_prov;
  771. size_t osu_prov_count;
  772. struct os_reltime osu_icon_fetch_start;
  773. unsigned int num_osu_scans;
  774. unsigned int num_prov_found;
  775. #endif /* CONFIG_INTERWORKING */
  776. unsigned int drv_capa_known;
  777. struct {
  778. struct hostapd_hw_modes *modes;
  779. u16 num_modes;
  780. u16 flags;
  781. } hw;
  782. enum local_hw_capab {
  783. CAPAB_NO_HT_VHT,
  784. CAPAB_HT,
  785. CAPAB_HT40,
  786. CAPAB_VHT,
  787. } hw_capab;
  788. #ifdef CONFIG_MACSEC
  789. struct ieee802_1x_kay *kay;
  790. #endif /* CONFIG_MACSEC */
  791. int pno;
  792. int pno_sched_pending;
  793. /* WLAN_REASON_* reason codes. Negative if locally generated. */
  794. int disconnect_reason;
  795. struct ext_password_data *ext_pw;
  796. struct wpabuf *last_gas_resp, *prev_gas_resp;
  797. u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
  798. u8 last_gas_dialog_token, prev_gas_dialog_token;
  799. unsigned int no_keep_alive:1;
  800. unsigned int ext_mgmt_frame_handling:1;
  801. unsigned int ext_eapol_frame_io:1;
  802. unsigned int wmm_ac_supported:1;
  803. unsigned int ext_work_in_progress:1;
  804. unsigned int own_disconnect_req:1;
  805. #define MAC_ADDR_RAND_SCAN BIT(0)
  806. #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)
  807. #define MAC_ADDR_RAND_PNO BIT(2)
  808. #define MAC_ADDR_RAND_ALL (MAC_ADDR_RAND_SCAN | \
  809. MAC_ADDR_RAND_SCHED_SCAN | \
  810. MAC_ADDR_RAND_PNO)
  811. unsigned int mac_addr_rand_supported;
  812. unsigned int mac_addr_rand_enable;
  813. /* MAC Address followed by mask (2 * ETH_ALEN) */
  814. u8 *mac_addr_scan;
  815. u8 *mac_addr_sched_scan;
  816. u8 *mac_addr_pno;
  817. #ifdef CONFIG_WNM
  818. u8 wnm_dialog_token;
  819. u8 wnm_reply;
  820. u8 wnm_num_neighbor_report;
  821. u8 wnm_mode;
  822. u16 wnm_dissoc_timer;
  823. u8 wnm_bss_termination_duration[12];
  824. struct neighbor_report *wnm_neighbor_report_elements;
  825. struct os_reltime wnm_cand_valid_until;
  826. u8 wnm_cand_from_bss[ETH_ALEN];
  827. #endif /* CONFIG_WNM */
  828. #ifdef CONFIG_TESTING_GET_GTK
  829. u8 last_gtk[32];
  830. size_t last_gtk_len;
  831. #endif /* CONFIG_TESTING_GET_GTK */
  832. unsigned int num_multichan_concurrent;
  833. struct wpa_radio_work *connect_work;
  834. unsigned int ext_work_id;
  835. struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
  836. #ifdef CONFIG_TESTING_OPTIONS
  837. struct l2_packet_data *l2_test;
  838. unsigned int extra_roc_dur;
  839. enum wpa_supplicant_test_failure test_failure;
  840. #endif /* CONFIG_TESTING_OPTIONS */
  841. struct wmm_ac_assoc_data *wmm_ac_assoc_info;
  842. struct wmm_tspec_element *tspecs[WMM_AC_NUM][TS_DIR_IDX_COUNT];
  843. struct wmm_ac_addts_request *addts_request;
  844. u8 wmm_ac_last_dialog_token;
  845. struct wmm_tspec_element *last_tspecs;
  846. u8 last_tspecs_count;
  847. struct rrm_data rrm;
  848. };
  849. /* wpa_supplicant.c */
  850. void wpa_supplicant_apply_ht_overrides(
  851. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  852. struct wpa_driver_associate_params *params);
  853. void wpa_supplicant_apply_vht_overrides(
  854. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  855. struct wpa_driver_associate_params *params);
  856. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  857. int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
  858. struct wpa_ssid *ssid);
  859. int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
  860. const char * wpa_supplicant_state_txt(enum wpa_states state);
  861. int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
  862. int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
  863. int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
  864. struct wpa_bss *bss, struct wpa_ssid *ssid,
  865. u8 *wpa_ie, size_t *wpa_ie_len);
  866. void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
  867. struct wpa_bss *bss,
  868. struct wpa_ssid *ssid);
  869. void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
  870. struct wpa_ssid *ssid);
  871. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
  872. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  873. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  874. int sec, int usec);
  875. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  876. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  877. enum wpa_states state);
  878. struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
  879. const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
  880. void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
  881. void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
  882. int reason_code);
  883. void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
  884. struct wpa_ssid *ssid);
  885. void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
  886. struct wpa_ssid *ssid);
  887. void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
  888. struct wpa_ssid *ssid);
  889. int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
  890. const char *pkcs11_engine_path,
  891. const char *pkcs11_module_path);
  892. int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
  893. int ap_scan);
  894. int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
  895. unsigned int expire_age);
  896. int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
  897. unsigned int expire_count);
  898. int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
  899. int scan_interval);
  900. int wpa_supplicant_set_debug_params(struct wpa_global *global,
  901. int debug_level, int debug_timestamp,
  902. int debug_show_keys);
  903. void free_hw_features(struct wpa_supplicant *wpa_s);
  904. void wpa_show_license(void);
  905. struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
  906. struct wpa_interface *iface,
  907. struct wpa_supplicant *parent);
  908. int wpa_supplicant_remove_iface(struct wpa_global *global,
  909. struct wpa_supplicant *wpa_s,
  910. int terminate);
  911. struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
  912. const char *ifname);
  913. struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
  914. int wpa_supplicant_run(struct wpa_global *global);
  915. void wpa_supplicant_deinit(struct wpa_global *global);
  916. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  917. struct wpa_ssid *ssid);
  918. void wpa_supplicant_terminate_proc(struct wpa_global *global);
  919. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  920. const u8 *buf, size_t len);
  921. void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
  922. void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
  923. void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  924. int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
  925. int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
  926. void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
  927. void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
  928. struct wpa_ssid *ssid, int clear_failures);
  929. int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
  930. int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
  931. size_t ssid_len);
  932. void wpas_request_connection(struct wpa_supplicant *wpa_s);
  933. int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
  934. int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
  935. int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
  936. void add_freq(int *freqs, int *num_freqs, int freq);
  937. void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
  938. void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
  939. const u8 *report, size_t report_len);
  940. int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
  941. const struct wpa_ssid *ssid,
  942. void (*cb)(void *ctx,
  943. struct wpabuf *neighbor_rep),
  944. void *cb_ctx);
  945. void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
  946. const u8 *src,
  947. const u8 *frame, size_t len,
  948. int rssi);
  949. /**
  950. * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
  951. * @wpa_s: Pointer to wpa_supplicant data
  952. * @ssid: Pointer to the network block the reply is for
  953. * @field: field the response is a reply for
  954. * @value: value (ie, password, etc) for @field
  955. * Returns: 0 on success, non-zero on error
  956. *
  957. * Helper function to handle replies to control interface requests.
  958. */
  959. int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
  960. struct wpa_ssid *ssid,
  961. const char *field,
  962. const char *value);
  963. void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
  964. const struct wpa_ssid *ssid,
  965. struct hostapd_freq_params *freq);
  966. /* events.c */
  967. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
  968. int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
  969. struct wpa_bss *selected,
  970. struct wpa_ssid *ssid);
  971. void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
  972. void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
  973. void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
  974. int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
  975. struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
  976. struct wpa_ssid **selected_ssid);
  977. /* eap_register.c */
  978. int eap_register_methods(void);
  979. /**
  980. * Utility method to tell if a given network is a persistent group
  981. * @ssid: Network object
  982. * Returns: 1 if network is a persistent group, 0 otherwise
  983. */
  984. static inline int network_is_persistent_group(struct wpa_ssid *ssid)
  985. {
  986. return ((ssid->disabled == 2) || ssid->p2p_persistent_group);
  987. }
  988. int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  989. int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  990. int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
  991. void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
  992. struct wpa_used_freq_data *freqs_data,
  993. unsigned int len);
  994. int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
  995. struct wpa_used_freq_data *freqs_data,
  996. unsigned int len);
  997. int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
  998. int *freq_array, unsigned int len);
  999. void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx);
  1000. #endif /* WPA_SUPPLICANT_I_H */