config.h 37 KB

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