wpa_supplicant_i.h 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  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 10
  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. struct os_reltime disallowed_until;
  392. };
  393. struct beacon_rep_data {
  394. u8 token;
  395. struct wpa_driver_scan_params scan_params;
  396. u8 ssid[SSID_MAX_LEN];
  397. size_t ssid_len;
  398. u8 bssid[ETH_ALEN];
  399. enum beacon_report_detail report_detail;
  400. struct bitfield *eids;
  401. };
  402. struct external_pmksa_cache {
  403. struct dl_list list;
  404. void *pmksa_cache;
  405. };
  406. struct fils_hlp_req {
  407. struct dl_list list;
  408. u8 dst[ETH_ALEN];
  409. struct wpabuf *pkt;
  410. };
  411. /**
  412. * struct wpa_supplicant - Internal data for wpa_supplicant interface
  413. *
  414. * This structure contains the internal data for core wpa_supplicant code. This
  415. * should be only used directly from the core code. However, a pointer to this
  416. * data is used from other files as an arbitrary context pointer in calls to
  417. * core functions.
  418. */
  419. struct wpa_supplicant {
  420. struct wpa_global *global;
  421. struct wpa_radio *radio; /* shared radio context */
  422. struct dl_list radio_list; /* list head: struct wpa_radio::ifaces */
  423. struct wpa_supplicant *parent;
  424. struct wpa_supplicant *p2pdev;
  425. struct wpa_supplicant *next;
  426. struct l2_packet_data *l2;
  427. struct l2_packet_data *l2_br;
  428. unsigned char own_addr[ETH_ALEN];
  429. unsigned char perm_addr[ETH_ALEN];
  430. char ifname[100];
  431. #ifdef CONFIG_MATCH_IFACE
  432. int matched;
  433. #endif /* CONFIG_MATCH_IFACE */
  434. #ifdef CONFIG_CTRL_IFACE_DBUS
  435. char *dbus_path;
  436. #endif /* CONFIG_CTRL_IFACE_DBUS */
  437. #ifdef CONFIG_CTRL_IFACE_DBUS_NEW
  438. char *dbus_new_path;
  439. char *dbus_groupobj_path;
  440. #ifdef CONFIG_AP
  441. char *preq_notify_peer;
  442. #endif /* CONFIG_AP */
  443. #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  444. #ifdef CONFIG_CTRL_IFACE_BINDER
  445. const void *binder_object_key;
  446. #endif /* CONFIG_CTRL_IFACE_BINDER */
  447. char bridge_ifname[16];
  448. char *confname;
  449. char *confanother;
  450. struct wpa_config *conf;
  451. int countermeasures;
  452. struct os_reltime last_michael_mic_error;
  453. u8 bssid[ETH_ALEN];
  454. u8 pending_bssid[ETH_ALEN]; /* If wpa_state == WPA_ASSOCIATING, this
  455. * field contains the target BSSID. */
  456. int reassociate; /* reassociation requested */
  457. unsigned int reassoc_same_bss:1; /* reassociating to the same BSS */
  458. unsigned int reassoc_same_ess:1; /* reassociating to the same ESS */
  459. int disconnected; /* all connections disabled; i.e., do no reassociate
  460. * before this has been cleared */
  461. struct wpa_ssid *current_ssid;
  462. struct wpa_ssid *last_ssid;
  463. struct wpa_bss *current_bss;
  464. int ap_ies_from_associnfo;
  465. unsigned int assoc_freq;
  466. /* Selected configuration (based on Beacon/ProbeResp WPA IE) */
  467. int pairwise_cipher;
  468. int group_cipher;
  469. int key_mgmt;
  470. int wpa_proto;
  471. int mgmt_group_cipher;
  472. void *drv_priv; /* private data used by driver_ops */
  473. void *global_drv_priv;
  474. u8 *bssid_filter;
  475. size_t bssid_filter_count;
  476. u8 *disallow_aps_bssid;
  477. size_t disallow_aps_bssid_count;
  478. struct wpa_ssid_value *disallow_aps_ssid;
  479. size_t disallow_aps_ssid_count;
  480. enum set_band setband;
  481. /* Preferred network for the next connection attempt */
  482. struct wpa_ssid *next_ssid;
  483. /* previous scan was wildcard when interleaving between
  484. * wildcard scans and specific SSID scan when max_ssids=1 */
  485. int prev_scan_wildcard;
  486. struct wpa_ssid *prev_scan_ssid; /* previously scanned SSID;
  487. * NULL = not yet initialized (start
  488. * with wildcard SSID)
  489. * WILDCARD_SSID_SCAN = wildcard
  490. * SSID was used in the previous scan
  491. */
  492. #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
  493. struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
  494. int sched_scan_timeout;
  495. int first_sched_scan;
  496. int sched_scan_timed_out;
  497. struct sched_scan_plan *sched_scan_plans;
  498. size_t sched_scan_plans_num;
  499. void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
  500. struct wpa_scan_results *scan_res);
  501. struct dl_list bss; /* struct wpa_bss::list */
  502. struct dl_list bss_id; /* struct wpa_bss::list_id */
  503. size_t num_bss;
  504. unsigned int bss_update_idx;
  505. unsigned int bss_next_id;
  506. /*
  507. * Pointers to BSS entries in the order they were in the last scan
  508. * results.
  509. */
  510. struct wpa_bss **last_scan_res;
  511. unsigned int last_scan_res_used;
  512. unsigned int last_scan_res_size;
  513. struct os_reltime last_scan;
  514. const struct wpa_driver_ops *driver;
  515. int interface_removed; /* whether the network interface has been
  516. * removed */
  517. struct wpa_sm *wpa;
  518. struct eapol_sm *eapol;
  519. struct ctrl_iface_priv *ctrl_iface;
  520. enum wpa_states wpa_state;
  521. struct wpa_radio_work *scan_work;
  522. int scanning;
  523. int sched_scanning;
  524. unsigned int sched_scan_stop_req:1;
  525. int new_connection;
  526. int eapol_received; /* number of EAPOL packets received after the
  527. * previous association event */
  528. struct scard_data *scard;
  529. char imsi[20];
  530. int mnc_len;
  531. unsigned char last_eapol_src[ETH_ALEN];
  532. unsigned int keys_cleared; /* bitfield of key indexes that the driver is
  533. * known not to be configured with a key */
  534. struct wpa_blacklist *blacklist;
  535. /**
  536. * extra_blacklist_count - Sum of blacklist counts after last connection
  537. *
  538. * This variable is used to maintain a count of temporary blacklisting
  539. * failures (maximum number for any BSS) over blacklist clear
  540. * operations. This is needed for figuring out whether there has been
  541. * failures prior to the last blacklist clear operation which happens
  542. * whenever no other not-blacklisted BSS candidates are available. This
  543. * gets cleared whenever a connection has been established successfully.
  544. */
  545. int extra_blacklist_count;
  546. /**
  547. * scan_req - Type of the scan request
  548. */
  549. enum scan_req_type {
  550. /**
  551. * NORMAL_SCAN_REQ - Normal scan request
  552. *
  553. * This is used for scans initiated by wpa_supplicant to find an
  554. * AP for a connection.
  555. */
  556. NORMAL_SCAN_REQ,
  557. /**
  558. * INITIAL_SCAN_REQ - Initial scan request
  559. *
  560. * This is used for the first scan on an interface to force at
  561. * least one scan to be run even if the configuration does not
  562. * include any enabled networks.
  563. */
  564. INITIAL_SCAN_REQ,
  565. /**
  566. * MANUAL_SCAN_REQ - Manual scan request
  567. *
  568. * This is used for scans where the user request a scan or
  569. * a specific wpa_supplicant operation (e.g., WPS) requires scan
  570. * to be run.
  571. */
  572. MANUAL_SCAN_REQ
  573. } scan_req, last_scan_req;
  574. enum wpa_states scan_prev_wpa_state;
  575. struct os_reltime scan_trigger_time, scan_start_time;
  576. /* Minimum freshness requirement for connection purposes */
  577. struct os_reltime scan_min_time;
  578. int scan_runs; /* number of scan runs since WPS was started */
  579. int *next_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. #ifdef CONFIG_SME
  652. struct {
  653. u8 ssid[SSID_MAX_LEN];
  654. size_t ssid_len;
  655. int freq;
  656. u8 assoc_req_ie[1500];
  657. size_t assoc_req_ie_len;
  658. int mfp;
  659. int ft_used;
  660. u8 mobility_domain[2];
  661. u8 *ft_ies;
  662. size_t ft_ies_len;
  663. u8 prev_bssid[ETH_ALEN];
  664. int prev_bssid_set;
  665. int auth_alg;
  666. int proto;
  667. int sa_query_count; /* number of pending SA Query requests;
  668. * 0 = no SA Query in progress */
  669. int sa_query_timed_out;
  670. u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN *
  671. * sa_query_count octets of pending
  672. * SA Query transaction identifiers */
  673. struct os_reltime sa_query_start;
  674. struct os_reltime last_unprot_disconnect;
  675. enum { HT_SEC_CHAN_UNKNOWN,
  676. HT_SEC_CHAN_ABOVE,
  677. HT_SEC_CHAN_BELOW } ht_sec_chan;
  678. u8 sched_obss_scan;
  679. u16 obss_scan_int;
  680. u16 bss_max_idle_period;
  681. #ifdef CONFIG_SAE
  682. struct sae_data sae;
  683. struct wpabuf *sae_token;
  684. int sae_group_index;
  685. unsigned int sae_pmksa_caching:1;
  686. #endif /* CONFIG_SAE */
  687. } sme;
  688. #endif /* CONFIG_SME */
  689. #ifdef CONFIG_AP
  690. struct hostapd_iface *ap_iface;
  691. void (*ap_configured_cb)(void *ctx, void *data);
  692. void *ap_configured_cb_ctx;
  693. void *ap_configured_cb_data;
  694. #endif /* CONFIG_AP */
  695. struct hostapd_iface *ifmsh;
  696. #ifdef CONFIG_MESH
  697. struct mesh_rsn *mesh_rsn;
  698. int mesh_if_idx;
  699. unsigned int mesh_if_created:1;
  700. unsigned int mesh_ht_enabled:1;
  701. unsigned int mesh_vht_enabled:1;
  702. #ifdef CONFIG_PMKSA_CACHE_EXTERNAL
  703. /* struct external_pmksa_cache::list */
  704. struct dl_list mesh_external_pmksa_cache;
  705. #endif /* CONFIG_PMKSA_CACHE_EXTERNAL */
  706. #endif /* CONFIG_MESH */
  707. unsigned int off_channel_freq;
  708. struct wpabuf *pending_action_tx;
  709. u8 pending_action_src[ETH_ALEN];
  710. u8 pending_action_dst[ETH_ALEN];
  711. u8 pending_action_bssid[ETH_ALEN];
  712. unsigned int pending_action_freq;
  713. int pending_action_no_cck;
  714. int pending_action_without_roc;
  715. unsigned int pending_action_tx_done:1;
  716. void (*pending_action_tx_status_cb)(struct wpa_supplicant *wpa_s,
  717. unsigned int freq, const u8 *dst,
  718. const u8 *src, const u8 *bssid,
  719. const u8 *data, size_t data_len,
  720. enum offchannel_send_action_result
  721. result);
  722. unsigned int roc_waiting_drv_freq;
  723. int action_tx_wait_time;
  724. int p2p_mgmt;
  725. #ifdef CONFIG_P2P
  726. struct p2p_go_neg_results *go_params;
  727. int create_p2p_iface;
  728. u8 pending_interface_addr[ETH_ALEN];
  729. char pending_interface_name[100];
  730. int pending_interface_type;
  731. int p2p_group_idx;
  732. unsigned int pending_listen_freq;
  733. unsigned int pending_listen_duration;
  734. enum {
  735. NOT_P2P_GROUP_INTERFACE,
  736. P2P_GROUP_INTERFACE_PENDING,
  737. P2P_GROUP_INTERFACE_GO,
  738. P2P_GROUP_INTERFACE_CLIENT
  739. } p2p_group_interface;
  740. struct p2p_group *p2p_group;
  741. int p2p_long_listen; /* remaining time in long Listen state in ms */
  742. char p2p_pin[10];
  743. int p2p_wps_method;
  744. u8 p2p_auth_invite[ETH_ALEN];
  745. int p2p_sd_over_ctrl_iface;
  746. int p2p_in_provisioning;
  747. int p2p_in_invitation;
  748. int p2p_invite_go_freq;
  749. int pending_invite_ssid_id;
  750. int show_group_started;
  751. u8 go_dev_addr[ETH_ALEN];
  752. int pending_pd_before_join;
  753. u8 pending_join_iface_addr[ETH_ALEN];
  754. u8 pending_join_dev_addr[ETH_ALEN];
  755. int pending_join_wps_method;
  756. u8 p2p_join_ssid[SSID_MAX_LEN];
  757. size_t p2p_join_ssid_len;
  758. int p2p_join_scan_count;
  759. int auto_pd_scan_retry;
  760. int force_long_sd;
  761. u16 pending_pd_config_methods;
  762. enum {
  763. NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN, AUTO_PD_ASP
  764. } pending_pd_use;
  765. /*
  766. * Whether cross connection is disallowed by the AP to which this
  767. * interface is associated (only valid if there is an association).
  768. */
  769. int cross_connect_disallowed;
  770. /*
  771. * Whether this P2P group is configured to use cross connection (only
  772. * valid if this is P2P GO interface). The actual cross connect packet
  773. * forwarding may not be configured depending on the uplink status.
  774. */
  775. int cross_connect_enabled;
  776. /* Whether cross connection forwarding is in use at the moment. */
  777. int cross_connect_in_use;
  778. /*
  779. * Uplink interface name for cross connection
  780. */
  781. char cross_connect_uplink[100];
  782. unsigned int p2p_auto_join:1;
  783. unsigned int p2p_auto_pd:1;
  784. unsigned int p2p_persistent_group:1;
  785. unsigned int p2p_fallback_to_go_neg:1;
  786. unsigned int p2p_pd_before_go_neg:1;
  787. unsigned int p2p_go_ht40:1;
  788. unsigned int p2p_go_vht:1;
  789. unsigned int user_initiated_pd:1;
  790. unsigned int p2p_go_group_formation_completed:1;
  791. unsigned int group_formation_reported:1;
  792. unsigned int waiting_presence_resp;
  793. int p2p_first_connection_timeout;
  794. unsigned int p2p_nfc_tag_enabled:1;
  795. unsigned int p2p_peer_oob_pk_hash_known:1;
  796. unsigned int p2p_disable_ip_addr_req:1;
  797. unsigned int p2ps_method_config_any:1;
  798. unsigned int p2p_cli_probe:1;
  799. int p2p_persistent_go_freq;
  800. int p2p_persistent_id;
  801. int p2p_go_intent;
  802. int p2p_connect_freq;
  803. struct os_reltime p2p_auto_started;
  804. struct wpa_ssid *p2p_last_4way_hs_fail;
  805. struct wpa_radio_work *p2p_scan_work;
  806. struct wpa_radio_work *p2p_listen_work;
  807. struct wpa_radio_work *p2p_send_action_work;
  808. u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
  809. struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
  810. * formation */
  811. u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
  812. u8 p2p_ip_addr_info[3 * 4];
  813. /* group common frequencies */
  814. int *p2p_group_common_freqs;
  815. unsigned int p2p_group_common_freqs_num;
  816. u8 p2ps_join_addr[ETH_ALEN];
  817. unsigned int p2p_go_max_oper_chwidth;
  818. unsigned int p2p_go_vht_center_freq2;
  819. int p2p_lo_started;
  820. #endif /* CONFIG_P2P */
  821. struct wpa_ssid *bgscan_ssid;
  822. const struct bgscan_ops *bgscan;
  823. void *bgscan_priv;
  824. const struct autoscan_ops *autoscan;
  825. struct wpa_driver_scan_params *autoscan_params;
  826. void *autoscan_priv;
  827. struct wpa_ssid *connect_without_scan;
  828. struct wps_ap_info *wps_ap;
  829. size_t num_wps_ap;
  830. int wps_ap_iter;
  831. int after_wps;
  832. int known_wps_freq;
  833. unsigned int wps_freq;
  834. int wps_fragment_size;
  835. int auto_reconnect_disabled;
  836. /* Channel preferences for AP/P2P GO use */
  837. int best_24_freq;
  838. int best_5_freq;
  839. int best_overall_freq;
  840. struct gas_query *gas;
  841. #ifdef CONFIG_INTERWORKING
  842. unsigned int fetch_anqp_in_progress:1;
  843. unsigned int network_select:1;
  844. unsigned int auto_select:1;
  845. unsigned int auto_network_select:1;
  846. unsigned int interworking_fast_assoc_tried:1;
  847. unsigned int fetch_all_anqp:1;
  848. unsigned int fetch_osu_info:1;
  849. unsigned int fetch_osu_waiting_scan:1;
  850. unsigned int fetch_osu_icon_in_progress:1;
  851. struct wpa_bss *interworking_gas_bss;
  852. unsigned int osu_icon_id;
  853. struct dl_list icon_head; /* struct icon_entry */
  854. struct osu_provider *osu_prov;
  855. size_t osu_prov_count;
  856. struct os_reltime osu_icon_fetch_start;
  857. unsigned int num_osu_scans;
  858. unsigned int num_prov_found;
  859. #endif /* CONFIG_INTERWORKING */
  860. unsigned int drv_capa_known;
  861. struct {
  862. struct hostapd_hw_modes *modes;
  863. u16 num_modes;
  864. u16 flags;
  865. } hw;
  866. enum local_hw_capab {
  867. CAPAB_NO_HT_VHT,
  868. CAPAB_HT,
  869. CAPAB_HT40,
  870. CAPAB_VHT,
  871. } hw_capab;
  872. #ifdef CONFIG_MACSEC
  873. struct ieee802_1x_kay *kay;
  874. #endif /* CONFIG_MACSEC */
  875. int pno;
  876. int pno_sched_pending;
  877. /* WLAN_REASON_* reason codes. Negative if locally generated. */
  878. int disconnect_reason;
  879. /* WLAN_STATUS_* status codes from (Re)Association Response frame. */
  880. u16 assoc_status_code;
  881. struct ext_password_data *ext_pw;
  882. struct wpabuf *last_gas_resp, *prev_gas_resp;
  883. u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
  884. u8 last_gas_dialog_token, prev_gas_dialog_token;
  885. unsigned int no_keep_alive:1;
  886. unsigned int ext_mgmt_frame_handling:1;
  887. unsigned int ext_eapol_frame_io:1;
  888. unsigned int wmm_ac_supported:1;
  889. unsigned int ext_work_in_progress:1;
  890. unsigned int own_disconnect_req:1;
  891. unsigned int ignore_post_flush_scan_res:1;
  892. #define MAC_ADDR_RAND_SCAN BIT(0)
  893. #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)
  894. #define MAC_ADDR_RAND_PNO BIT(2)
  895. #define MAC_ADDR_RAND_ALL (MAC_ADDR_RAND_SCAN | \
  896. MAC_ADDR_RAND_SCHED_SCAN | \
  897. MAC_ADDR_RAND_PNO)
  898. unsigned int mac_addr_rand_supported;
  899. unsigned int mac_addr_rand_enable;
  900. /* MAC Address followed by mask (2 * ETH_ALEN) */
  901. u8 *mac_addr_scan;
  902. u8 *mac_addr_sched_scan;
  903. u8 *mac_addr_pno;
  904. #ifdef CONFIG_WNM
  905. u8 wnm_dialog_token;
  906. u8 wnm_reply;
  907. u8 wnm_num_neighbor_report;
  908. u8 wnm_mode;
  909. u16 wnm_dissoc_timer;
  910. u8 wnm_bss_termination_duration[12];
  911. struct neighbor_report *wnm_neighbor_report_elements;
  912. struct os_reltime wnm_cand_valid_until;
  913. u8 wnm_cand_from_bss[ETH_ALEN];
  914. #endif /* CONFIG_WNM */
  915. #ifdef CONFIG_TESTING_GET_GTK
  916. u8 last_gtk[32];
  917. size_t last_gtk_len;
  918. #endif /* CONFIG_TESTING_GET_GTK */
  919. unsigned int num_multichan_concurrent;
  920. struct wpa_radio_work *connect_work;
  921. unsigned int ext_work_id;
  922. struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
  923. #ifdef CONFIG_TESTING_OPTIONS
  924. struct l2_packet_data *l2_test;
  925. unsigned int extra_roc_dur;
  926. enum wpa_supplicant_test_failure test_failure;
  927. char *get_pref_freq_list_override;
  928. unsigned int reject_btm_req_reason;
  929. unsigned int p2p_go_csa_on_inv:1;
  930. unsigned int ignore_auth_resp:1;
  931. unsigned int ignore_assoc_disallow:1;
  932. #endif /* CONFIG_TESTING_OPTIONS */
  933. struct wmm_ac_assoc_data *wmm_ac_assoc_info;
  934. struct wmm_tspec_element *tspecs[WMM_AC_NUM][TS_DIR_IDX_COUNT];
  935. struct wmm_ac_addts_request *addts_request;
  936. u8 wmm_ac_last_dialog_token;
  937. struct wmm_tspec_element *last_tspecs;
  938. u8 last_tspecs_count;
  939. struct rrm_data rrm;
  940. struct beacon_rep_data beacon_rep_data;
  941. #ifdef CONFIG_FST
  942. struct fst_iface *fst;
  943. const struct wpabuf *fst_ies;
  944. struct wpabuf *received_mb_ies;
  945. #endif /* CONFIG_FST */
  946. #ifdef CONFIG_MBO
  947. /* Multiband operation non-preferred channel */
  948. struct wpa_mbo_non_pref_channel {
  949. enum mbo_non_pref_chan_reason reason;
  950. u8 oper_class;
  951. u8 chan;
  952. u8 preference;
  953. } *non_pref_chan;
  954. size_t non_pref_chan_num;
  955. u8 mbo_wnm_token;
  956. #endif /* CONFIG_MBO */
  957. /*
  958. * This should be under CONFIG_MBO, but it is left out to allow using
  959. * the bss_temp_disallowed list for other purposes as well.
  960. */
  961. struct dl_list bss_tmp_disallowed;
  962. /*
  963. * Content of a measurement report element with type 8 (LCI),
  964. * own location.
  965. */
  966. struct wpabuf *lci;
  967. struct os_reltime lci_time;
  968. struct os_reltime beacon_rep_scan;
  969. /* FILS HLP requests (struct fils_hlp_req) */
  970. struct dl_list fils_hlp_req;
  971. struct sched_scan_relative_params {
  972. /**
  973. * relative_rssi_set - Enable relatively preferred BSS reporting
  974. *
  975. * 0 = Disable reporting relatively preferred BSSs
  976. * 1 = Enable reporting relatively preferred BSSs
  977. */
  978. int relative_rssi_set;
  979. /**
  980. * relative_rssi - Relative RSSI for reporting better BSSs
  981. *
  982. * Amount of RSSI by which a BSS should be better than the
  983. * current connected BSS so that the new BSS can be reported
  984. * to user space. This applies to sched_scan operations.
  985. */
  986. int relative_rssi;
  987. /**
  988. * relative_adjust_band - Band in which RSSI is to be adjusted
  989. */
  990. enum set_band relative_adjust_band;
  991. /**
  992. * relative_adjust_rssi - RSSI adjustment
  993. *
  994. * An amount of relative_adjust_rssi should be added to the
  995. * BSSs that belong to the relative_adjust_band while comparing
  996. * with other bands for BSS reporting.
  997. */
  998. int relative_adjust_rssi;
  999. } srp;
  1000. };
  1001. /* wpa_supplicant.c */
  1002. void wpa_supplicant_apply_ht_overrides(
  1003. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1004. struct wpa_driver_associate_params *params);
  1005. void wpa_supplicant_apply_vht_overrides(
  1006. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1007. struct wpa_driver_associate_params *params);
  1008. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1009. int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
  1010. struct wpa_ssid *ssid);
  1011. int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
  1012. const char * wpa_supplicant_state_txt(enum wpa_states state);
  1013. int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
  1014. int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
  1015. int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
  1016. struct wpa_bss *bss, struct wpa_ssid *ssid,
  1017. u8 *wpa_ie, size_t *wpa_ie_len);
  1018. void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
  1019. struct wpa_bss *bss,
  1020. struct wpa_ssid *ssid);
  1021. void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
  1022. struct wpa_ssid *ssid);
  1023. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
  1024. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  1025. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  1026. int sec, int usec);
  1027. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  1028. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  1029. enum wpa_states state);
  1030. struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
  1031. const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
  1032. void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
  1033. void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
  1034. int reason_code);
  1035. struct wpa_ssid * wpa_supplicant_add_network(struct wpa_supplicant *wpa_s);
  1036. int wpa_supplicant_remove_network(struct wpa_supplicant *wpa_s, int id);
  1037. void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
  1038. struct wpa_ssid *ssid);
  1039. void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
  1040. struct wpa_ssid *ssid);
  1041. void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
  1042. struct wpa_ssid *ssid);
  1043. int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
  1044. const char *pkcs11_engine_path,
  1045. const char *pkcs11_module_path);
  1046. int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
  1047. int ap_scan);
  1048. int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
  1049. unsigned int expire_age);
  1050. int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
  1051. unsigned int expire_count);
  1052. int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
  1053. int scan_interval);
  1054. int wpa_supplicant_set_debug_params(struct wpa_global *global,
  1055. int debug_level, int debug_timestamp,
  1056. int debug_show_keys);
  1057. void free_hw_features(struct wpa_supplicant *wpa_s);
  1058. void wpa_show_license(void);
  1059. struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global,
  1060. const char *ifname);
  1061. struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
  1062. struct wpa_interface *iface,
  1063. struct wpa_supplicant *parent);
  1064. int wpa_supplicant_remove_iface(struct wpa_global *global,
  1065. struct wpa_supplicant *wpa_s,
  1066. int terminate);
  1067. struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
  1068. const char *ifname);
  1069. struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
  1070. int wpa_supplicant_run(struct wpa_global *global);
  1071. void wpa_supplicant_deinit(struct wpa_global *global);
  1072. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  1073. struct wpa_ssid *ssid);
  1074. void wpa_supplicant_terminate_proc(struct wpa_global *global);
  1075. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  1076. const u8 *buf, size_t len);
  1077. void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
  1078. void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
  1079. void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1080. int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
  1081. int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
  1082. void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
  1083. void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
  1084. struct wpa_ssid *ssid, int clear_failures);
  1085. int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1086. int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
  1087. size_t ssid_len);
  1088. void wpas_request_connection(struct wpa_supplicant *wpa_s);
  1089. void wpas_request_disconnection(struct wpa_supplicant *wpa_s);
  1090. int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
  1091. int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
  1092. int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
  1093. void add_freq(int *freqs, int *num_freqs, int freq);
  1094. void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
  1095. void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
  1096. const u8 *report, size_t report_len);
  1097. int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
  1098. const struct wpa_ssid_value *ssid,
  1099. int lci, int civic,
  1100. void (*cb)(void *ctx,
  1101. struct wpabuf *neighbor_rep),
  1102. void *cb_ctx);
  1103. void wpas_rrm_handle_radio_measurement_request(struct wpa_supplicant *wpa_s,
  1104. const u8 *src,
  1105. const u8 *frame, size_t len);
  1106. void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
  1107. const u8 *src,
  1108. const u8 *frame, size_t len,
  1109. int rssi);
  1110. int wpas_beacon_rep_scan_process(struct wpa_supplicant *wpa_s,
  1111. struct wpa_scan_results *scan_res,
  1112. struct scan_info *info);
  1113. void wpas_clear_beacon_rep_data(struct wpa_supplicant *wpa_s);
  1114. void wpas_flush_fils_hlp_req(struct wpa_supplicant *wpa_s);
  1115. /* MBO functions */
  1116. int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len);
  1117. const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr);
  1118. int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
  1119. const char *non_pref_chan);
  1120. void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);
  1121. void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie,
  1122. size_t len);
  1123. size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos,
  1124. size_t len,
  1125. enum mbo_transition_reject_reason reason);
  1126. void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa);
  1127. struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s,
  1128. struct wpa_bss *bss);
  1129. /* op_classes.c */
  1130. enum chan_allowed {
  1131. NOT_ALLOWED, NO_IR, ALLOWED
  1132. };
  1133. enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 channel,
  1134. u8 bw);
  1135. size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos,
  1136. size_t len);
  1137. /**
  1138. * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
  1139. * @wpa_s: Pointer to wpa_supplicant data
  1140. * @ssid: Pointer to the network block the reply is for
  1141. * @field: field the response is a reply for
  1142. * @value: value (ie, password, etc) for @field
  1143. * Returns: 0 on success, non-zero on error
  1144. *
  1145. * Helper function to handle replies to control interface requests.
  1146. */
  1147. int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
  1148. struct wpa_ssid *ssid,
  1149. const char *field,
  1150. const char *value);
  1151. void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
  1152. const struct wpa_ssid *ssid,
  1153. struct hostapd_freq_params *freq);
  1154. /* events.c */
  1155. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
  1156. int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
  1157. struct wpa_bss *selected,
  1158. struct wpa_ssid *ssid);
  1159. void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
  1160. void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
  1161. void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
  1162. int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
  1163. struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
  1164. struct wpa_ssid **selected_ssid);
  1165. /* eap_register.c */
  1166. int eap_register_methods(void);
  1167. /**
  1168. * Utility method to tell if a given network is for persistent group storage
  1169. * @ssid: Network object
  1170. * Returns: 1 if network is a persistent group, 0 otherwise
  1171. */
  1172. static inline int network_is_persistent_group(struct wpa_ssid *ssid)
  1173. {
  1174. return ssid->disabled == 2 && ssid->p2p_persistent_group;
  1175. }
  1176. int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1177. int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1178. int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
  1179. void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
  1180. struct wpa_used_freq_data *freqs_data,
  1181. unsigned int len);
  1182. int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
  1183. struct wpa_used_freq_data *freqs_data,
  1184. unsigned int len);
  1185. int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
  1186. int *freq_array, unsigned int len);
  1187. void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx);
  1188. void wpas_vendor_elem_update(struct wpa_supplicant *wpa_s);
  1189. struct wpa_supplicant * wpas_vendor_elem(struct wpa_supplicant *wpa_s,
  1190. enum wpa_vendor_elem_frame frame);
  1191. int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame,
  1192. const u8 *elem, size_t len);
  1193. #ifdef CONFIG_FST
  1194. struct fst_wpa_obj;
  1195. void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s,
  1196. struct fst_wpa_obj *iface_obj);
  1197. #endif /* CONFIG_FST */
  1198. int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd);
  1199. struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
  1200. u16 num_modes, enum hostapd_hw_mode mode);
  1201. void wpa_bss_tmp_disallow(struct wpa_supplicant *wpa_s, const u8 *bssid,
  1202. unsigned int sec);
  1203. int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1204. struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
  1205. int i, struct wpa_bss *bss,
  1206. struct wpa_ssid *group,
  1207. int only_first_ssid, int debug_print);
  1208. int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s,
  1209. enum wpa_driver_if_type if_type,
  1210. unsigned int *num,
  1211. unsigned int *freq_list);
  1212. #endif /* WPA_SUPPLICANT_I_H */