wpa_supplicant_i.h 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408
  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. 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 *select_network_scan_freqs;
  581. int *manual_scan_freqs;
  582. int *manual_sched_scan_freqs;
  583. unsigned int manual_scan_passive:1;
  584. unsigned int manual_scan_use_id:1;
  585. unsigned int manual_scan_only_new:1;
  586. unsigned int own_scan_requested:1;
  587. unsigned int own_scan_running:1;
  588. unsigned int clear_driver_scan_cache:1;
  589. unsigned int manual_scan_id;
  590. int scan_interval; /* time in sec between scans to find suitable AP */
  591. int normal_scans; /* normal scans run before sched_scan */
  592. int scan_for_connection; /* whether the scan request was triggered for
  593. * finding a connection */
  594. /*
  595. * A unique cookie representing the vendor scan request. This cookie is
  596. * returned from the driver interface. 0 indicates that there is no
  597. * pending vendor scan request.
  598. */
  599. u64 curr_scan_cookie;
  600. #define MAX_SCAN_ID 16
  601. int scan_id[MAX_SCAN_ID];
  602. unsigned int scan_id_count;
  603. u8 next_scan_bssid[ETH_ALEN];
  604. struct wpa_ssid_value *ssids_from_scan_req;
  605. unsigned int num_ssids_from_scan_req;
  606. u64 drv_flags;
  607. unsigned int drv_enc;
  608. unsigned int drv_smps_modes;
  609. unsigned int drv_rrm_flags;
  610. /*
  611. * A bitmap of supported protocols for probe response offload. See
  612. * struct wpa_driver_capa in driver.h
  613. */
  614. unsigned int probe_resp_offloads;
  615. /* extended capabilities supported by the driver */
  616. const u8 *extended_capa, *extended_capa_mask;
  617. unsigned int extended_capa_len;
  618. int max_scan_ssids;
  619. int max_sched_scan_ssids;
  620. unsigned int max_sched_scan_plans;
  621. unsigned int max_sched_scan_plan_interval;
  622. unsigned int max_sched_scan_plan_iterations;
  623. int sched_scan_supported;
  624. unsigned int max_match_sets;
  625. unsigned int max_remain_on_chan;
  626. unsigned int max_stations;
  627. int pending_mic_error_report;
  628. int pending_mic_error_pairwise;
  629. int mic_errors_seen; /* Michael MIC errors with the current PTK */
  630. struct wps_context *wps;
  631. int wps_success; /* WPS success event received */
  632. struct wps_er *wps_er;
  633. unsigned int wps_run;
  634. struct os_reltime wps_pin_start_time;
  635. int blacklist_cleared;
  636. struct wpabuf *pending_eapol_rx;
  637. struct os_reltime pending_eapol_rx_time;
  638. u8 pending_eapol_rx_src[ETH_ALEN];
  639. unsigned int last_eapol_matches_bssid:1;
  640. unsigned int eap_expected_failure:1;
  641. unsigned int reattach:1; /* reassociation to the same BSS requested */
  642. unsigned int mac_addr_changed:1;
  643. unsigned int added_vif:1;
  644. unsigned int wnmsleep_used:1;
  645. struct os_reltime last_mac_addr_change;
  646. int last_mac_addr_style;
  647. struct ibss_rsn *ibss_rsn;
  648. int set_sta_uapsd;
  649. int sta_uapsd;
  650. int set_ap_uapsd;
  651. int ap_uapsd;
  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 p2p_mgmt;
  726. #ifdef CONFIG_P2P
  727. struct p2p_go_neg_results *go_params;
  728. int create_p2p_iface;
  729. u8 pending_interface_addr[ETH_ALEN];
  730. char pending_interface_name[100];
  731. int pending_interface_type;
  732. int p2p_group_idx;
  733. unsigned int pending_listen_freq;
  734. unsigned int pending_listen_duration;
  735. enum {
  736. NOT_P2P_GROUP_INTERFACE,
  737. P2P_GROUP_INTERFACE_PENDING,
  738. P2P_GROUP_INTERFACE_GO,
  739. P2P_GROUP_INTERFACE_CLIENT
  740. } p2p_group_interface;
  741. struct p2p_group *p2p_group;
  742. int p2p_long_listen; /* remaining time in long Listen state in ms */
  743. char p2p_pin[10];
  744. int p2p_wps_method;
  745. u8 p2p_auth_invite[ETH_ALEN];
  746. int p2p_sd_over_ctrl_iface;
  747. int p2p_in_provisioning;
  748. int p2p_in_invitation;
  749. int p2p_invite_go_freq;
  750. int pending_invite_ssid_id;
  751. int show_group_started;
  752. u8 go_dev_addr[ETH_ALEN];
  753. int pending_pd_before_join;
  754. u8 pending_join_iface_addr[ETH_ALEN];
  755. u8 pending_join_dev_addr[ETH_ALEN];
  756. int pending_join_wps_method;
  757. u8 p2p_join_ssid[SSID_MAX_LEN];
  758. size_t p2p_join_ssid_len;
  759. int p2p_join_scan_count;
  760. int auto_pd_scan_retry;
  761. int force_long_sd;
  762. u16 pending_pd_config_methods;
  763. enum {
  764. NORMAL_PD, AUTO_PD_GO_NEG, AUTO_PD_JOIN, AUTO_PD_ASP
  765. } pending_pd_use;
  766. /*
  767. * Whether cross connection is disallowed by the AP to which this
  768. * interface is associated (only valid if there is an association).
  769. */
  770. int cross_connect_disallowed;
  771. /*
  772. * Whether this P2P group is configured to use cross connection (only
  773. * valid if this is P2P GO interface). The actual cross connect packet
  774. * forwarding may not be configured depending on the uplink status.
  775. */
  776. int cross_connect_enabled;
  777. /* Whether cross connection forwarding is in use at the moment. */
  778. int cross_connect_in_use;
  779. /*
  780. * Uplink interface name for cross connection
  781. */
  782. char cross_connect_uplink[100];
  783. unsigned int p2p_auto_join:1;
  784. unsigned int p2p_auto_pd:1;
  785. unsigned int p2p_persistent_group:1;
  786. unsigned int p2p_fallback_to_go_neg:1;
  787. unsigned int p2p_pd_before_go_neg:1;
  788. unsigned int p2p_go_ht40:1;
  789. unsigned int p2p_go_vht:1;
  790. unsigned int user_initiated_pd:1;
  791. unsigned int p2p_go_group_formation_completed:1;
  792. unsigned int group_formation_reported:1;
  793. unsigned int waiting_presence_resp;
  794. int p2p_first_connection_timeout;
  795. unsigned int p2p_nfc_tag_enabled:1;
  796. unsigned int p2p_peer_oob_pk_hash_known:1;
  797. unsigned int p2p_disable_ip_addr_req:1;
  798. unsigned int p2ps_method_config_any:1;
  799. unsigned int p2p_cli_probe:1;
  800. int p2p_persistent_go_freq;
  801. int p2p_persistent_id;
  802. int p2p_go_intent;
  803. int p2p_connect_freq;
  804. struct os_reltime p2p_auto_started;
  805. struct wpa_ssid *p2p_last_4way_hs_fail;
  806. struct wpa_radio_work *p2p_scan_work;
  807. struct wpa_radio_work *p2p_listen_work;
  808. struct wpa_radio_work *p2p_send_action_work;
  809. u16 p2p_oob_dev_pw_id; /* OOB Device Password Id for group formation */
  810. struct wpabuf *p2p_oob_dev_pw; /* OOB Device Password for group
  811. * formation */
  812. u8 p2p_peer_oob_pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN];
  813. u8 p2p_ip_addr_info[3 * 4];
  814. /* group common frequencies */
  815. int *p2p_group_common_freqs;
  816. unsigned int p2p_group_common_freqs_num;
  817. u8 p2ps_join_addr[ETH_ALEN];
  818. unsigned int p2p_go_max_oper_chwidth;
  819. unsigned int p2p_go_vht_center_freq2;
  820. int p2p_lo_started;
  821. #endif /* CONFIG_P2P */
  822. struct wpa_ssid *bgscan_ssid;
  823. const struct bgscan_ops *bgscan;
  824. void *bgscan_priv;
  825. const struct autoscan_ops *autoscan;
  826. struct wpa_driver_scan_params *autoscan_params;
  827. void *autoscan_priv;
  828. struct wpa_ssid *connect_without_scan;
  829. struct wps_ap_info *wps_ap;
  830. size_t num_wps_ap;
  831. int wps_ap_iter;
  832. int after_wps;
  833. int known_wps_freq;
  834. unsigned int wps_freq;
  835. int wps_fragment_size;
  836. int auto_reconnect_disabled;
  837. /* Channel preferences for AP/P2P GO use */
  838. int best_24_freq;
  839. int best_5_freq;
  840. int best_overall_freq;
  841. struct gas_query *gas;
  842. #ifdef CONFIG_INTERWORKING
  843. unsigned int fetch_anqp_in_progress:1;
  844. unsigned int network_select:1;
  845. unsigned int auto_select:1;
  846. unsigned int auto_network_select:1;
  847. unsigned int interworking_fast_assoc_tried:1;
  848. unsigned int fetch_all_anqp:1;
  849. unsigned int fetch_osu_info:1;
  850. unsigned int fetch_osu_waiting_scan:1;
  851. unsigned int fetch_osu_icon_in_progress:1;
  852. struct wpa_bss *interworking_gas_bss;
  853. unsigned int osu_icon_id;
  854. struct dl_list icon_head; /* struct icon_entry */
  855. struct osu_provider *osu_prov;
  856. size_t osu_prov_count;
  857. struct os_reltime osu_icon_fetch_start;
  858. unsigned int num_osu_scans;
  859. unsigned int num_prov_found;
  860. #endif /* CONFIG_INTERWORKING */
  861. unsigned int drv_capa_known;
  862. struct {
  863. struct hostapd_hw_modes *modes;
  864. u16 num_modes;
  865. u16 flags;
  866. } hw;
  867. enum local_hw_capab {
  868. CAPAB_NO_HT_VHT,
  869. CAPAB_HT,
  870. CAPAB_HT40,
  871. CAPAB_VHT,
  872. } hw_capab;
  873. #ifdef CONFIG_MACSEC
  874. struct ieee802_1x_kay *kay;
  875. #endif /* CONFIG_MACSEC */
  876. int pno;
  877. int pno_sched_pending;
  878. /* WLAN_REASON_* reason codes. Negative if locally generated. */
  879. int disconnect_reason;
  880. /* WLAN_STATUS_* status codes from (Re)Association Response frame. */
  881. u16 assoc_status_code;
  882. struct ext_password_data *ext_pw;
  883. struct wpabuf *last_gas_resp, *prev_gas_resp;
  884. u8 last_gas_addr[ETH_ALEN], prev_gas_addr[ETH_ALEN];
  885. u8 last_gas_dialog_token, prev_gas_dialog_token;
  886. unsigned int no_keep_alive:1;
  887. unsigned int ext_mgmt_frame_handling:1;
  888. unsigned int ext_eapol_frame_io:1;
  889. unsigned int wmm_ac_supported:1;
  890. unsigned int ext_work_in_progress:1;
  891. unsigned int own_disconnect_req:1;
  892. unsigned int ignore_post_flush_scan_res:1;
  893. #define MAC_ADDR_RAND_SCAN BIT(0)
  894. #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)
  895. #define MAC_ADDR_RAND_PNO BIT(2)
  896. #define MAC_ADDR_RAND_ALL (MAC_ADDR_RAND_SCAN | \
  897. MAC_ADDR_RAND_SCHED_SCAN | \
  898. MAC_ADDR_RAND_PNO)
  899. unsigned int mac_addr_rand_supported;
  900. unsigned int mac_addr_rand_enable;
  901. /* MAC Address followed by mask (2 * ETH_ALEN) */
  902. u8 *mac_addr_scan;
  903. u8 *mac_addr_sched_scan;
  904. u8 *mac_addr_pno;
  905. #ifdef CONFIG_WNM
  906. u8 wnm_dialog_token;
  907. u8 wnm_reply;
  908. u8 wnm_num_neighbor_report;
  909. u8 wnm_mode;
  910. u16 wnm_dissoc_timer;
  911. u8 wnm_bss_termination_duration[12];
  912. struct neighbor_report *wnm_neighbor_report_elements;
  913. struct os_reltime wnm_cand_valid_until;
  914. u8 wnm_cand_from_bss[ETH_ALEN];
  915. #ifdef CONFIG_MBO
  916. unsigned int wnm_mbo_trans_reason_present:1;
  917. u8 wnm_mbo_transition_reason;
  918. #endif /* CONFIG_MBO */
  919. #endif /* CONFIG_WNM */
  920. #ifdef CONFIG_TESTING_GET_GTK
  921. u8 last_gtk[32];
  922. size_t last_gtk_len;
  923. #endif /* CONFIG_TESTING_GET_GTK */
  924. unsigned int num_multichan_concurrent;
  925. struct wpa_radio_work *connect_work;
  926. unsigned int ext_work_id;
  927. struct wpabuf *vendor_elem[NUM_VENDOR_ELEM_FRAMES];
  928. #ifdef CONFIG_TESTING_OPTIONS
  929. struct l2_packet_data *l2_test;
  930. unsigned int extra_roc_dur;
  931. enum wpa_supplicant_test_failure test_failure;
  932. char *get_pref_freq_list_override;
  933. unsigned int reject_btm_req_reason;
  934. unsigned int p2p_go_csa_on_inv:1;
  935. unsigned int ignore_auth_resp:1;
  936. unsigned int ignore_assoc_disallow:1;
  937. #endif /* CONFIG_TESTING_OPTIONS */
  938. struct wmm_ac_assoc_data *wmm_ac_assoc_info;
  939. struct wmm_tspec_element *tspecs[WMM_AC_NUM][TS_DIR_IDX_COUNT];
  940. struct wmm_ac_addts_request *addts_request;
  941. u8 wmm_ac_last_dialog_token;
  942. struct wmm_tspec_element *last_tspecs;
  943. u8 last_tspecs_count;
  944. struct rrm_data rrm;
  945. struct beacon_rep_data beacon_rep_data;
  946. #ifdef CONFIG_FST
  947. struct fst_iface *fst;
  948. const struct wpabuf *fst_ies;
  949. struct wpabuf *received_mb_ies;
  950. #endif /* CONFIG_FST */
  951. #ifdef CONFIG_MBO
  952. /* Multiband operation non-preferred channel */
  953. struct wpa_mbo_non_pref_channel {
  954. enum mbo_non_pref_chan_reason reason;
  955. u8 oper_class;
  956. u8 chan;
  957. u8 preference;
  958. } *non_pref_chan;
  959. size_t non_pref_chan_num;
  960. u8 mbo_wnm_token;
  961. #endif /* CONFIG_MBO */
  962. /*
  963. * This should be under CONFIG_MBO, but it is left out to allow using
  964. * the bss_temp_disallowed list for other purposes as well.
  965. */
  966. struct dl_list bss_tmp_disallowed;
  967. /*
  968. * Content of a measurement report element with type 8 (LCI),
  969. * own location.
  970. */
  971. struct wpabuf *lci;
  972. struct os_reltime lci_time;
  973. struct os_reltime beacon_rep_scan;
  974. /* FILS HLP requests (struct fils_hlp_req) */
  975. struct dl_list fils_hlp_req;
  976. struct sched_scan_relative_params {
  977. /**
  978. * relative_rssi_set - Enable relatively preferred BSS reporting
  979. *
  980. * 0 = Disable reporting relatively preferred BSSs
  981. * 1 = Enable reporting relatively preferred BSSs
  982. */
  983. int relative_rssi_set;
  984. /**
  985. * relative_rssi - Relative RSSI for reporting better BSSs
  986. *
  987. * Amount of RSSI by which a BSS should be better than the
  988. * current connected BSS so that the new BSS can be reported
  989. * to user space. This applies to sched_scan operations.
  990. */
  991. int relative_rssi;
  992. /**
  993. * relative_adjust_band - Band in which RSSI is to be adjusted
  994. */
  995. enum set_band relative_adjust_band;
  996. /**
  997. * relative_adjust_rssi - RSSI adjustment
  998. *
  999. * An amount of relative_adjust_rssi should be added to the
  1000. * BSSs that belong to the relative_adjust_band while comparing
  1001. * with other bands for BSS reporting.
  1002. */
  1003. int relative_adjust_rssi;
  1004. } srp;
  1005. /* RIC elements for FT protocol */
  1006. struct wpabuf *ric_ies;
  1007. };
  1008. /* wpa_supplicant.c */
  1009. void wpa_supplicant_apply_ht_overrides(
  1010. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1011. struct wpa_driver_associate_params *params);
  1012. void wpa_supplicant_apply_vht_overrides(
  1013. struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
  1014. struct wpa_driver_associate_params *params);
  1015. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1016. int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
  1017. struct wpa_ssid *ssid);
  1018. int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s);
  1019. const char * wpa_supplicant_state_txt(enum wpa_states state);
  1020. int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s);
  1021. int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s);
  1022. int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
  1023. struct wpa_bss *bss, struct wpa_ssid *ssid,
  1024. u8 *wpa_ie, size_t *wpa_ie_len);
  1025. void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
  1026. struct wpa_bss *bss,
  1027. struct wpa_ssid *ssid);
  1028. void wpa_supplicant_set_non_wpa_policy(struct wpa_supplicant *wpa_s,
  1029. struct wpa_ssid *ssid);
  1030. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s);
  1031. void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr);
  1032. void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
  1033. int sec, int usec);
  1034. void wpa_supplicant_reinit_autoscan(struct wpa_supplicant *wpa_s);
  1035. void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
  1036. enum wpa_states state);
  1037. struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
  1038. const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
  1039. void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
  1040. void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
  1041. int reason_code);
  1042. struct wpa_ssid * wpa_supplicant_add_network(struct wpa_supplicant *wpa_s);
  1043. int wpa_supplicant_remove_network(struct wpa_supplicant *wpa_s, int id);
  1044. void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
  1045. struct wpa_ssid *ssid);
  1046. void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
  1047. struct wpa_ssid *ssid);
  1048. void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
  1049. struct wpa_ssid *ssid);
  1050. int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
  1051. const char *pkcs11_engine_path,
  1052. const char *pkcs11_module_path);
  1053. int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s,
  1054. int ap_scan);
  1055. int wpa_supplicant_set_bss_expiration_age(struct wpa_supplicant *wpa_s,
  1056. unsigned int expire_age);
  1057. int wpa_supplicant_set_bss_expiration_count(struct wpa_supplicant *wpa_s,
  1058. unsigned int expire_count);
  1059. int wpa_supplicant_set_scan_interval(struct wpa_supplicant *wpa_s,
  1060. int scan_interval);
  1061. int wpa_supplicant_set_debug_params(struct wpa_global *global,
  1062. int debug_level, int debug_timestamp,
  1063. int debug_show_keys);
  1064. void free_hw_features(struct wpa_supplicant *wpa_s);
  1065. void wpa_show_license(void);
  1066. struct wpa_interface * wpa_supplicant_match_iface(struct wpa_global *global,
  1067. const char *ifname);
  1068. struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
  1069. struct wpa_interface *iface,
  1070. struct wpa_supplicant *parent);
  1071. int wpa_supplicant_remove_iface(struct wpa_global *global,
  1072. struct wpa_supplicant *wpa_s,
  1073. int terminate);
  1074. struct wpa_supplicant * wpa_supplicant_get_iface(struct wpa_global *global,
  1075. const char *ifname);
  1076. struct wpa_global * wpa_supplicant_init(struct wpa_params *params);
  1077. int wpa_supplicant_run(struct wpa_global *global);
  1078. void wpa_supplicant_deinit(struct wpa_global *global);
  1079. int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
  1080. struct wpa_ssid *ssid);
  1081. void wpa_supplicant_terminate_proc(struct wpa_global *global);
  1082. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  1083. const u8 *buf, size_t len);
  1084. void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
  1085. void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
  1086. void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1087. int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
  1088. int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);
  1089. void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason);
  1090. void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s,
  1091. struct wpa_ssid *ssid, int clear_failures);
  1092. int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1093. int disallowed_ssid(struct wpa_supplicant *wpa_s, const u8 *ssid,
  1094. size_t ssid_len);
  1095. void wpas_request_connection(struct wpa_supplicant *wpa_s);
  1096. void wpas_request_disconnection(struct wpa_supplicant *wpa_s);
  1097. int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen);
  1098. int wpas_update_random_addr(struct wpa_supplicant *wpa_s, int style);
  1099. int wpas_update_random_addr_disassoc(struct wpa_supplicant *wpa_s);
  1100. void add_freq(int *freqs, int *num_freqs, int freq);
  1101. void wpas_rrm_reset(struct wpa_supplicant *wpa_s);
  1102. void wpas_rrm_process_neighbor_rep(struct wpa_supplicant *wpa_s,
  1103. const u8 *report, size_t report_len);
  1104. int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
  1105. const struct wpa_ssid_value *ssid,
  1106. int lci, int civic,
  1107. void (*cb)(void *ctx,
  1108. struct wpabuf *neighbor_rep),
  1109. void *cb_ctx);
  1110. void wpas_rrm_handle_radio_measurement_request(struct wpa_supplicant *wpa_s,
  1111. const u8 *src,
  1112. const u8 *frame, size_t len);
  1113. void wpas_rrm_handle_link_measurement_request(struct wpa_supplicant *wpa_s,
  1114. const u8 *src,
  1115. const u8 *frame, size_t len,
  1116. int rssi);
  1117. int wpas_beacon_rep_scan_process(struct wpa_supplicant *wpa_s,
  1118. struct wpa_scan_results *scan_res,
  1119. struct scan_info *info);
  1120. void wpas_clear_beacon_rep_data(struct wpa_supplicant *wpa_s);
  1121. void wpas_flush_fils_hlp_req(struct wpa_supplicant *wpa_s);
  1122. /* MBO functions */
  1123. int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len);
  1124. const u8 * wpas_mbo_get_bss_attr(struct wpa_bss *bss, enum mbo_attr_id attr);
  1125. int wpas_mbo_update_non_pref_chan(struct wpa_supplicant *wpa_s,
  1126. const char *non_pref_chan);
  1127. void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);
  1128. void wpas_mbo_ie_trans_req(struct wpa_supplicant *wpa_s, const u8 *ie,
  1129. size_t len);
  1130. size_t wpas_mbo_ie_bss_trans_reject(struct wpa_supplicant *wpa_s, u8 *pos,
  1131. size_t len,
  1132. enum mbo_transition_reject_reason reason);
  1133. void wpas_mbo_update_cell_capa(struct wpa_supplicant *wpa_s, u8 mbo_cell_capa);
  1134. struct wpabuf * mbo_build_anqp_buf(struct wpa_supplicant *wpa_s,
  1135. struct wpa_bss *bss, u32 mbo_subtypes);
  1136. void mbo_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
  1137. struct wpa_bss *bss, const u8 *sa,
  1138. const u8 *data, size_t slen);
  1139. /* op_classes.c */
  1140. enum chan_allowed {
  1141. NOT_ALLOWED, NO_IR, ALLOWED
  1142. };
  1143. enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 channel,
  1144. u8 bw);
  1145. size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos,
  1146. size_t len);
  1147. /**
  1148. * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
  1149. * @wpa_s: Pointer to wpa_supplicant data
  1150. * @ssid: Pointer to the network block the reply is for
  1151. * @field: field the response is a reply for
  1152. * @value: value (ie, password, etc) for @field
  1153. * Returns: 0 on success, non-zero on error
  1154. *
  1155. * Helper function to handle replies to control interface requests.
  1156. */
  1157. int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
  1158. struct wpa_ssid *ssid,
  1159. const char *field,
  1160. const char *value);
  1161. void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
  1162. const struct wpa_ssid *ssid,
  1163. struct hostapd_freq_params *freq);
  1164. /* events.c */
  1165. void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);
  1166. int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
  1167. struct wpa_bss *selected,
  1168. struct wpa_ssid *ssid);
  1169. void wpa_supplicant_stop_countermeasures(void *eloop_ctx, void *sock_ctx);
  1170. void wpa_supplicant_delayed_mic_error_report(void *eloop_ctx, void *sock_ctx);
  1171. void wnm_bss_keep_alive_deinit(struct wpa_supplicant *wpa_s);
  1172. int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s);
  1173. struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
  1174. struct wpa_ssid **selected_ssid);
  1175. int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1176. /* eap_register.c */
  1177. int eap_register_methods(void);
  1178. /**
  1179. * Utility method to tell if a given network is for persistent group storage
  1180. * @ssid: Network object
  1181. * Returns: 1 if network is a persistent group, 0 otherwise
  1182. */
  1183. static inline int network_is_persistent_group(struct wpa_ssid *ssid)
  1184. {
  1185. return ssid->disabled == 2 && ssid->p2p_persistent_group;
  1186. }
  1187. int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1188. int wpas_get_ssid_pmf(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
  1189. int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
  1190. void dump_freq_data(struct wpa_supplicant *wpa_s, const char *title,
  1191. struct wpa_used_freq_data *freqs_data,
  1192. unsigned int len);
  1193. int get_shared_radio_freqs_data(struct wpa_supplicant *wpa_s,
  1194. struct wpa_used_freq_data *freqs_data,
  1195. unsigned int len);
  1196. int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
  1197. int *freq_array, unsigned int len);
  1198. void wpas_network_reenabled(void *eloop_ctx, void *timeout_ctx);
  1199. void wpas_vendor_elem_update(struct wpa_supplicant *wpa_s);
  1200. struct wpa_supplicant * wpas_vendor_elem(struct wpa_supplicant *wpa_s,
  1201. enum wpa_vendor_elem_frame frame);
  1202. int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame,
  1203. const u8 *elem, size_t len);
  1204. #ifdef CONFIG_FST
  1205. struct fst_wpa_obj;
  1206. void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s,
  1207. struct fst_wpa_obj *iface_obj);
  1208. #endif /* CONFIG_FST */
  1209. int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd);
  1210. struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
  1211. u16 num_modes, enum hostapd_hw_mode mode);
  1212. void wpa_bss_tmp_disallow(struct wpa_supplicant *wpa_s, const u8 *bssid,
  1213. unsigned int sec);
  1214. int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s, const u8 *bssid);
  1215. struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
  1216. int i, struct wpa_bss *bss,
  1217. struct wpa_ssid *group,
  1218. int only_first_ssid, int debug_print);
  1219. int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s,
  1220. enum wpa_driver_if_type if_type,
  1221. unsigned int *num,
  1222. unsigned int *freq_list);
  1223. #endif /* WPA_SUPPLICANT_I_H */