wpa_supplicant_i.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440
  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/bitfield.h"
  11. #include "utils/list.h"
  12. #include "common/defs.h"
  13. #include "common/sae.h"
  14. #include "common/wpa_ctrl.h"
  15. #include "wps/wps_defs.h"
  16. #include "config_ssid.h"
  17. #include "wmm_ac.h"
  18. extern const char *const wpa_supplicant_version;
  19. extern const char *const wpa_supplicant_license;
  20. #ifndef CONFIG_NO_STDOUT_DEBUG
  21. extern const char *const wpa_supplicant_full_license1;
  22. extern const char *const wpa_supplicant_full_license2;
  23. extern const char *const wpa_supplicant_full_license3;
  24. extern const char *const wpa_supplicant_full_license4;
  25. extern const char *const wpa_supplicant_full_license5;
  26. #endif /* CONFIG_NO_STDOUT_DEBUG */
  27. struct wpa_sm;
  28. struct wpa_supplicant;
  29. struct ibss_rsn;
  30. struct scan_info;
  31. struct wpa_bss;
  32. struct wpa_scan_results;
  33. struct hostapd_hw_modes;
  34. struct wpa_driver_associate_params;
  35. /*
  36. * Forward declarations of private structures used within the ctrl_iface
  37. * backends. Other parts of wpa_supplicant do not have access to data stored in
  38. * these structures.
  39. */
  40. struct ctrl_iface_priv;
  41. struct ctrl_iface_global_priv;
  42. struct wpas_dbus_priv;
  43. struct wpas_binder_priv;
  44. /**
  45. * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
  46. */
  47. struct wpa_interface {
  48. /**
  49. * confname - Configuration name (file or profile) name
  50. *
  51. * This can also be %NULL when a configuration file is not used. In
  52. * that case, ctrl_interface must be set to allow the interface to be
  53. * configured.
  54. */
  55. const char *confname;
  56. /**
  57. * confanother - Additional configuration name (file or profile) name
  58. *
  59. * This can also be %NULL when the additional configuration file is not
  60. * used.
  61. */
  62. const char *confanother;
  63. /**
  64. * ctrl_interface - Control interface parameter
  65. *
  66. * If a configuration file is not used, this variable can be used to
  67. * set the ctrl_interface parameter that would have otherwise been read
  68. * from the configuration file. If both confname and ctrl_interface are
  69. * set, ctrl_interface is used to override the value from configuration
  70. * file.
  71. */
  72. const char *ctrl_interface;
  73. /**
  74. * driver - Driver interface name, or %NULL to use the default driver
  75. */
  76. const char *driver;
  77. /**
  78. * driver_param - Driver interface parameters
  79. *
  80. * If a configuration file is not used, this variable can be used to
  81. * set the driver_param parameters that would have otherwise been read
  82. * from the configuration file. If both confname and driver_param are
  83. * set, driver_param is used to override the value from configuration
  84. * file.
  85. */
  86. const char *driver_param;
  87. /**
  88. * ifname - Interface name
  89. */
  90. const char *ifname;
  91. /**
  92. * bridge_ifname - Optional bridge interface name
  93. *
  94. * If the driver interface (ifname) is included in a Linux bridge
  95. * device, the bridge interface may need to be used for receiving EAPOL
  96. * frames. This can be enabled by setting this variable to enable
  97. * receiving of EAPOL frames from an additional interface.
  98. */
  99. const char *bridge_ifname;
  100. /**
  101. * p2p_mgmt - Interface used for P2P management (P2P Device operations)
  102. *
  103. * Indicates whether wpas_p2p_init() must be called for this interface.
  104. * This is used only when the driver supports a dedicated P2P Device
  105. * interface that is not a network interface.
  106. */
  107. int p2p_mgmt;
  108. };
  109. /**
  110. * struct wpa_params - Parameters for wpa_supplicant_init()
  111. */
  112. struct wpa_params {
  113. /**
  114. * daemonize - Run %wpa_supplicant in the background
  115. */
  116. int daemonize;
  117. /**
  118. * wait_for_monitor - Wait for a monitor program before starting
  119. */
  120. int wait_for_monitor;
  121. /**
  122. * pid_file - Path to a PID (process ID) file
  123. *
  124. * If this and daemonize are set, process ID of the background process
  125. * will be written to the specified file.
  126. */
  127. char *pid_file;
  128. /**
  129. * wpa_debug_level - Debugging verbosity level (e.g., MSG_INFO)
  130. */
  131. int wpa_debug_level;
  132. /**
  133. * wpa_debug_show_keys - Whether keying material is included in debug
  134. *
  135. * This parameter can be used to allow keying material to be included
  136. * in debug messages. This is a security risk and this option should
  137. * not be enabled in normal configuration. If needed during
  138. * development or while troubleshooting, this option can provide more
  139. * details for figuring out what is happening.
  140. */
  141. int wpa_debug_show_keys;
  142. /**
  143. * wpa_debug_timestamp - Whether to include timestamp in debug messages
  144. */
  145. int wpa_debug_timestamp;
  146. /**
  147. * ctrl_interface - Global ctrl_iface path/parameter
  148. */
  149. char *ctrl_interface;
  150. /**
  151. * ctrl_interface_group - Global ctrl_iface group
  152. */
  153. char *ctrl_interface_group;
  154. /**
  155. * dbus_ctrl_interface - Enable the DBus control interface
  156. */
  157. int dbus_ctrl_interface;
  158. /**
  159. * wpa_debug_file_path - Path of debug file or %NULL to use stdout
  160. */
  161. const char *wpa_debug_file_path;
  162. /**
  163. * wpa_debug_syslog - Enable log output through syslog
  164. */
  165. int wpa_debug_syslog;
  166. /**
  167. * wpa_debug_tracing - Enable log output through Linux tracing
  168. */
  169. int wpa_debug_tracing;
  170. /**
  171. * override_driver - Optional driver parameter override
  172. *
  173. * This parameter can be used to override the driver parameter in
  174. * dynamic interface addition to force a specific driver wrapper to be
  175. * used instead.
  176. */
  177. char *override_driver;
  178. /**
  179. * override_ctrl_interface - Optional ctrl_interface override
  180. *
  181. * This parameter can be used to override the ctrl_interface parameter
  182. * in dynamic interface addition to force a control interface to be
  183. * created.
  184. */
  185. char *override_ctrl_interface;
  186. /**
  187. * entropy_file - Optional entropy file
  188. *
  189. * This parameter can be used to configure wpa_supplicant to maintain
  190. * its internal entropy store over restarts.
  191. */
  192. char *entropy_file;
  193. #ifdef CONFIG_P2P
  194. /**
  195. * conf_p2p_dev - Configuration file used to hold the
  196. * P2P Device configuration parameters.
  197. *
  198. * This can also be %NULL. In such a case, if a P2P Device dedicated
  199. * interfaces is created, the main configuration file will be used.
  200. */
  201. char *conf_p2p_dev;
  202. #endif /* CONFIG_P2P */
  203. #ifdef CONFIG_MATCH_IFACE
  204. /**
  205. * match_ifaces - Interface descriptions to match
  206. */
  207. struct wpa_interface *match_ifaces;
  208. /**
  209. * match_iface_count - Number of defined matching interfaces
  210. */
  211. int match_iface_count;
  212. #endif /* CONFIG_MATCH_IFACE */
  213. };
  214. struct p2p_srv_bonjour {
  215. struct dl_list list;
  216. struct wpabuf *query;
  217. struct wpabuf *resp;
  218. };
  219. struct p2p_srv_upnp {
  220. struct dl_list list;
  221. u8 version;
  222. char *service;
  223. };
  224. /**
  225. * struct wpa_global - Internal, global data for all %wpa_supplicant interfaces
  226. *
  227. * This structure is initialized by calling wpa_supplicant_init() when starting
  228. * %wpa_supplicant.
  229. */
  230. struct wpa_global {
  231. struct wpa_supplicant *ifaces;
  232. struct wpa_params params;
  233. struct ctrl_iface_global_priv *ctrl_iface;
  234. struct wpas_dbus_priv *dbus;
  235. struct wpas_binder_priv *binder;
  236. void **drv_priv;
  237. size_t drv_count;
  238. struct os_time suspend_time;
  239. struct p2p_data *p2p;
  240. struct wpa_supplicant *p2p_init_wpa_s;
  241. struct wpa_supplicant *p2p_group_formation;
  242. struct wpa_supplicant *p2p_invite_group;
  243. u8 p2p_dev_addr[ETH_ALEN];
  244. struct os_reltime p2p_go_wait_client;
  245. struct dl_list p2p_srv_bonjour; /* struct p2p_srv_bonjour */
  246. struct dl_list p2p_srv_upnp; /* struct p2p_srv_upnp */
  247. int p2p_disabled;
  248. int cross_connection;
  249. struct wpa_freq_range_list p2p_disallow_freq;
  250. struct wpa_freq_range_list p2p_go_avoid_freq;
  251. enum wpa_conc_pref {
  252. WPA_CONC_PREF_NOT_SET,
  253. WPA_CONC_PREF_STA,
  254. WPA_CONC_PREF_P2P
  255. } conc_pref;
  256. unsigned int p2p_per_sta_psk:1;
  257. unsigned int p2p_fail_on_wps_complete:1;
  258. unsigned int p2p_24ghz_social_channels:1;
  259. unsigned int pending_p2ps_group:1;
  260. unsigned int pending_group_iface_for_p2ps:1;
  261. unsigned int pending_p2ps_group_freq;
  262. #ifdef CONFIG_WIFI_DISPLAY
  263. int wifi_display;
  264. #define MAX_WFD_SUBELEMS 12
  265. struct wpabuf *wfd_subelem[MAX_WFD_SUBELEMS];
  266. #endif /* CONFIG_WIFI_DISPLAY */
  267. struct psk_list_entry *add_psk; /* From group formation */
  268. };
  269. /**
  270. * struct wpa_radio - Internal data for per-radio information
  271. *
  272. * This structure is used to share data about configured interfaces
  273. * (struct wpa_supplicant) that share the same physical radio, e.g., to allow
  274. * better coordination of offchannel operations.
  275. */
  276. struct wpa_radio {
  277. char name[16]; /* from driver_ops get_radio_name() or empty if not
  278. * available */
  279. unsigned int external_scan_running:1;
  280. unsigned int num_active_works;
  281. struct dl_list ifaces; /* struct wpa_supplicant::radio_list entries */
  282. struct dl_list work; /* struct wpa_radio_work::list entries */
  283. };
  284. #define MAX_ACTIVE_WORKS 2
  285. /**
  286. * struct wpa_radio_work - Radio work item
  287. */
  288. struct wpa_radio_work {
  289. struct dl_list list;
  290. unsigned int freq; /* known frequency (MHz) or 0 for multiple/unknown */
  291. const char *type;
  292. struct wpa_supplicant *wpa_s;
  293. void (*cb)(struct wpa_radio_work *work, int deinit);
  294. void *ctx;
  295. unsigned int started:1;
  296. struct os_reltime time;
  297. unsigned int bands;
  298. };
  299. int radio_add_work(struct wpa_supplicant *wpa_s, unsigned int freq,
  300. const char *type, int next,
  301. void (*cb)(struct wpa_radio_work *work, int deinit),
  302. void *ctx);
  303. void radio_work_done(struct wpa_radio_work *work);
  304. void radio_remove_works(struct wpa_supplicant *wpa_s,
  305. const char *type, int remove_all);
  306. void radio_work_check_next(struct wpa_supplicant *wpa_s);
  307. struct wpa_radio_work *
  308. radio_work_pending(struct wpa_supplicant *wpa_s, const char *type);
  309. struct wpa_connect_work {
  310. unsigned int sme:1;
  311. unsigned int bss_removed:1;
  312. struct wpa_bss *bss;
  313. struct wpa_ssid *ssid;
  314. };
  315. int wpas_valid_bss_ssid(struct wpa_supplicant *wpa_s, struct wpa_bss *test_bss,
  316. struct wpa_ssid *test_ssid);
  317. void wpas_connect_work_free(struct wpa_connect_work *cwork);
  318. void wpas_connect_work_done(struct wpa_supplicant *wpa_s);
  319. struct wpa_external_work {
  320. unsigned int id;
  321. char type[100];
  322. unsigned int timeout;
  323. };
  324. enum wpa_radio_work_band wpas_freq_to_band(int freq);
  325. unsigned int wpas_get_bands(struct wpa_supplicant *wpa_s, const int *freqs);
  326. /**
  327. * offchannel_send_action_result - Result of offchannel send Action frame
  328. */
  329. enum offchannel_send_action_result {
  330. OFFCHANNEL_SEND_ACTION_SUCCESS /**< Frame was send and acknowledged */,
  331. OFFCHANNEL_SEND_ACTION_NO_ACK /**< Frame was sent, but not acknowledged
  332. */,
  333. OFFCHANNEL_SEND_ACTION_FAILED /**< Frame was not sent due to a failure
  334. */
  335. };
  336. struct wps_ap_info {
  337. u8 bssid[ETH_ALEN];
  338. enum wps_ap_info_type {
  339. WPS_AP_NOT_SEL_REG,
  340. WPS_AP_SEL_REG,
  341. WPS_AP_SEL_REG_OUR
  342. } type;
  343. unsigned int tries;
  344. struct os_reltime last_attempt;
  345. unsigned int pbc_active;
  346. u8 uuid[WPS_UUID_LEN];
  347. };
  348. #define WPA_FREQ_USED_BY_INFRA_STATION BIT(0)
  349. #define WPA_FREQ_USED_BY_P2P_CLIENT BIT(1)
  350. struct wpa_used_freq_data {
  351. int freq;
  352. unsigned int flags;
  353. };
  354. #define RRM_NEIGHBOR_REPORT_TIMEOUT 1 /* 1 second for AP to send a report */
  355. /*
  356. * struct rrm_data - Data used for managing RRM features
  357. */
  358. struct rrm_data {
  359. /* rrm_used - indication regarding the current connection */
  360. unsigned int rrm_used:1;
  361. /*
  362. * notify_neighbor_rep - Callback for notifying report requester
  363. */
  364. void (*notify_neighbor_rep)(void *ctx, struct wpabuf *neighbor_rep);
  365. /*
  366. * neighbor_rep_cb_ctx - Callback context
  367. * Received in the callback registration, and sent to the callback
  368. * function as a parameter.
  369. */
  370. void *neighbor_rep_cb_ctx;
  371. /* next_neighbor_rep_token - Next request's dialog token */
  372. u8 next_neighbor_rep_token;
  373. /* token - Dialog token of the current radio measurement */
  374. u8 token;
  375. };
  376. enum wpa_supplicant_test_failure {
  377. WPAS_TEST_FAILURE_NONE,
  378. WPAS_TEST_FAILURE_SCAN_TRIGGER,
  379. };
  380. struct icon_entry {
  381. struct dl_list list;
  382. u8 bssid[ETH_ALEN];
  383. u8 dialog_token;
  384. char *file_name;
  385. u8 *image;
  386. size_t image_len;
  387. };
  388. struct wpa_bss_tmp_disallowed {
  389. struct dl_list list;
  390. u8 bssid[ETH_ALEN];
  391. };
  392. struct beacon_rep_data {
  393. u8 token;
  394. struct wpa_driver_scan_params scan_params;
  395. u8 ssid[SSID_MAX_LEN];
  396. size_t ssid_len;
  397. u8 bssid[ETH_ALEN];
  398. enum beacon_report_detail report_detail;
  399. struct bitfield *eids;
  400. };
  401. struct external_pmksa_cache {
  402. struct dl_list list;
  403. void *pmksa_cache;
  404. };
  405. struct fils_hlp_req {
  406. struct dl_list list;
  407. u8 dst[ETH_ALEN];
  408. struct wpabuf *pkt;
  409. };
  410. /**
  411. * struct wpa_supplicant - Internal data for wpa_supplicant interface
  412. *
  413. * This structure contains the internal data for core wpa_supplicant code. This
  414. * should be only used directly from the core code. However, a pointer to this
  415. * data is used from other files as an arbitrary context pointer in calls to
  416. * core functions.
  417. */
  418. struct wpa_supplicant {
  419. struct wpa_global *global;
  420. struct wpa_radio *radio; /* shared radio context */
  421. struct dl_list radio_list; /* list head: struct wpa_radio::ifaces */
  422. struct wpa_supplicant *parent;
  423. struct wpa_supplicant *p2pdev;
  424. struct wpa_supplicant *next;
  425. struct l2_packet_data *l2;
  426. struct l2_packet_data *l2_br;
  427. unsigned char own_addr[ETH_ALEN];
  428. unsigned char perm_addr[ETH_ALEN];
  429. char ifname[100];
  430. #ifdef CONFIG_MATCH_IFACE
  431. int matched;
  432. #endif /* CONFIG_MATCH_IFACE */
  433. #ifdef CONFIG_CTRL_IFACE_DBUS
  434. char *dbus_path;
  435. #endif /* CONFIG_CTRL_IFACE_DBUS */
  436. #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
  437. char *dbus_new_path;
  438. char *dbus_groupobj_path;
  439. #ifdef CONFIG_AP
  440. char *preq_notify_peer;
  441. #endif /* CONFIG_AP */
  442. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  443. #ifdef CONFIG_CTRL_IFACE_BINDER
  444. const void *binder_object_key;
  445. #endif /* CONFIG_CTRL_IFACE_BINDER */
  446. char bridge_ifname[16];
  447. char *confname;
  448. char *confanother;
  449. struct wpa_config *conf;
  450. int countermeasures;
  451. struct os_reltime last_michael_mic_error;
  452. u8 bssid[ETH_ALEN];
  453. u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
  454. * field contains the target BSSID. */
  455. int reassociate; /* reassociation requested */
  456. unsigned int reassoc_same_bss:1; /* reassociating to the same BSS */
  457. unsigned int reassoc_same_ess:1; /* reassociating to the same ESS */
  458. int disconnected; /* all connections disabled; i.e., do no reassociate
  459. * before this has been cleared */
  460. struct wpa_ssid *current_ssid;
  461. struct wpa_ssid *last_ssid;
  462. struct wpa_bss *current_bss;
  463. int ap_ies_from_associnfo;
  464. unsigned int assoc_freq;
  465. /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
  466. int pairwise_cipher;
  467. int group_cipher;
  468. int key_mgmt;
  469. int wpa_proto;
  470. int mgmt_group_cipher;
  471. void *drv_priv; /* private data used by driver_ops */
  472. void *global_drv_priv;
  473. u8 *bssid_filter;
  474. size_t bssid_filter_count;
  475. u8 *disallow_aps_bssid;
  476. size_t disallow_aps_bssid_count;
  477. struct wpa_ssid_value *disallow_aps_ssid;
  478. size_t disallow_aps_ssid_count;
  479. enum set_band setband;
  480. /* Preferred network for the next connection attempt */
  481. struct wpa_ssid *next_ssid;
  482. /* previous scan was wildcard when interleaving between
  483. * wildcard scans and specific SSID scan when max_ssids=1 */
  484. int prev_scan_wildcard;
  485. struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
  486. * NULL = not yet initialized (start
  487. * with wildcard SSID)
  488. * WILDCARD_SSID_SCAN = wildcard
  489. * SSID was used in the previous scan
  490. */
  491. #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
  492. struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
  493. int sched_scan_timeout;
  494. int first_sched_scan;
  495. int sched_scan_timed_out;
  496. struct sched_scan_plan *sched_scan_plans;
  497. size_t sched_scan_plans_num;
  498. void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
  499. struct wpa_scan_results *scan_res);
  500. struct dl_list bss; /* struct wpa_bss::list */
  501. struct dl_list bss_id; /* struct wpa_bss::list_id */
  502. size_t num_bss;
  503. unsigned int bss_update_idx;
  504. unsigned int bss_next_id;
  505. /*
  506. * Pointers to BSS entries in the order they were in the last scan
  507. * results.
  508. */
  509. struct wpa_bss **last_scan_res;
  510. unsigned int last_scan_res_used;
  511. unsigned int last_scan_res_size;
  512. struct os_reltime last_scan;
  513. const struct wpa_driver_ops *driver;
  514. int interface_removed; /* whether the network interface has been
  515. * removed */
  516. struct wpa_sm *wpa;
  517. struct eapol_sm *eapol;
  518. struct ctrl_iface_priv *ctrl_iface;
  519. enum wpa_states wpa_state;
  520. struct wpa_radio_work *scan_work;
  521. int scanning;
  522. int sched_scanning;
  523. unsigned int sched_scan_stop_req:1;
  524. int new_connection;
  525. int eapol_received; /* number of EAPOL packets received after the
  526. * previous association event */
  527. struct scard_data *scard;
  528. char imsi[20];
  529. int mnc_len;
  530. unsigned char last_eapol_src[ETH_ALEN];
  531. unsigned int keys_cleared; /* bitfield of key indexes that the driver is
  532. * known not to be configured with a key */
  533. struct wpa_blacklist *blacklist;
  534. /**
  535. * extra_blacklist_count - Sum of blacklist counts after last connection
  536. *
  537. * This variable is used to maintain a count of temporary blacklisting
  538. * failures (maximum number for any BSS) over blacklist clear
  539. * operations. This is needed for figuring out whether there has been
  540. * failures prior to the last blacklist clear operation which happens
  541. * whenever no other not-blacklisted BSS candidates are available. This
  542. * gets cleared whenever a connection has been established successfully.
  543. */
  544. int extra_blacklist_count;
  545. /**
  546. * scan_req - Type of the scan request
  547. */
  548. enum scan_req_type {
  549. /**
  550. * NORMAL_SCAN_REQ - Normal scan request
  551. *
  552. * This is used for scans initiated by wpa_supplicant to find an
  553. * AP for a connection.
  554. */
  555. NORMAL_SCAN_REQ,
  556. /**
  557. * INITIAL_SCAN_REQ - Initial scan request
  558. *
  559. * This is used for the first scan on an interface to force at
  560. * least one scan to be run even if the configuration does not
  561. * include any enabled networks.
  562. */
  563. INITIAL_SCAN_REQ,
  564. /**
  565. * MANUAL_SCAN_REQ - Manual scan request
  566. *
  567. * This is used for scans where the user request a scan or
  568. * a specific wpa_supplicant operation (e.g., WPS) requires scan
  569. * to be run.
  570. */
  571. MANUAL_SCAN_REQ
  572. } scan_req, last_scan_req;
  573. enum wpa_states scan_prev_wpa_state;
  574. struct os_reltime scan_trigger_time, scan_start_time;
  575. /* Minimum freshness requirement for connection purposes */
  576. struct os_reltime scan_min_time;
  577. int scan_runs; /* number of scan runs since WPS was started */
  578. int *next_scan_freqs;
  579. int *select_network_scan_freqs;
  580. int *manual_scan_freqs;
  581. int *manual_sched_scan_freqs;
  582. unsigned int manual_scan_passive:1;
  583. unsigned int manual_scan_use_id:1;
  584. unsigned int manual_scan_only_new:1;
  585. unsigned int own_scan_requested:1;
  586. unsigned int own_scan_running:1;
  587. unsigned int clear_driver_scan_cache:1;
  588. unsigned int manual_scan_id;
  589. int scan_interval; /* time in sec between scans to find suitable AP */
  590. int normal_scans; /* normal scans run before sched_scan */
  591. int scan_for_connection; /* whether the scan request was triggered for
  592. * finding a connection */
  593. /*
  594. * A unique cookie representing the vendor scan request. This cookie is
  595. * returned from the driver interface. 0 indicates that there is no
  596. * pending vendor scan request.
  597. */
  598. u64 curr_scan_cookie;
  599. #define MAX_SCAN_ID 16
  600. int scan_id[MAX_SCAN_ID];
  601. unsigned int scan_id_count;
  602. u8 next_scan_bssid[ETH_ALEN];
  603. struct wpa_ssid_value *ssids_from_scan_req;
  604. unsigned int num_ssids_from_scan_req;
  605. u64 drv_flags;
  606. unsigned int drv_enc;
  607. unsigned int drv_smps_modes;
  608. unsigned int drv_rrm_flags;
  609. /*
  610. * A bitmap of supported protocols for probe response offload. See
  611. * struct wpa_driver_capa in driver.h
  612. */
  613. unsigned int probe_resp_offloads;
  614. /* extended capabilities supported by the driver */
  615. const u8 *extended_capa, *extended_capa_mask;
  616. unsigned int extended_capa_len;
  617. int max_scan_ssids;
  618. int max_sched_scan_ssids;
  619. unsigned int max_sched_scan_plans;
  620. unsigned int max_sched_scan_plan_interval;
  621. unsigned int max_sched_scan_plan_iterations;
  622. int sched_scan_supported;
  623. unsigned int max_match_sets;
  624. unsigned int max_remain_on_chan;
  625. unsigned int max_stations;
  626. int pending_mic_error_report;
  627. int pending_mic_error_pairwise;
  628. int mic_errors_seen; /* Michael MIC errors with the current PTK */
  629. struct wps_context *wps;
  630. int wps_success; /* WPS success event received */
  631. struct wps_er *wps_er;
  632. unsigned int wps_run;
  633. struct os_reltime wps_pin_start_time;
  634. int blacklist_cleared;
  635. struct wpabuf *pending_eapol_rx;
  636. struct os_reltime pending_eapol_rx_time;
  637. u8 pending_eapol_rx_src[ETH_ALEN];
  638. unsigned int last_eapol_matches_bssid:1;
  639. unsigned int eap_expected_failure:1;
  640. unsigned int reattach:1; /* reassociation to the same BSS requested */
  641. unsigned int mac_addr_changed:1;
  642. unsigned int added_vif:1;
  643. unsigned int wnmsleep_used:1;
  644. struct os_reltime last_mac_addr_change;
  645. int last_mac_addr_style;
  646. struct ibss_rsn *ibss_rsn;
  647. int set_sta_uapsd;
  648. int sta_uapsd;
  649. int set_ap_uapsd;
  650. int ap_uapsd;
  651. int auth_alg;
  652. #ifdef CONFIG_SME
  653. struct {
  654. u8 ssid[SSID_MAX_LEN];
  655. size_t ssid_len;
  656. int freq;
  657. u8 assoc_req_ie[1500];
  658. size_t assoc_req_ie_len;
  659. int mfp;
  660. int ft_used;
  661. u8 mobility_domain[2];
  662. u8 *ft_ies;
  663. size_t ft_ies_len;
  664. u8 prev_bssid[ETH_ALEN];
  665. int prev_bssid_set;
  666. int auth_alg;
  667. int proto;
  668. int sa_query_count; /* number of pending SA Query requests;
  669. * 0 = no SA Query in progress */
  670. int sa_query_timed_out;
  671. u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
  672. * sa_query_count octets of pending
  673. * SA Query transaction identifiers */
  674. struct os_reltime sa_query_start;
  675. struct os_reltime last_unprot_disconnect;
  676. enum { HT_SEC_CHAN_UNKNOWN,
  677. HT_SEC_CHAN_ABOVE,
  678. HT_SEC_CHAN_BELOW } ht_sec_chan;
  679. u8 sched_obss_scan;
  680. u16 obss_scan_int;
  681. u16 bss_max_idle_period;
  682. #ifdef CONFIG_SAE
  683. struct sae_data sae;
  684. struct wpabuf *sae_token;
  685. int sae_group_index;
  686. unsigned int sae_pmksa_caching:1;
  687. #endif /* CONFIG_SAE */
  688. } sme;
  689. #endif /* CONFIG_SME */
  690. #ifdef CONFIG_AP
  691. struct hostapd_iface *ap_iface;
  692. void (*ap_configured_cb)(void *ctx, void *data);
  693. void *ap_configured_cb_ctx;
  694. void *ap_configured_cb_data;
  695. #endif /* CONFIG_AP */
  696. struct hostapd_iface *ifmsh;
  697. #ifdef CONFIG_MESH
  698. struct mesh_rsn *mesh_rsn;
  699. int mesh_if_idx;
  700. unsigned int mesh_if_created:1;
  701. unsigned int mesh_ht_enabled:1;
  702. unsigned int mesh_vht_enabled:1;
  703. #ifdef CONFIG_PMKSA_CACHE_EXTERNAL
  704. /* struct external_pmksa_cache::list */
  705. struct dl_list mesh_external_pmksa_cache;
  706. #endif /* CONFIG_PMKSA_CACHE_EXTERNAL */
  707. #endif /* CONFIG_MESH */
  708. unsigned int off_channel_freq;
  709. struct wpabuf *pending_action_tx;
  710. u8 pending_action_src[ETH_ALEN];
  711. u8 pending_action_dst[ETH_ALEN];
  712. u8 pending_action_bssid[ETH_ALEN];
  713. unsigned int pending_action_freq;
  714. int pending_action_no_cck;
  715. int pending_action_without_roc;
  716. unsigned int pending_action_tx_done:1;
  717. void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
  718. unsigned int freq, const u8 *dst,
  719. const u8 *src, const u8 *bssid,
  720. const u8 *data, size_t data_len,
  721. enum offchannel_send_action_result
  722. result);
  723. unsigned int roc_waiting_drv_freq;
  724. int action_tx_wait_time;
  725. int action_tx_wait_time_used;
  726. int p2p_mgmt;
  727. #ifdef CONFIG_P2P
  728. struct p2p_go_neg_results *go_params;
  729. int create_p2p_iface;
  730. u8 pending_interface_addr[ETH_ALEN];
  731. char pending_interface_name[100];
  732. int pending_interface_type;
  733. int p2p_group_idx;
  734. unsigned int pending_listen_freq;
  735. unsigned int pending_listen_duration;
  736. enum {
  737. NOT_P2P_GROUP_INTERFACE,
  738. P2P_GROUP_INTERFACE_PENDING,
  739. P2P_GROUP_INTERFACE_GO,
  740. P2P_GROUP_INTERFACE_CLIENT
  741. } p2p_group_interface;
  742. struct p2p_group *p2p_group;
  743. int p2p_long_listen; /* remaining time in long Listen state in ms */
  744. char p2p_pin[10];
  745. int p2p_wps_method;
  746. u8 p2p_auth_invite[ETH_ALEN];
  747. int p2p_sd_over_ctrl_iface;
  748. int p2p_in_provisioning;
  749. int p2p_in_invitation;
  750. int p2p_invite_go_freq;
  751. int pending_invite_ssid_id;
  752. int show_group_started;
  753. u8 go_dev_addr[ETH_ALEN];
  754. int pending_pd_before_join;
  755. u8 pending_join_iface_addr[ETH_ALEN];
  756. u8 pending_join_dev_addr[ETH_ALEN];
  757. int pending_join_wps_method;
  758. u8 p2p_join_ssid[SSID_MAX_LEN];
  759. size_t p2p_join_ssid_len;
  760. int p2p_join_scan_count;
  761. int auto_pd_scan_retry;
  762. int force_long_sd;
  763. u16 pending_pd_config_methods;
  764. enum {
  765. NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN, AUTO_PD_ASP
  766. } pending_pd_use;
  767. /*
  768. * Whether cross connection is disallowed by the AP to which this
  769. * interface is associated (only valid if there is an association).
  770. */
  771. int cross_connect_disallowed;
  772. /*
  773. * Whether this P2P group is configured to use cross connection (only
  774. * valid if this is P2P GO interface). The actual cross connect packet
  775. * forwarding may not be configured depending on the uplink status.
  776. */
  777. int cross_connect_enabled;
  778. /* Whether cross connection forwarding is in use at the moment. */
  779. int cross_connect_in_use;
  780. /*
  781. * Uplink interface name for cross connection
  782. */
  783. char cross_connect_uplink[100];
  784. unsigned int p2p_auto_join:1;
  785. unsigned int p2p_auto_pd:1;
  786. unsigned int p2p_persistent_group:1;
  787. unsigned int p2p_fallback_to_go_neg:1;
  788. unsigned int p2p_pd_before_go_neg:1;
  789. unsigned int p2p_go_ht40:1;
  790. unsigned int p2p_go_vht:1;
  791. unsigned int user_initiated_pd:1;
  792. unsigned int p2p_go_group_formation_completed:1;
  793. unsigned int group_formation_reported:1;
  794. unsigned int waiting_presence_resp;
  795. int p2p_first_connection_timeout;
  796. unsigned int p2p_nfc_tag_enabled:1;
  797. unsigned int p2p_peer_oob_pk_hash_known:1;
  798. unsigned int p2p_disable_ip_addr_req:1;
  799. unsigned int p2ps_method_config_any:1;
  800. unsigned int p2p_cli_probe:1;
  801. int p2p_persistent_go_freq;
  802. int p2p_persistent_id;
  803. int p2p_go_intent;
  804. int p2p_connect_freq;
  805. struct os_reltime p2p_auto_started;
  806. struct wpa_ssid *p2p_last_4way_hs_fail;
  807. struct wpa_radio_work *p2p_scan_work;
  808. struct wpa_radio_work *p2p_listen_work;
  809. struct wpa_radio_work *p2p_send_action_work;
  810. u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
  811. struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
  812. * formation */
  813. u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
  814. u8 p2p_ip_addr_info[3 * 4];
  815. /* group common frequencies */
  816. int *p2p_group_common_freqs;
  817. unsigned int p2p_group_common_freqs_num;
  818. u8 p2ps_join_addr[ETH_ALEN];
  819. unsigned int p2p_go_max_oper_chwidth;
  820. unsigned int p2p_go_vht_center_freq2;
  821. int p2p_lo_started;
  822. #endif /* CONFIG_P2P */
  823. struct wpa_ssid *bgscan_ssid;
  824. const struct bgscan_ops *bgscan;
  825. void *bgscan_priv;
  826. const struct autoscan_ops *autoscan;
  827. struct wpa_driver_scan_params *autoscan_params;
  828. void *autoscan_priv;
  829. struct wpa_ssid *connect_without_scan;
  830. struct wps_ap_info *wps_ap;
  831. size_t num_wps_ap;
  832. int wps_ap_iter;
  833. int after_wps;
  834. int known_wps_freq;
  835. unsigned int wps_freq;
  836. int wps_fragment_size;
  837. int auto_reconnect_disabled;
  838. /* Channel preferences for AP/P2P GO use */
  839. int best_24_freq;
  840. int best_5_freq;
  841. int best_overall_freq;
  842. struct gas_query *gas;
  843. struct gas_server *gas_server;
  844. #ifdef CONFIG_INTERWORKING
  845. unsigned int fetch_anqp_in_progress:1;
  846. unsigned int network_select:1;
  847. unsigned int auto_select:1;
  848. unsigned int auto_network_select:1;
  849. unsigned int interworking_fast_assoc_tried:1;
  850. unsigned int fetch_all_anqp:1;
  851. unsigned int fetch_osu_info:1;
  852. unsigned int fetch_osu_waiting_scan:1;
  853. unsigned int fetch_osu_icon_in_progress:1;
  854. struct wpa_bss *interworking_gas_bss;
  855. unsigned int osu_icon_id;
  856. struct dl_list icon_head; /* struct icon_entry */
  857. struct osu_provider *osu_prov;
  858. size_t osu_prov_count;
  859. struct os_reltime osu_icon_fetch_start;
  860. unsigned int num_osu_scans;
  861. unsigned int num_prov_found;
  862. #endif /* CONFIG_INTERWORKING */
  863. unsigned int drv_capa_known;
  864. struct {
  865. struct hostapd_hw_modes *modes;
  866. u16 num_modes;
  867. u16 flags;
  868. } hw;
  869. enum local_hw_capab {
  870. CAPAB_NO_HT_VHT,
  871. CAPAB_HT,
  872. CAPAB_HT40,
  873. CAPAB_VHT,
  874. } hw_capab;
  875. #ifdef CONFIG_MACSEC
  876. struct ieee802_1x_kay *kay;
  877. #endif /* CONFIG_MACSEC */
  878. int pno;
  879. int pno_sched_pending;
  880. /* WLAN_REASON_* reason codes. Negative if locally generated. */
  881. int disconnect_reason;
  882. /* WLAN_STATUS_* status codes from (Re)Association Response frame. */
  883. u16 assoc_status_code;
  884. struct ext_password_data *ext_pw;
  885. struct wpabuf *last_gas_resp, *prev_gas_resp;
  886. u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
  887. u8 last_gas_dialog_token, prev_gas_dialog_token;
  888. unsigned int no_keep_alive:1;
  889. unsigned int ext_mgmt_frame_handling:1;
  890. unsigned int ext_eapol_frame_io:1;
  891. unsigned int wmm_ac_supported:1;
  892. unsigned int ext_work_in_progress:1;
  893. unsigned int own_disconnect_req:1;
  894. unsigned int ignore_post_flush_scan_res:1;
  895. #define MAC_ADDR_RAND_SCAN BIT(0)
  896. #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)
  897. #define MAC_ADDR_RAND_PNO BIT(2)
  898. #define MAC_ADDR_RAND_ALL (MAC_ADDR_RAND_SCAN | \
  899. MAC_ADDR_RAND_SCHED_SCAN | \
  900. MAC_ADDR_RAND_PNO)
  901. unsigned int mac_addr_rand_supported;
  902. unsigned int mac_addr_rand_enable;
  903. /* MAC Address followed by mask (2 * ETH_ALEN) */
  904. u8 *mac_addr_scan;
  905. u8 *mac_addr_sched_scan;
  906. u8 *mac_addr_pno;
  907. #ifdef CONFIG_WNM
  908. u8 wnm_dialog_token;
  909. u8 wnm_reply;
  910. u8 wnm_num_neighbor_report;
  911. u8 wnm_mode;
  912. u16 wnm_dissoc_timer;
  913. u8 wnm_bss_termination_duration[12];
  914. struct neighbor_report *wnm_neighbor_report_elements;
  915. struct os_reltime wnm_cand_valid_until;
  916. u8 wnm_cand_from_bss[ETH_ALEN];
  917. #ifdef CONFIG_MBO
  918. unsigned int wnm_mbo_trans_reason_present:1;
  919. u8 wnm_mbo_transition_reason;
  920. #endif /* CONFIG_MBO */
  921. #endif /* CONFIG_WNM */
  922. #ifdef CONFIG_TESTING_GET_GTK
  923. u8 last_gtk[32];
  924. size_t last_gtk_len;
  925. #endif /* CONFIG_TESTING_GET_GTK */
  926. unsigned int num_multichan_concurrent;
  927. struct wpa_radio_work *connect_work;
  928. unsigned int ext_work_id;
  929. struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
  930. #ifdef CONFIG_TESTING_OPTIONS
  931. struct l2_packet_data *l2_test;
  932. unsigned int extra_roc_dur;
  933. enum wpa_supplicant_test_failure test_failure;
  934. char *get_pref_freq_list_override;
  935. unsigned int reject_btm_req_reason;
  936. unsigned int p2p_go_csa_on_inv:1;
  937. unsigned int ignore_auth_resp:1;
  938. unsigned int ignore_assoc_disallow:1;
  939. #endif /* CONFIG_TESTING_OPTIONS */
  940. struct wmm_ac_assoc_data *wmm_ac_assoc_info;
  941. struct wmm_tspec_element *tspecs[WMM_AC_NUM][TS_DIR_IDX_COUNT];
  942. struct wmm_ac_addts_request *addts_request;
  943. u8 wmm_ac_last_dialog_token;
  944. struct wmm_tspec_element *last_tspecs;
  945. u8 last_tspecs_count;
  946. struct rrm_data rrm;
  947. struct beacon_rep_data beacon_rep_data;
  948. #ifdef CONFIG_FST
  949. struct fst_iface *fst;
  950. const struct wpabuf *fst_ies;
  951. struct wpabuf *received_mb_ies;
  952. #endif /* CONFIG_FST */
  953. #ifdef CONFIG_MBO
  954. /* Multiband operation non-preferred channel */
  955. struct wpa_mbo_non_pref_channel {
  956. enum mbo_non_pref_chan_reason reason;
  957. u8 oper_class;
  958. u8 chan;
  959. u8 preference;
  960. } *non_pref_chan;
  961. size_t non_pref_chan_num;
  962. u8 mbo_wnm_token;
  963. #endif /* CONFIG_MBO */
  964. /*
  965. * This should be under CONFIG_MBO, but it is left out to allow using
  966. * the bss_temp_disallowed list for other purposes as well.
  967. */
  968. struct dl_list bss_tmp_disallowed;
  969. /*
  970. * Content of a measurement report element with type 8 (LCI),
  971. * own location.
  972. */
  973. struct wpabuf *lci;
  974. struct os_reltime lci_time;
  975. struct os_reltime beacon_rep_scan;
  976. /* FILS HLP requests (struct fils_hlp_req) */
  977. struct dl_list fils_hlp_req;
  978. struct sched_scan_relative_params {
  979. /**
  980. * relative_rssi_set - Enable relatively preferred BSS reporting
  981. *
  982. * 0 = Disable reporting relatively preferred BSSs
  983. * 1 = Enable reporting relatively preferred BSSs
  984. */
  985. int relative_rssi_set;
  986. /**
  987. * relative_rssi - Relative RSSI for reporting better BSSs
  988. *
  989. * Amount of RSSI by which a BSS should be better than the
  990. * current connected BSS so that the new BSS can be reported
  991. * to user space. This applies to sched_scan operations.
  992. */
  993. int relative_rssi;
  994. /**
  995. * relative_adjust_band - Band in which RSSI is to be adjusted
  996. */
  997. enum set_band relative_adjust_band;
  998. /**
  999. * relative_adjust_rssi - RSSI adjustment
  1000. *
  1001. * An amount of relative_adjust_rssi should be added to the
  1002. * BSSs that belong to the relative_adjust_band while comparing
  1003. * with other bands for BSS reporting.
  1004. */
  1005. int relative_adjust_rssi;
  1006. } srp;
  1007. /* RIC elements for FT protocol */
  1008. struct wpabuf *ric_ies;
  1009. #ifdef CONFIG_DPP
  1010. struct dl_list dpp_bootstrap; /* struct dpp_bootstrap_info */
  1011. struct dl_list dpp_configurator; /* struct dpp_configurator */
  1012. int dpp_init_done;
  1013. struct dpp_authentication *dpp_auth;
  1014. struct wpa_radio_work *dpp_listen_work;
  1015. unsigned int dpp_pending_listen_freq;
  1016. unsigned int dpp_listen_freq;
  1017. u8 dpp_allowed_roles;
  1018. int dpp_qr_mutual;
  1019. int dpp_netrole_ap;
  1020. int dpp_auth_ok_on_ack;
  1021. int dpp_gas_client;
  1022. u8 dpp_intro_bssid[ETH_ALEN];
  1023. void *dpp_intro_network;
  1024. struct dpp_pkex *dpp_pkex;
  1025. struct dpp_bootstrap_info *dpp_pkex_bi;
  1026. char *dpp_pkex_code;
  1027. char *dpp_pkex_identifier;
  1028. char *dpp_pkex_auth_cmd;
  1029. char *dpp_configurator_params;
  1030. #ifdef CONFIG_TESTING_OPTIONS
  1031. char *dpp_config_obj_override;
  1032. char *dpp_discovery_override;
  1033. char *dpp_groups_override;
  1034. char *dpp_devices_override;
  1035. unsigned int dpp_ignore_netaccesskey_mismatch:1;
  1036. #endif /* CONFIG_TESTING_OPTIONS */
  1037. #endif /* CONFIG_DPP */
  1038. };
  1039. /* wpa_supplicant.c */
  1040. void wpa_supplicant_apply_ht_overrides(
  1041. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1042. struct wpa_driver_associate_params *params);
  1043. void wpa_supplicant_apply_vht_overrides(
  1044. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1045. struct wpa_driver_associate_params *params);
  1046. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1047. int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
  1048. struct wpa_ssid *ssid);
  1049. int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
  1050. const char * wpa_supplicant_state_txt(enum wpa_states state);
  1051. int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
  1052. int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
  1053. int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
  1054. struct wpa_bss *bss, struct wpa_ssid *ssid,
  1055. u8 *wpa_ie, size_t *wpa_ie_len);
  1056. void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
  1057. struct wpa_bss *bss,
  1058. struct wpa_ssid *ssid);
  1059. void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
  1060. struct wpa_ssid *ssid);
  1061. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
  1062. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  1063. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  1064. int sec, int usec);
  1065. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  1066. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  1067. enum wpa_states state);
  1068. struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
  1069. const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
  1070. void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
  1071. void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
  1072. int reason_code);
  1073. struct wpa_ssid * wpa_supplicant_add_network(struct wpa_supplicant *wpa_s);
  1074. int wpa_supplicant_remove_network(struct wpa_supplicant *wpa_s, int id);
  1075. void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
  1076. struct wpa_ssid *ssid);
  1077. void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
  1078. struct wpa_ssid *ssid);
  1079. void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
  1080. struct wpa_ssid *ssid);
  1081. int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
  1082. const char *pkcs11_engine_path,
  1083. const char *pkcs11_module_path);
  1084. int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
  1085. int ap_scan);
  1086. int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
  1087. unsigned int expire_age);
  1088. int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
  1089. unsigned int expire_count);
  1090. int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
  1091. int scan_interval);
  1092. int wpa_supplicant_set_debug_params(struct wpa_global *global,
  1093. int debug_level, int debug_timestamp,
  1094. int debug_show_keys);
  1095. void free_hw_features(struct wpa_supplicant *wpa_s);
  1096. void wpa_show_license(void);
  1097. struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global,
  1098. const char *ifname);
  1099. struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
  1100. struct wpa_interface *iface,
  1101. struct wpa_supplicant *parent);
  1102. int wpa_supplicant_remove_iface(struct wpa_global *global,
  1103. struct wpa_supplicant *wpa_s,
  1104. int terminate);
  1105. struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
  1106. const char *ifname);
  1107. struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
  1108. int wpa_supplicant_run(struct wpa_global *global);
  1109. void wpa_supplicant_deinit(struct wpa_global *global);
  1110. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  1111. struct wpa_ssid *ssid);
  1112. void wpa_supplicant_terminate_proc(struct wpa_global *global);
  1113. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  1114. const u8 *buf, size_t len);
  1115. void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
  1116. void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
  1117. void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1118. int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
  1119. int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
  1120. void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
  1121. void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
  1122. struct wpa_ssid *ssid, int clear_failures);
  1123. int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1124. int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
  1125. size_t ssid_len);
  1126. void wpas_request_connection(struct wpa_supplicant *wpa_s);
  1127. void wpas_request_disconnection(struct wpa_supplicant *wpa_s);
  1128. int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
  1129. int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
  1130. int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
  1131. void add_freq(int *freqs, int *num_freqs, int freq);
  1132. void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
  1133. void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
  1134. const u8 *report, size_t report_len);
  1135. int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
  1136. const struct wpa_ssid_value *ssid,
  1137. int lci, int civic,
  1138. void (*cb)(void *ctx,
  1139. struct wpabuf *neighbor_rep),
  1140. void *cb_ctx);
  1141. void wpas_rrm_handle_radio_measurement_request(struct wpa_supplicant *wpa_s,
  1142. const u8 *src,
  1143. const u8 *frame, size_t len);
  1144. void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
  1145. const u8 *src,
  1146. const u8 *frame, size_t len,
  1147. int rssi);
  1148. int wpas_beacon_rep_scan_process(struct wpa_supplicant *wpa_s,
  1149. struct wpa_scan_results *scan_res,
  1150. struct scan_info *info);
  1151. void wpas_clear_beacon_rep_data(struct wpa_supplicant *wpa_s);
  1152. void wpas_flush_fils_hlp_req(struct wpa_supplicant *wpa_s);
  1153. /* MBO functions */
  1154. int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len);
  1155. const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr);
  1156. int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
  1157. const char *non_pref_chan);
  1158. void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);
  1159. void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie,
  1160. size_t len);
  1161. size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos,
  1162. size_t len,
  1163. enum mbo_transition_reject_reason reason);
  1164. void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa);
  1165. struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s,
  1166. struct wpa_bss *bss, u32 mbo_subtypes);
  1167. void mbo_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
  1168. struct wpa_bss *bss, const u8 *sa,
  1169. const u8 *data, size_t slen);
  1170. /* op_classes.c */
  1171. enum chan_allowed {
  1172. NOT_ALLOWED, NO_IR, ALLOWED
  1173. };
  1174. enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 channel,
  1175. u8 bw);
  1176. size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos,
  1177. size_t len);
  1178. /**
  1179. * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
  1180. * @wpa_s: Pointer to wpa_supplicant data
  1181. * @ssid: Pointer to the network block the reply is for
  1182. * @field: field the response is a reply for
  1183. * @value: value (ie, password, etc) for @field
  1184. * Returns: 0 on success, non-zero on error
  1185. *
  1186. * Helper function to handle replies to control interface requests.
  1187. */
  1188. int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
  1189. struct wpa_ssid *ssid,
  1190. const char *field,
  1191. const char *value);
  1192. void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
  1193. const struct wpa_ssid *ssid,
  1194. struct hostapd_freq_params *freq);
  1195. /* events.c */
  1196. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
  1197. int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
  1198. struct wpa_bss *selected,
  1199. struct wpa_ssid *ssid);
  1200. void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
  1201. void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
  1202. void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
  1203. int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
  1204. struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
  1205. struct wpa_ssid **selected_ssid);
  1206. int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1207. /* eap_register.c */
  1208. int eap_register_methods(void);
  1209. /**
  1210. * Utility method to tell if a given network is for persistent group storage
  1211. * @ssid: Network object
  1212. * Returns: 1 if network is a persistent group, 0 otherwise
  1213. */
  1214. static inline int network_is_persistent_group(struct wpa_ssid *ssid)
  1215. {
  1216. return ssid->disabled == 2 && ssid->p2p_persistent_group;
  1217. }
  1218. int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1219. int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1220. int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
  1221. void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
  1222. struct wpa_used_freq_data *freqs_data,
  1223. unsigned int len);
  1224. int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
  1225. struct wpa_used_freq_data *freqs_data,
  1226. unsigned int len);
  1227. int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
  1228. int *freq_array, unsigned int len);
  1229. void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx);
  1230. void wpas_vendor_elem_update(struct wpa_supplicant *wpa_s);
  1231. struct wpa_supplicant * wpas_vendor_elem(struct wpa_supplicant *wpa_s,
  1232. enum wpa_vendor_elem_frame frame);
  1233. int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame,
  1234. const u8 *elem, size_t len);
  1235. #ifdef CONFIG_FST
  1236. struct fst_wpa_obj;
  1237. void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s,
  1238. struct fst_wpa_obj *iface_obj);
  1239. #endif /* CONFIG_FST */
  1240. int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd);
  1241. struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
  1242. u16 num_modes, enum hostapd_hw_mode mode);
  1243. void wpa_bss_tmp_disallow(struct wpa_supplicant *wpa_s, const u8 *bssid,
  1244. unsigned int sec);
  1245. int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1246. struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
  1247. int i, struct wpa_bss *bss,
  1248. struct wpa_ssid *group,
  1249. int only_first_ssid, int debug_print);
  1250. int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s,
  1251. enum wpa_driver_if_type if_type,
  1252. unsigned int *num,
  1253. unsigned int *freq_list);
  1254. #endif /* WPA_SUPPLICANT_I_H */