config.h 36 KB

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