config.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. /*
  2. * WPA Supplicant / Configuration file structures
  3. * Copyright (c) 2003-2012, 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 CONFIG_H
  9. #define CONFIG_H
  10. #define DEFAULT_EAPOL_VERSION 1
  11. #ifdef CONFIG_NO_SCAN_PROCESSING
  12. #define DEFAULT_AP_SCAN 2
  13. #else /* CONFIG_NO_SCAN_PROCESSING */
  14. #define DEFAULT_AP_SCAN 1
  15. #endif /* CONFIG_NO_SCAN_PROCESSING */
  16. #define DEFAULT_FAST_REAUTH 1
  17. #define DEFAULT_P2P_GO_INTENT 7
  18. #define DEFAULT_P2P_INTRA_BSS 1
  19. #define DEFAULT_P2P_GO_MAX_INACTIVITY (5 * 60)
  20. #define DEFAULT_P2P_OPTIMIZE_LISTEN_CHAN 0
  21. #define DEFAULT_BSS_MAX_COUNT 200
  22. #define DEFAULT_BSS_EXPIRATION_AGE 180
  23. #define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2
  24. #define DEFAULT_MAX_NUM_STA 128
  25. #define DEFAULT_ACCESS_NETWORK_TYPE 15
  26. #define DEFAULT_SCAN_CUR_FREQ 0
  27. #define DEFAULT_P2P_SEARCH_DELAY 500
  28. #include "config_ssid.h"
  29. #include "wps/wps.h"
  30. #include "common/ieee802_11_common.h"
  31. struct wpa_cred {
  32. /**
  33. * next - Next credential in the list
  34. *
  35. * This pointer can be used to iterate over all credentials. The head
  36. * of this list is stored in the cred field of struct wpa_config.
  37. */
  38. struct wpa_cred *next;
  39. /**
  40. * id - Unique id for the credential
  41. *
  42. * This identifier is used as a unique identifier for each credential
  43. * block when using the control interface. Each credential is allocated
  44. * an id when it is being created, either when reading the
  45. * configuration file or when a new credential is added through the
  46. * control interface.
  47. */
  48. int id;
  49. /**
  50. * temporary - Whether this credential is temporary and not to be saved
  51. */
  52. int temporary;
  53. /**
  54. * priority - Priority group
  55. *
  56. * By default, all networks and credentials get the same priority group
  57. * (0). This field can be used to give higher priority for credentials
  58. * (and similarly in struct wpa_ssid for network blocks) to change the
  59. * Interworking automatic networking selection behavior. The matching
  60. * network (based on either an enabled network block or a credential)
  61. * with the highest priority value will be selected.
  62. */
  63. int priority;
  64. /**
  65. * pcsc - Use PC/SC and SIM/USIM card
  66. */
  67. int pcsc;
  68. /**
  69. * realm - Home Realm for Interworking
  70. */
  71. char *realm;
  72. /**
  73. * username - Username for Interworking network selection
  74. */
  75. char *username;
  76. /**
  77. * password - Password for Interworking network selection
  78. */
  79. char *password;
  80. /**
  81. * ext_password - Whether password is a name for external storage
  82. */
  83. int ext_password;
  84. /**
  85. * ca_cert - CA certificate for Interworking network selection
  86. */
  87. char *ca_cert;
  88. /**
  89. * client_cert - File path to client certificate file (PEM/DER)
  90. *
  91. * This field is used with Interworking networking selection for a case
  92. * where client certificate/private key is used for authentication
  93. * (EAP-TLS). Full path to the file should be used since working
  94. * directory may change when wpa_supplicant is run in the background.
  95. *
  96. * Alternatively, a named configuration blob can be used by setting
  97. * this to blob://blob_name.
  98. */
  99. char *client_cert;
  100. /**
  101. * private_key - File path to client private key file (PEM/DER/PFX)
  102. *
  103. * When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be
  104. * commented out. Both the private key and certificate will be read
  105. * from the PKCS#12 file in this case. Full path to the file should be
  106. * used since working directory may change when wpa_supplicant is run
  107. * in the background.
  108. *
  109. * Windows certificate store can be used by leaving client_cert out and
  110. * configuring private_key in one of the following formats:
  111. *
  112. * cert://substring_to_match
  113. *
  114. * hash://certificate_thumbprint_in_hex
  115. *
  116. * For example: private_key="hash://63093aa9c47f56ae88334c7b65a4"
  117. *
  118. * Note that when running wpa_supplicant as an application, the user
  119. * certificate store (My user account) is used, whereas computer store
  120. * (Computer account) is used when running wpasvc as a service.
  121. *
  122. * Alternatively, a named configuration blob can be used by setting
  123. * this to blob://blob_name.
  124. */
  125. char *private_key;
  126. /**
  127. * private_key_passwd - Password for private key file
  128. */
  129. char *private_key_passwd;
  130. /**
  131. * imsi - IMSI in <MCC> | <MNC> | '-' | <MSIN> format
  132. */
  133. char *imsi;
  134. /**
  135. * milenage - Milenage parameters for SIM/USIM simulator in
  136. * <Ki>:<OPc>:<SQN> format
  137. */
  138. char *milenage;
  139. /**
  140. * domain_suffix_match - Constraint for server domain name
  141. *
  142. * If set, this FQDN is used as a suffix match requirement for the AAA
  143. * server certificate in SubjectAltName dNSName element(s). If a
  144. * matching dNSName is found, this constraint is met. If no dNSName
  145. * values are present, this constraint is matched against SubjetName CN
  146. * using same suffix match comparison. Suffix match here means that the
  147. * host/domain name is compared one label at a time starting from the
  148. * top-level domain and all the labels in @domain_suffix_match shall be
  149. * included in the certificate. The certificate may include additional
  150. * sub-level labels in addition to the required labels.
  151. *
  152. * For example, domain_suffix_match=example.com would match
  153. * test.example.com but would not match test-example.com.
  154. */
  155. char *domain_suffix_match;
  156. /**
  157. * domain - Home service provider FQDN(s)
  158. *
  159. * This is used to compare against the Domain Name List to figure out
  160. * whether the AP is operated by the Home SP. Multiple domain entries
  161. * can be used to configure alternative FQDNs that will be considered
  162. * home networks.
  163. */
  164. char **domain;
  165. /**
  166. * num_domain - Number of FQDNs in the domain array
  167. */
  168. size_t num_domain;
  169. /**
  170. * roaming_consortium - Roaming Consortium OI
  171. *
  172. * If roaming_consortium_len is non-zero, this field contains the
  173. * Roaming Consortium OI that can be used to determine which access
  174. * points support authentication with this credential. This is an
  175. * alternative to the use of the realm parameter. When using Roaming
  176. * Consortium to match the network, the EAP parameters need to be
  177. * pre-configured with the credential since the NAI Realm information
  178. * may not be available or fetched.
  179. */
  180. u8 roaming_consortium[15];
  181. /**
  182. * roaming_consortium_len - Length of roaming_consortium
  183. */
  184. size_t roaming_consortium_len;
  185. u8 required_roaming_consortium[15];
  186. size_t required_roaming_consortium_len;
  187. /**
  188. * eap_method - EAP method to use
  189. *
  190. * Pre-configured EAP method to use with this credential or %NULL to
  191. * indicate no EAP method is selected, i.e., the method will be
  192. * selected automatically based on ANQP information.
  193. */
  194. struct eap_method_type *eap_method;
  195. /**
  196. * phase1 - Phase 1 (outer authentication) parameters
  197. *
  198. * Pre-configured EAP parameters or %NULL.
  199. */
  200. char *phase1;
  201. /**
  202. * phase2 - Phase 2 (inner authentication) parameters
  203. *
  204. * Pre-configured EAP parameters or %NULL.
  205. */
  206. char *phase2;
  207. struct excluded_ssid {
  208. u8 ssid[MAX_SSID_LEN];
  209. size_t ssid_len;
  210. } *excluded_ssid;
  211. size_t num_excluded_ssid;
  212. struct roaming_partner {
  213. char fqdn[128];
  214. int exact_match;
  215. u8 priority;
  216. char country[3];
  217. } *roaming_partner;
  218. size_t num_roaming_partner;
  219. int update_identifier;
  220. /**
  221. * provisioning_sp - FQDN of the SP that provisioned the credential
  222. */
  223. char *provisioning_sp;
  224. /**
  225. * sp_priority - Credential priority within a provisioning SP
  226. *
  227. * This is the priority of the credential among all credentials
  228. * provisionined by the same SP (i.e., for entries that have identical
  229. * provisioning_sp value). The range of this priority is 0-255 with 0
  230. * being the highest and 255 the lower priority.
  231. */
  232. int sp_priority;
  233. unsigned int min_dl_bandwidth_home;
  234. unsigned int min_ul_bandwidth_home;
  235. unsigned int min_dl_bandwidth_roaming;
  236. unsigned int min_ul_bandwidth_roaming;
  237. /**
  238. * max_bss_load - Maximum BSS Load Channel Utilization (1..255)
  239. * This value is used as the maximum channel utilization for network
  240. * selection purposes for home networks. If the AP does not advertise
  241. * BSS Load or if the limit would prevent any connection, this
  242. * constraint will be ignored.
  243. */
  244. unsigned int max_bss_load;
  245. unsigned int num_req_conn_capab;
  246. u8 *req_conn_capab_proto;
  247. int **req_conn_capab_port;
  248. /**
  249. * ocsp - Whether to use/require OCSP to check server certificate
  250. *
  251. * 0 = do not use OCSP stapling (TLS certificate status extension)
  252. * 1 = try to use OCSP stapling, but not require response
  253. * 2 = require valid OCSP stapling response
  254. */
  255. int ocsp;
  256. /**
  257. * sim_num - User selected SIM identifier
  258. *
  259. * This variable is used for identifying which SIM is used if the system
  260. * has more than one.
  261. */
  262. int sim_num;
  263. };
  264. #define CFG_CHANGED_DEVICE_NAME BIT(0)
  265. #define CFG_CHANGED_CONFIG_METHODS BIT(1)
  266. #define CFG_CHANGED_DEVICE_TYPE BIT(2)
  267. #define CFG_CHANGED_OS_VERSION BIT(3)
  268. #define CFG_CHANGED_UUID BIT(4)
  269. #define CFG_CHANGED_COUNTRY BIT(5)
  270. #define CFG_CHANGED_SEC_DEVICE_TYPE BIT(6)
  271. #define CFG_CHANGED_P2P_SSID_POSTFIX BIT(7)
  272. #define CFG_CHANGED_WPS_STRING BIT(8)
  273. #define CFG_CHANGED_P2P_INTRA_BSS BIT(9)
  274. #define CFG_CHANGED_VENDOR_EXTENSION BIT(10)
  275. #define CFG_CHANGED_P2P_LISTEN_CHANNEL BIT(11)
  276. #define CFG_CHANGED_P2P_OPER_CHANNEL BIT(12)
  277. #define CFG_CHANGED_P2P_PREF_CHAN BIT(13)
  278. #define CFG_CHANGED_EXT_PW_BACKEND BIT(14)
  279. #define CFG_CHANGED_NFC_PASSWORD_TOKEN BIT(15)
  280. /**
  281. * struct wpa_config - wpa_supplicant configuration data
  282. *
  283. * This data structure is presents the per-interface (radio) configuration
  284. * data. In many cases, there is only one struct wpa_config instance, but if
  285. * more than one network interface is being controlled, one instance is used
  286. * for each.
  287. */
  288. struct wpa_config {
  289. /**
  290. * ssid - Head of the global network list
  291. *
  292. * This is the head for the list of all the configured networks.
  293. */
  294. struct wpa_ssid *ssid;
  295. /**
  296. * pssid - Per-priority network lists (in priority order)
  297. */
  298. struct wpa_ssid **pssid;
  299. /**
  300. * num_prio - Number of different priorities used in the pssid lists
  301. *
  302. * This indicates how many per-priority network lists are included in
  303. * pssid.
  304. */
  305. int num_prio;
  306. /**
  307. * cred - Head of the credential list
  308. *
  309. * This is the head for the list of all the configured credentials.
  310. */
  311. struct wpa_cred *cred;
  312. /**
  313. * eapol_version - IEEE 802.1X/EAPOL version number
  314. *
  315. * wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which
  316. * defines EAPOL version 2. However, there are many APs that do not
  317. * handle the new version number correctly (they seem to drop the
  318. * frames completely). In order to make wpa_supplicant interoperate
  319. * with these APs, the version number is set to 1 by default. This
  320. * configuration value can be used to set it to the new version (2).
  321. */
  322. int eapol_version;
  323. /**
  324. * ap_scan - AP scanning/selection
  325. *
  326. * By default, wpa_supplicant requests driver to perform AP
  327. * scanning and then uses the scan results to select a
  328. * suitable AP. Another alternative is to allow the driver to
  329. * take care of AP scanning and selection and use
  330. * wpa_supplicant just to process EAPOL frames based on IEEE
  331. * 802.11 association information from the driver.
  332. *
  333. * 1: wpa_supplicant initiates scanning and AP selection (default).
  334. *
  335. * 0: Driver takes care of scanning, AP selection, and IEEE 802.11
  336. * association parameters (e.g., WPA IE generation); this mode can
  337. * also be used with non-WPA drivers when using IEEE 802.1X mode;
  338. * do not try to associate with APs (i.e., external program needs
  339. * to control association). This mode must also be used when using
  340. * wired Ethernet drivers.
  341. *
  342. * 2: like 0, but associate with APs using security policy and SSID
  343. * (but not BSSID); this can be used, e.g., with ndiswrapper and NDIS
  344. * drivers to enable operation with hidden SSIDs and optimized roaming;
  345. * in this mode, the network blocks in the configuration are tried
  346. * one by one until the driver reports successful association; each
  347. * network block should have explicit security policy (i.e., only one
  348. * option in the lists) for key_mgmt, pairwise, group, proto variables.
  349. */
  350. int ap_scan;
  351. /**
  352. * bgscan - Background scan and roaming parameters or %NULL if none
  353. *
  354. * This is an optional set of parameters for background scanning and
  355. * roaming within a network (ESS). For more detailed information see
  356. * ssid block documentation.
  357. *
  358. * The variable defines default bgscan behavior for all BSS station
  359. * networks except for those which have their own bgscan configuration.
  360. */
  361. char *bgscan;
  362. /**
  363. * disable_scan_offload - Disable automatic offloading of scan requests
  364. *
  365. * By default, %wpa_supplicant tries to offload scanning if the driver
  366. * indicates support for this (sched_scan). This configuration
  367. * parameter can be used to disable this offloading mechanism.
  368. */
  369. int disable_scan_offload;
  370. /**
  371. * ctrl_interface - Parameters for the control interface
  372. *
  373. * If this is specified, %wpa_supplicant will open a control interface
  374. * that is available for external programs to manage %wpa_supplicant.
  375. * The meaning of this string depends on which control interface
  376. * mechanism is used. For all cases, the existence of this parameter
  377. * in configuration is used to determine whether the control interface
  378. * is enabled.
  379. *
  380. * For UNIX domain sockets (default on Linux and BSD): This is a
  381. * directory that will be created for UNIX domain sockets for listening
  382. * to requests from external programs (CLI/GUI, etc.) for status
  383. * information and configuration. The socket file will be named based
  384. * on the interface name, so multiple %wpa_supplicant processes can be
  385. * run at the same time if more than one interface is used.
  386. * /var/run/wpa_supplicant is the recommended directory for sockets and
  387. * by default, wpa_cli will use it when trying to connect with
  388. * %wpa_supplicant.
  389. *
  390. * Access control for the control interface can be configured
  391. * by setting the directory to allow only members of a group
  392. * to use sockets. This way, it is possible to run
  393. * %wpa_supplicant as root (since it needs to change network
  394. * configuration and open raw sockets) and still allow GUI/CLI
  395. * components to be run as non-root users. However, since the
  396. * control interface can be used to change the network
  397. * configuration, this access needs to be protected in many
  398. * cases. By default, %wpa_supplicant is configured to use gid
  399. * 0 (root). If you want to allow non-root users to use the
  400. * control interface, add a new group and change this value to
  401. * match with that group. Add users that should have control
  402. * interface access to this group.
  403. *
  404. * When configuring both the directory and group, use following format:
  405. * DIR=/var/run/wpa_supplicant GROUP=wheel
  406. * DIR=/var/run/wpa_supplicant GROUP=0
  407. * (group can be either group name or gid)
  408. *
  409. * For UDP connections (default on Windows): The value will be ignored.
  410. * This variable is just used to select that the control interface is
  411. * to be created. The value can be set to, e.g., udp
  412. * (ctrl_interface=udp).
  413. *
  414. * For Windows Named Pipe: This value can be used to set the security
  415. * descriptor for controlling access to the control interface. Security
  416. * descriptor can be set using Security Descriptor String Format (see
  417. * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/security_descriptor_string_format.asp).
  418. * The descriptor string needs to be prefixed with SDDL=. For example,
  419. * ctrl_interface=SDDL=D: would set an empty DACL (which will reject
  420. * all connections).
  421. */
  422. char *ctrl_interface;
  423. /**
  424. * ctrl_interface_group - Control interface group (DEPRECATED)
  425. *
  426. * This variable is only used for backwards compatibility. Group for
  427. * UNIX domain sockets should now be specified using GROUP=group in
  428. * ctrl_interface variable.
  429. */
  430. char *ctrl_interface_group;
  431. /**
  432. * fast_reauth - EAP fast re-authentication (session resumption)
  433. *
  434. * By default, fast re-authentication is enabled for all EAP methods
  435. * that support it. This variable can be used to disable fast
  436. * re-authentication (by setting fast_reauth=0). Normally, there is no
  437. * need to disable fast re-authentication.
  438. */
  439. int fast_reauth;
  440. /**
  441. * opensc_engine_path - Path to the OpenSSL engine for opensc
  442. *
  443. * This is an OpenSSL specific configuration option for loading OpenSC
  444. * engine (engine_opensc.so); if %NULL, this engine is not loaded.
  445. */
  446. char *opensc_engine_path;
  447. /**
  448. * pkcs11_engine_path - Path to the OpenSSL engine for PKCS#11
  449. *
  450. * This is an OpenSSL specific configuration option for loading PKCS#11
  451. * engine (engine_pkcs11.so); if %NULL, this engine is not loaded.
  452. */
  453. char *pkcs11_engine_path;
  454. /**
  455. * pkcs11_module_path - Path to the OpenSSL OpenSC/PKCS#11 module
  456. *
  457. * This is an OpenSSL specific configuration option for configuring
  458. * path to OpenSC/PKCS#11 engine (opensc-pkcs11.so); if %NULL, this
  459. * module is not loaded.
  460. */
  461. char *pkcs11_module_path;
  462. /**
  463. * pcsc_reader - PC/SC reader name prefix
  464. *
  465. * If not %NULL, PC/SC reader with a name that matches this prefix is
  466. * initialized for SIM/USIM access. Empty string can be used to match
  467. * the first available reader.
  468. */
  469. char *pcsc_reader;
  470. /**
  471. * pcsc_pin - PIN for USIM, GSM SIM, and smartcards
  472. *
  473. * This field is used to configure PIN for SIM/USIM for EAP-SIM and
  474. * EAP-AKA. If left out, this will be asked through control interface.
  475. */
  476. char *pcsc_pin;
  477. /**
  478. * external_sim - Use external processing for SIM/USIM operations
  479. */
  480. int external_sim;
  481. /**
  482. * driver_param - Driver interface parameters
  483. *
  484. * This text string is passed to the selected driver interface with the
  485. * optional struct wpa_driver_ops::set_param() handler. This can be
  486. * used to configure driver specific options without having to add new
  487. * driver interface functionality.
  488. */
  489. char *driver_param;
  490. /**
  491. * dot11RSNAConfigPMKLifetime - Maximum lifetime of a PMK
  492. *
  493. * dot11 MIB variable for the maximum lifetime of a PMK in the PMK
  494. * cache (unit: seconds).
  495. */
  496. unsigned int dot11RSNAConfigPMKLifetime;
  497. /**
  498. * dot11RSNAConfigPMKReauthThreshold - PMK re-authentication threshold
  499. *
  500. * dot11 MIB variable for the percentage of the PMK lifetime
  501. * that should expire before an IEEE 802.1X reauthentication occurs.
  502. */
  503. unsigned int dot11RSNAConfigPMKReauthThreshold;
  504. /**
  505. * dot11RSNAConfigSATimeout - Security association timeout
  506. *
  507. * dot11 MIB variable for the maximum time a security association
  508. * shall take to set up (unit: seconds).
  509. */
  510. unsigned int dot11RSNAConfigSATimeout;
  511. /**
  512. * update_config - Is wpa_supplicant allowed to update configuration
  513. *
  514. * This variable control whether wpa_supplicant is allow to re-write
  515. * its configuration with wpa_config_write(). If this is zero,
  516. * configuration data is only changed in memory and the external data
  517. * is not overriden. If this is non-zero, wpa_supplicant will update
  518. * the configuration data (e.g., a file) whenever configuration is
  519. * changed. This update may replace the old configuration which can
  520. * remove comments from it in case of a text file configuration.
  521. */
  522. int update_config;
  523. /**
  524. * blobs - Configuration blobs
  525. */
  526. struct wpa_config_blob *blobs;
  527. /**
  528. * uuid - Universally Unique IDentifier (UUID; see RFC 4122) for WPS
  529. */
  530. u8 uuid[16];
  531. /**
  532. * device_name - Device Name (WPS)
  533. * User-friendly description of device; up to 32 octets encoded in
  534. * UTF-8
  535. */
  536. char *device_name;
  537. /**
  538. * manufacturer - Manufacturer (WPS)
  539. * The manufacturer of the device (up to 64 ASCII characters)
  540. */
  541. char *manufacturer;
  542. /**
  543. * model_name - Model Name (WPS)
  544. * Model of the device (up to 32 ASCII characters)
  545. */
  546. char *model_name;
  547. /**
  548. * model_number - Model Number (WPS)
  549. * Additional device description (up to 32 ASCII characters)
  550. */
  551. char *model_number;
  552. /**
  553. * serial_number - Serial Number (WPS)
  554. * Serial number of the device (up to 32 characters)
  555. */
  556. char *serial_number;
  557. /**
  558. * device_type - Primary Device Type (WPS)
  559. */
  560. u8 device_type[WPS_DEV_TYPE_LEN];
  561. /**
  562. * config_methods - Config Methods
  563. *
  564. * This is a space-separated list of supported WPS configuration
  565. * methods. For example, "label virtual_display virtual_push_button
  566. * keypad".
  567. * Available methods: usba ethernet label display ext_nfc_token
  568. * int_nfc_token nfc_interface push_button keypad
  569. * virtual_display physical_display
  570. * virtual_push_button physical_push_button.
  571. */
  572. char *config_methods;
  573. /**
  574. * os_version - OS Version (WPS)
  575. * 4-octet operating system version number
  576. */
  577. u8 os_version[4];
  578. /**
  579. * country - Country code
  580. *
  581. * This is the ISO/IEC alpha2 country code for which we are operating
  582. * in
  583. */
  584. char country[2];
  585. /**
  586. * wps_cred_processing - Credential processing
  587. *
  588. * 0 = process received credentials internally
  589. * 1 = do not process received credentials; just pass them over
  590. * ctrl_iface to external program(s)
  591. * 2 = process received credentials internally and pass them over
  592. * ctrl_iface to external program(s)
  593. */
  594. int wps_cred_processing;
  595. #define MAX_SEC_DEVICE_TYPES 5
  596. /**
  597. * sec_device_types - Secondary Device Types (P2P)
  598. */
  599. u8 sec_device_type[MAX_SEC_DEVICE_TYPES][WPS_DEV_TYPE_LEN];
  600. int num_sec_device_types;
  601. int p2p_listen_reg_class;
  602. int p2p_listen_channel;
  603. int p2p_oper_reg_class;
  604. int p2p_oper_channel;
  605. int p2p_go_intent;
  606. char *p2p_ssid_postfix;
  607. int persistent_reconnect;
  608. int p2p_intra_bss;
  609. unsigned int num_p2p_pref_chan;
  610. struct p2p_channel *p2p_pref_chan;
  611. struct wpa_freq_range_list p2p_no_go_freq;
  612. int p2p_add_cli_chan;
  613. int p2p_ignore_shared_freq;
  614. int p2p_optimize_listen_chan;
  615. struct wpabuf *wps_vendor_ext_m1;
  616. #define MAX_WPS_VENDOR_EXT 10
  617. /**
  618. * wps_vendor_ext - Vendor extension attributes in WPS
  619. */
  620. struct wpabuf *wps_vendor_ext[MAX_WPS_VENDOR_EXT];
  621. /**
  622. * p2p_group_idle - Maximum idle time in seconds for P2P group
  623. *
  624. * This value controls how long a P2P group is maintained after there
  625. * is no other members in the group. As a GO, this means no associated
  626. * stations in the group. As a P2P client, this means no GO seen in
  627. * scan results. The maximum idle time is specified in seconds with 0
  628. * indicating no time limit, i.e., the P2P group remains in active
  629. * state indefinitely until explicitly removed. As a P2P client, the
  630. * maximum idle time of P2P_MAX_CLIENT_IDLE seconds is enforced, i.e.,
  631. * this parameter is mainly meant for GO use and for P2P client, it can
  632. * only be used to reduce the default timeout to smaller value. A
  633. * special value -1 can be used to configure immediate removal of the
  634. * group for P2P client role on any disconnection after the data
  635. * connection has been established.
  636. */
  637. int p2p_group_idle;
  638. /**
  639. * bss_max_count - Maximum number of BSS entries to keep in memory
  640. */
  641. unsigned int bss_max_count;
  642. /**
  643. * bss_expiration_age - BSS entry age after which it can be expired
  644. *
  645. * This value controls the time in seconds after which a BSS entry
  646. * gets removed if it has not been updated or is not in use.
  647. */
  648. unsigned int bss_expiration_age;
  649. /**
  650. * bss_expiration_scan_count - Expire BSS after number of scans
  651. *
  652. * If the BSS entry has not been seen in this many scans, it will be
  653. * removed. A value of 1 means that entry is removed after the first
  654. * scan in which the BSSID is not seen. Larger values can be used
  655. * to avoid BSS entries disappearing if they are not visible in
  656. * every scan (e.g., low signal quality or interference).
  657. */
  658. unsigned int bss_expiration_scan_count;
  659. /**
  660. * filter_ssids - SSID-based scan result filtering
  661. *
  662. * 0 = do not filter scan results
  663. * 1 = only include configured SSIDs in scan results/BSS table
  664. */
  665. int filter_ssids;
  666. /**
  667. * filter_rssi - RSSI-based scan result filtering
  668. *
  669. * 0 = do not filter scan results
  670. * -n = filter scan results below -n dBm
  671. */
  672. int filter_rssi;
  673. /**
  674. * max_num_sta - Maximum number of STAs in an AP/P2P GO
  675. */
  676. unsigned int max_num_sta;
  677. /**
  678. * freq_list - Array of allowed scan frequencies or %NULL for all
  679. *
  680. * This is an optional zero-terminated array of frequencies in
  681. * megahertz (MHz) to allow for narrowing scanning range.
  682. */
  683. int *freq_list;
  684. /**
  685. * scan_cur_freq - Whether to scan only the current channel
  686. *
  687. * If true, attempt to scan only the current channel if any other
  688. * VIFs on this radio are already associated on a particular channel.
  689. */
  690. int scan_cur_freq;
  691. /**
  692. * changed_parameters - Bitmap of changed parameters since last update
  693. */
  694. unsigned int changed_parameters;
  695. /**
  696. * disassoc_low_ack - Disassocicate stations with massive packet loss
  697. */
  698. int disassoc_low_ack;
  699. /**
  700. * interworking - Whether Interworking (IEEE 802.11u) is enabled
  701. */
  702. int interworking;
  703. /**
  704. * access_network_type - Access Network Type
  705. *
  706. * When Interworking is enabled, scans will be limited to APs that
  707. * advertise the specified Access Network Type (0..15; with 15
  708. * indicating wildcard match).
  709. */
  710. int access_network_type;
  711. /**
  712. * hessid - Homogenous ESS identifier
  713. *
  714. * If this is set (any octet is non-zero), scans will be used to
  715. * request response only from BSSes belonging to the specified
  716. * Homogeneous ESS. This is used only if interworking is enabled.
  717. */
  718. u8 hessid[ETH_ALEN];
  719. /**
  720. * hs20 - Hotspot 2.0
  721. */
  722. int hs20;
  723. /**
  724. * pbc_in_m1 - AP mode WPS probing workaround for PBC with Windows 7
  725. *
  726. * Windows 7 uses incorrect way of figuring out AP's WPS capabilities
  727. * by acting as a Registrar and using M1 from the AP. The config
  728. * methods attribute in that message is supposed to indicate only the
  729. * configuration method supported by the AP in Enrollee role, i.e., to
  730. * add an external Registrar. For that case, PBC shall not be used and
  731. * as such, the PushButton config method is removed from M1 by default.
  732. * If pbc_in_m1=1 is included in the configuration file, the PushButton
  733. * config method is left in M1 (if included in config_methods
  734. * parameter) to allow Windows 7 to use PBC instead of PIN (e.g., from
  735. * a label in the AP).
  736. */
  737. int pbc_in_m1;
  738. /**
  739. * autoscan - Automatic scan parameters or %NULL if none
  740. *
  741. * This is an optional set of parameters for automatic scanning
  742. * within an interface in following format:
  743. * <autoscan module name>:<module parameters>
  744. */
  745. char *autoscan;
  746. /**
  747. * wps_nfc_pw_from_config - NFC Device Password was read from config
  748. *
  749. * This parameter can be determined whether the NFC Device Password was
  750. * included in the configuration (1) or generated dynamically (0). Only
  751. * the former case is re-written back to the configuration file.
  752. */
  753. int wps_nfc_pw_from_config;
  754. /**
  755. * wps_nfc_dev_pw_id - NFC Device Password ID for password token
  756. */
  757. int wps_nfc_dev_pw_id;
  758. /**
  759. * wps_nfc_dh_pubkey - NFC DH Public Key for password token
  760. */
  761. struct wpabuf *wps_nfc_dh_pubkey;
  762. /**
  763. * wps_nfc_dh_privkey - NFC DH Private Key for password token
  764. */
  765. struct wpabuf *wps_nfc_dh_privkey;
  766. /**
  767. * wps_nfc_dev_pw - NFC Device Password for password token
  768. */
  769. struct wpabuf *wps_nfc_dev_pw;
  770. /**
  771. * ext_password_backend - External password backend or %NULL if none
  772. *
  773. * format: <backend name>[:<optional backend parameters>]
  774. */
  775. char *ext_password_backend;
  776. /*
  777. * p2p_go_max_inactivity - Timeout in seconds to detect STA inactivity
  778. *
  779. * This timeout value is used in P2P GO mode to clean up
  780. * inactive stations.
  781. * By default: 300 seconds.
  782. */
  783. int p2p_go_max_inactivity;
  784. struct hostapd_wmm_ac_params wmm_ac_params[4];
  785. /**
  786. * auto_interworking - Whether to use network selection automatically
  787. *
  788. * 0 = do not automatically go through Interworking network selection
  789. * (i.e., require explicit interworking_select command for this)
  790. * 1 = perform Interworking network selection if one or more
  791. * credentials have been configured and scan did not find a
  792. * matching network block
  793. */
  794. int auto_interworking;
  795. /**
  796. * p2p_go_ht40 - Default mode for HT40 enable when operating as GO.
  797. *
  798. * This will take effect for p2p_group_add, p2p_connect, and p2p_invite.
  799. * Note that regulatory constraints and driver capabilities are
  800. * consulted anyway, so setting it to 1 can't do real harm.
  801. * By default: 0 (disabled)
  802. */
  803. int p2p_go_ht40;
  804. /**
  805. * p2p_go_vht - Default mode for VHT enable when operating as GO
  806. *
  807. * This will take effect for p2p_group_add, p2p_connect, and p2p_invite.
  808. * Note that regulatory constraints and driver capabilities are
  809. * consulted anyway, so setting it to 1 can't do real harm.
  810. * By default: 0 (disabled)
  811. */
  812. int p2p_go_vht;
  813. /**
  814. * p2p_disabled - Whether P2P operations are disabled for this interface
  815. */
  816. int p2p_disabled;
  817. /**
  818. * p2p_no_group_iface - Whether group interfaces can be used
  819. *
  820. * By default, wpa_supplicant will create a separate interface for P2P
  821. * group operations if the driver supports this. This functionality can
  822. * be disabled by setting this parameter to 1. In that case, the same
  823. * interface that was used for the P2P management operations is used
  824. * also for the group operation.
  825. */
  826. int p2p_no_group_iface;
  827. /**
  828. * okc - Whether to enable opportunistic key caching by default
  829. *
  830. * By default, OKC is disabled unless enabled by the per-network
  831. * proactive_key_caching=1 parameter. okc=1 can be used to change this
  832. * default behavior.
  833. */
  834. int okc;
  835. /**
  836. * pmf - Whether to enable/require PMF by default
  837. *
  838. * By default, PMF is disabled unless enabled by the per-network
  839. * ieee80211w=1 or ieee80211w=2 parameter. pmf=1/2 can be used to change
  840. * this default behavior.
  841. */
  842. enum mfp_options pmf;
  843. /**
  844. * sae_groups - Preference list of enabled groups for SAE
  845. *
  846. * By default (if this parameter is not set), the mandatory group 19
  847. * (ECC group defined over a 256-bit prime order field) is preferred,
  848. * but other groups are also enabled. If this parameter is set, the
  849. * groups will be tried in the indicated order.
  850. */
  851. int *sae_groups;
  852. /**
  853. * dtim_period - Default DTIM period in Beacon intervals
  854. *
  855. * This parameter can be used to set the default value for network
  856. * blocks that do not specify dtim_period.
  857. */
  858. int dtim_period;
  859. /**
  860. * beacon_int - Default Beacon interval in TU
  861. *
  862. * This parameter can be used to set the default value for network
  863. * blocks that do not specify beacon_int.
  864. */
  865. int beacon_int;
  866. /**
  867. * ap_vendor_elements: Vendor specific elements for Beacon/ProbeResp
  868. *
  869. * This parameter can be used to define additional vendor specific
  870. * elements for Beacon and Probe Response frames in AP/P2P GO mode. The
  871. * format for these element(s) is a hexdump of the raw information
  872. * elements (id+len+payload for one or more elements).
  873. */
  874. struct wpabuf *ap_vendor_elements;
  875. /**
  876. * ignore_old_scan_res - Ignore scan results older than request
  877. *
  878. * The driver may have a cache of scan results that makes it return
  879. * information that is older than our scan trigger. This parameter can
  880. * be used to configure such old information to be ignored instead of
  881. * allowing it to update the internal BSS table.
  882. */
  883. int ignore_old_scan_res;
  884. /**
  885. * sched_scan_interval - schedule scan interval
  886. */
  887. unsigned int sched_scan_interval;
  888. /**
  889. * tdls_external_control - External control for TDLS setup requests
  890. *
  891. * Enable TDLS mode where external programs are given the control
  892. * to specify the TDLS link to get established to the driver. The
  893. * driver requests the TDLS setup to the supplicant only for the
  894. * specified TDLS peers.
  895. */
  896. int tdls_external_control;
  897. u8 ip_addr_go[4];
  898. u8 ip_addr_mask[4];
  899. u8 ip_addr_start[4];
  900. u8 ip_addr_end[4];
  901. /**
  902. * osu_dir - OSU provider information directory
  903. *
  904. * If set, allow FETCH_OSU control interface command to be used to fetch
  905. * OSU provider information into all APs and store the results in this
  906. * directory.
  907. */
  908. char *osu_dir;
  909. /**
  910. * wowlan_triggers - Wake-on-WLAN triggers
  911. *
  912. * If set, these wowlan triggers will be configured.
  913. */
  914. char *wowlan_triggers;
  915. /**
  916. * p2p_search_delay - Extra delay between concurrent search iterations
  917. *
  918. * Add extra delay (in milliseconds) between search iterations when
  919. * there is a concurrent operation to make p2p_find friendlier to
  920. * concurrent operations by avoiding it from taking 100% of radio
  921. * resources.
  922. */
  923. unsigned int p2p_search_delay;
  924. };
  925. /* Prototypes for common functions from config.c */
  926. void wpa_config_free(struct wpa_config *ssid);
  927. void wpa_config_free_ssid(struct wpa_ssid *ssid);
  928. void wpa_config_foreach_network(struct wpa_config *config,
  929. void (*func)(void *, struct wpa_ssid *),
  930. void *arg);
  931. struct wpa_ssid * wpa_config_get_network(struct wpa_config *config, int id);
  932. struct wpa_ssid * wpa_config_add_network(struct wpa_config *config);
  933. int wpa_config_remove_network(struct wpa_config *config, int id);
  934. void wpa_config_set_network_defaults(struct wpa_ssid *ssid);
  935. int wpa_config_set(struct wpa_ssid *ssid, const char *var, const char *value,
  936. int line);
  937. int wpa_config_set_quoted(struct wpa_ssid *ssid, const char *var,
  938. const char *value);
  939. char ** wpa_config_get_all(struct wpa_ssid *ssid, int get_keys);
  940. char * wpa_config_get(struct wpa_ssid *ssid, const char *var);
  941. char * wpa_config_get_no_key(struct wpa_ssid *ssid, const char *var);
  942. void wpa_config_update_psk(struct wpa_ssid *ssid);
  943. int wpa_config_add_prio_network(struct wpa_config *config,
  944. struct wpa_ssid *ssid);
  945. int wpa_config_update_prio_list(struct wpa_config *config);
  946. const struct wpa_config_blob * wpa_config_get_blob(struct wpa_config *config,
  947. const char *name);
  948. void wpa_config_set_blob(struct wpa_config *config,
  949. struct wpa_config_blob *blob);
  950. void wpa_config_free_blob(struct wpa_config_blob *blob);
  951. int wpa_config_remove_blob(struct wpa_config *config, const char *name);
  952. void wpa_config_flush_blobs(struct wpa_config *config);
  953. struct wpa_cred * wpa_config_get_cred(struct wpa_config *config, int id);
  954. struct wpa_cred * wpa_config_add_cred(struct wpa_config *config);
  955. int wpa_config_remove_cred(struct wpa_config *config, int id);
  956. void wpa_config_free_cred(struct wpa_cred *cred);
  957. int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
  958. const char *value, int line);
  959. char * wpa_config_get_cred_no_key(struct wpa_cred *cred, const char *var);
  960. struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
  961. const char *driver_param);
  962. #ifndef CONFIG_NO_STDOUT_DEBUG
  963. void wpa_config_debug_dump_networks(struct wpa_config *config);
  964. #else /* CONFIG_NO_STDOUT_DEBUG */
  965. #define wpa_config_debug_dump_networks(c) do { } while (0)
  966. #endif /* CONFIG_NO_STDOUT_DEBUG */
  967. /* Prototypes for common functions from config.c */
  968. int wpa_config_process_global(struct wpa_config *config, char *pos, int line);
  969. /* Prototypes for backend specific functions from the selected config_*.c */
  970. /**
  971. * wpa_config_read - Read and parse configuration database
  972. * @name: Name of the configuration (e.g., path and file name for the
  973. * configuration file)
  974. * @cfgp: Pointer to previously allocated configuration data or %NULL if none
  975. * Returns: Pointer to allocated configuration data or %NULL on failure
  976. *
  977. * This function reads configuration data, parses its contents, and allocates
  978. * data structures needed for storing configuration information. The allocated
  979. * data can be freed with wpa_config_free().
  980. *
  981. * Each configuration backend needs to implement this function.
  982. */
  983. struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp);
  984. /**
  985. * wpa_config_write - Write or update configuration data
  986. * @name: Name of the configuration (e.g., path and file name for the
  987. * configuration file)
  988. * @config: Configuration data from wpa_config_read()
  989. * Returns: 0 on success, -1 on failure
  990. *
  991. * This function write all configuration data into an external database (e.g.,
  992. * a text file) in a format that can be read with wpa_config_read(). This can
  993. * be used to allow wpa_supplicant to update its configuration, e.g., when a
  994. * new network is added or a password is changed.
  995. *
  996. * Each configuration backend needs to implement this function.
  997. */
  998. int wpa_config_write(const char *name, struct wpa_config *config);
  999. #endif /* CONFIG_H */