blob: 88074f2e69a8f4601579535ae5b046c627dcc855 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * hostapd / Configuration helper functions
Dmitry Shmidt344abd32014-01-14 13:17:00 -08003 * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#include "utils/includes.h"
10
11#include "utils/common.h"
12#include "crypto/sha1.h"
13#include "radius/radius_client.h"
14#include "common/ieee802_11_defs.h"
15#include "common/eapol_common.h"
16#include "eap_common/eap_wsc_common.h"
17#include "eap_server/eap.h"
18#include "wpa_auth.h"
19#include "sta_info.h"
20#include "ap_config.h"
21
22
23static void hostapd_config_free_vlan(struct hostapd_bss_config *bss)
24{
25 struct hostapd_vlan *vlan, *prev;
26
27 vlan = bss->vlan;
28 prev = NULL;
29 while (vlan) {
30 prev = vlan;
31 vlan = vlan->next;
32 os_free(prev);
33 }
34
35 bss->vlan = NULL;
36}
37
38
39void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
40{
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080041 dl_list_init(&bss->anqp_elem);
42
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070043 bss->logger_syslog_level = HOSTAPD_LEVEL_INFO;
44 bss->logger_stdout_level = HOSTAPD_LEVEL_INFO;
45 bss->logger_syslog = (unsigned int) -1;
46 bss->logger_stdout = (unsigned int) -1;
47
48 bss->auth_algs = WPA_AUTH_ALG_OPEN | WPA_AUTH_ALG_SHARED;
49
50 bss->wep_rekeying_period = 300;
51 /* use key0 in individual key and key1 in broadcast key */
52 bss->broadcast_key_idx_min = 1;
53 bss->broadcast_key_idx_max = 2;
54 bss->eap_reauth_period = 3600;
55
56 bss->wpa_group_rekey = 600;
57 bss->wpa_gmk_rekey = 86400;
58 bss->wpa_key_mgmt = WPA_KEY_MGMT_PSK;
59 bss->wpa_pairwise = WPA_CIPHER_TKIP;
60 bss->wpa_group = WPA_CIPHER_TKIP;
61 bss->rsn_pairwise = 0;
62
63 bss->max_num_sta = MAX_STA_COUNT;
64
65 bss->dtim_period = 2;
66
67 bss->radius_server_auth_port = 1812;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080068 bss->eap_sim_db_timeout = 1;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070069 bss->ap_max_inactivity = AP_MAX_INACTIVITY;
70 bss->eapol_version = EAPOL_VERSION;
71
72 bss->max_listen_interval = 65535;
73
74 bss->pwd_group = 19; /* ECC: GF(p=256) */
75
76#ifdef CONFIG_IEEE80211W
77 bss->assoc_sa_query_max_timeout = 1000;
78 bss->assoc_sa_query_retry_timeout = 201;
Dmitry Shmidtb36ed7c2014-03-17 10:57:26 -070079 bss->group_mgmt_cipher = WPA_CIPHER_AES_128_CMAC;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070080#endif /* CONFIG_IEEE80211W */
81#ifdef EAP_SERVER_FAST
82 /* both anonymous and authenticated provisioning */
83 bss->eap_fast_prov = 3;
84 bss->pac_key_lifetime = 7 * 24 * 60 * 60;
85 bss->pac_key_refresh_time = 1 * 24 * 60 * 60;
86#endif /* EAP_SERVER_FAST */
87
88 /* Set to -1 as defaults depends on HT in setup */
89 bss->wmm_enabled = -1;
90
91#ifdef CONFIG_IEEE80211R
92 bss->ft_over_ds = 1;
93#endif /* CONFIG_IEEE80211R */
Dmitry Shmidt04949592012-07-19 12:16:46 -070094
95 bss->radius_das_time_window = 300;
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -080096
97 bss->sae_anti_clogging_threshold = 5;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070098}
99
100
101struct hostapd_config * hostapd_config_defaults(void)
102{
103#define ecw2cw(ecw) ((1 << (ecw)) - 1)
104
105 struct hostapd_config *conf;
106 struct hostapd_bss_config *bss;
107 const int aCWmin = 4, aCWmax = 10;
108 const struct hostapd_wmm_ac_params ac_bk =
109 { aCWmin, aCWmax, 7, 0, 0 }; /* background traffic */
110 const struct hostapd_wmm_ac_params ac_be =
111 { aCWmin, aCWmax, 3, 0, 0 }; /* best effort traffic */
112 const struct hostapd_wmm_ac_params ac_vi = /* video traffic */
Dmitry Shmidtb36ed7c2014-03-17 10:57:26 -0700113 { aCWmin - 1, aCWmin, 2, 3008 / 32, 0 };
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700114 const struct hostapd_wmm_ac_params ac_vo = /* voice traffic */
Dmitry Shmidtb36ed7c2014-03-17 10:57:26 -0700115 { aCWmin - 2, aCWmin - 1, 2, 1504 / 32, 0 };
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700116 const struct hostapd_tx_queue_params txq_bk =
117 { 7, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
118 const struct hostapd_tx_queue_params txq_be =
119 { 3, ecw2cw(aCWmin), 4 * (ecw2cw(aCWmin) + 1) - 1, 0};
120 const struct hostapd_tx_queue_params txq_vi =
121 { 1, (ecw2cw(aCWmin) + 1) / 2 - 1, ecw2cw(aCWmin), 30};
122 const struct hostapd_tx_queue_params txq_vo =
123 { 1, (ecw2cw(aCWmin) + 1) / 4 - 1,
124 (ecw2cw(aCWmin) + 1) / 2 - 1, 15};
125
126#undef ecw2cw
127
128 conf = os_zalloc(sizeof(*conf));
129 bss = os_zalloc(sizeof(*bss));
130 if (conf == NULL || bss == NULL) {
131 wpa_printf(MSG_ERROR, "Failed to allocate memory for "
132 "configuration data.");
133 os_free(conf);
134 os_free(bss);
135 return NULL;
136 }
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800137 conf->bss = os_calloc(1, sizeof(struct hostapd_bss_config *));
138 if (conf->bss == NULL) {
139 os_free(conf);
140 os_free(bss);
141 return NULL;
142 }
143 conf->bss[0] = bss;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700144
145 bss->radius = os_zalloc(sizeof(*bss->radius));
146 if (bss->radius == NULL) {
Dmitry Shmidt97672262014-02-03 13:02:54 -0800147 os_free(conf->bss);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700148 os_free(conf);
149 os_free(bss);
150 return NULL;
151 }
152
153 hostapd_config_defaults_bss(bss);
154
155 conf->num_bss = 1;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700156
157 conf->beacon_int = 100;
158 conf->rts_threshold = -1; /* use driver default: 2347 */
159 conf->fragm_threshold = -1; /* user driver default: 2346 */
160 conf->send_probe_response = 1;
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800161 /* Set to invalid value means do not add Power Constraint IE */
162 conf->local_pwr_constraint = -1;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700163
164 conf->wmm_ac_params[0] = ac_be;
165 conf->wmm_ac_params[1] = ac_bk;
166 conf->wmm_ac_params[2] = ac_vi;
167 conf->wmm_ac_params[3] = ac_vo;
168
169 conf->tx_queue[0] = txq_vo;
170 conf->tx_queue[1] = txq_vi;
171 conf->tx_queue[2] = txq_be;
172 conf->tx_queue[3] = txq_bk;
173
174 conf->ht_capab = HT_CAP_INFO_SMPS_DISABLED;
175
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800176 conf->ap_table_max_size = 255;
177 conf->ap_table_expiration_time = 60;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800178 conf->track_sta_max_age = 180;
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800179
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700180#ifdef CONFIG_TESTING_OPTIONS
Dmitry Shmidt7832adb2014-04-29 10:53:02 -0700181 conf->ignore_probe_probability = 0.0;
182 conf->ignore_auth_probability = 0.0;
183 conf->ignore_assoc_probability = 0.0;
184 conf->ignore_reassoc_probability = 0.0;
185 conf->corrupt_gtk_rekey_mic_probability = 0.0;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800186 conf->ecsa_ie_only = 0;
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700187#endif /* CONFIG_TESTING_OPTIONS */
188
Dmitry Shmidtdda10c22015-03-24 16:05:01 -0700189 conf->acs = 0;
190 conf->acs_ch_list.num = 0;
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700191#ifdef CONFIG_ACS
192 conf->acs_num_scans = 5;
193#endif /* CONFIG_ACS */
194
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700195 return conf;
196}
197
198
199int hostapd_mac_comp(const void *a, const void *b)
200{
201 return os_memcmp(a, b, sizeof(macaddr));
202}
203
204
205int hostapd_mac_comp_empty(const void *a)
206{
207 macaddr empty = { 0 };
208 return os_memcmp(a, empty, sizeof(macaddr));
209}
210
211
212static int hostapd_config_read_wpa_psk(const char *fname,
213 struct hostapd_ssid *ssid)
214{
215 FILE *f;
216 char buf[128], *pos;
217 int line = 0, ret = 0, len, ok;
218 u8 addr[ETH_ALEN];
219 struct hostapd_wpa_psk *psk;
220
221 if (!fname)
222 return 0;
223
224 f = fopen(fname, "r");
225 if (!f) {
226 wpa_printf(MSG_ERROR, "WPA PSK file '%s' not found.", fname);
227 return -1;
228 }
229
230 while (fgets(buf, sizeof(buf), f)) {
231 line++;
232
233 if (buf[0] == '#')
234 continue;
235 pos = buf;
236 while (*pos != '\0') {
237 if (*pos == '\n') {
238 *pos = '\0';
239 break;
240 }
241 pos++;
242 }
243 if (buf[0] == '\0')
244 continue;
245
246 if (hwaddr_aton(buf, addr)) {
247 wpa_printf(MSG_ERROR, "Invalid MAC address '%s' on "
248 "line %d in '%s'", buf, line, fname);
249 ret = -1;
250 break;
251 }
252
253 psk = os_zalloc(sizeof(*psk));
254 if (psk == NULL) {
255 wpa_printf(MSG_ERROR, "WPA PSK allocation failed");
256 ret = -1;
257 break;
258 }
259 if (is_zero_ether_addr(addr))
260 psk->group = 1;
261 else
262 os_memcpy(psk->addr, addr, ETH_ALEN);
263
264 pos = buf + 17;
265 if (*pos == '\0') {
266 wpa_printf(MSG_ERROR, "No PSK on line %d in '%s'",
267 line, fname);
268 os_free(psk);
269 ret = -1;
270 break;
271 }
272 pos++;
273
274 ok = 0;
275 len = os_strlen(pos);
276 if (len == 64 && hexstr2bin(pos, psk->psk, PMK_LEN) == 0)
277 ok = 1;
278 else if (len >= 8 && len < 64) {
279 pbkdf2_sha1(pos, ssid->ssid, ssid->ssid_len,
280 4096, psk->psk, PMK_LEN);
281 ok = 1;
282 }
283 if (!ok) {
284 wpa_printf(MSG_ERROR, "Invalid PSK '%s' on line %d in "
285 "'%s'", pos, line, fname);
286 os_free(psk);
287 ret = -1;
288 break;
289 }
290
291 psk->next = ssid->wpa_psk;
292 ssid->wpa_psk = psk;
293 }
294
295 fclose(f);
296
297 return ret;
298}
299
300
301static int hostapd_derive_psk(struct hostapd_ssid *ssid)
302{
303 ssid->wpa_psk = os_zalloc(sizeof(struct hostapd_wpa_psk));
304 if (ssid->wpa_psk == NULL) {
305 wpa_printf(MSG_ERROR, "Unable to alloc space for PSK");
306 return -1;
307 }
308 wpa_hexdump_ascii(MSG_DEBUG, "SSID",
309 (u8 *) ssid->ssid, ssid->ssid_len);
310 wpa_hexdump_ascii_key(MSG_DEBUG, "PSK (ASCII passphrase)",
311 (u8 *) ssid->wpa_passphrase,
312 os_strlen(ssid->wpa_passphrase));
313 pbkdf2_sha1(ssid->wpa_passphrase,
314 ssid->ssid, ssid->ssid_len,
315 4096, ssid->wpa_psk->psk, PMK_LEN);
316 wpa_hexdump_key(MSG_DEBUG, "PSK (from passphrase)",
317 ssid->wpa_psk->psk, PMK_LEN);
318 return 0;
319}
320
321
322int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf)
323{
324 struct hostapd_ssid *ssid = &conf->ssid;
325
326 if (ssid->wpa_passphrase != NULL) {
327 if (ssid->wpa_psk != NULL) {
328 wpa_printf(MSG_DEBUG, "Using pre-configured WPA PSK "
329 "instead of passphrase");
330 } else {
331 wpa_printf(MSG_DEBUG, "Deriving WPA PSK based on "
332 "passphrase");
333 if (hostapd_derive_psk(ssid) < 0)
334 return -1;
335 }
336 ssid->wpa_psk->group = 1;
337 }
338
339 if (ssid->wpa_psk_file) {
340 if (hostapd_config_read_wpa_psk(ssid->wpa_psk_file,
341 &conf->ssid))
342 return -1;
343 }
344
345 return 0;
346}
347
348
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700349static void hostapd_config_free_radius(struct hostapd_radius_server *servers,
350 int num_servers)
351{
352 int i;
353
354 for (i = 0; i < num_servers; i++) {
355 os_free(servers[i].shared_secret);
356 }
357 os_free(servers);
358}
359
360
Dmitry Shmidt04949592012-07-19 12:16:46 -0700361struct hostapd_radius_attr *
362hostapd_config_get_radius_attr(struct hostapd_radius_attr *attr, u8 type)
363{
364 for (; attr; attr = attr->next) {
365 if (attr->type == type)
366 return attr;
367 }
368 return NULL;
369}
370
371
372static void hostapd_config_free_radius_attr(struct hostapd_radius_attr *attr)
373{
374 struct hostapd_radius_attr *prev;
375
376 while (attr) {
377 prev = attr;
378 attr = attr->next;
379 wpabuf_free(prev->val);
380 os_free(prev);
381 }
382}
383
384
Dmitry Shmidt818ea482014-03-10 13:15:21 -0700385void hostapd_config_free_eap_user(struct hostapd_eap_user *user)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700386{
Dmitry Shmidt818ea482014-03-10 13:15:21 -0700387 hostapd_config_free_radius_attr(user->accept_attr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700388 os_free(user->identity);
Dmitry Shmidtc2817022014-07-02 10:32:10 -0700389 bin_clear_free(user->password, user->password_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700390 os_free(user);
391}
392
393
394static void hostapd_config_free_wep(struct hostapd_wep_keys *keys)
395{
396 int i;
397 for (i = 0; i < NUM_WEP_KEYS; i++) {
Dmitry Shmidtc2817022014-07-02 10:32:10 -0700398 bin_clear_free(keys->key[i], keys->len[i]);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700399 keys->key[i] = NULL;
400 }
401}
402
403
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800404void hostapd_config_clear_wpa_psk(struct hostapd_wpa_psk **l)
405{
406 struct hostapd_wpa_psk *psk, *tmp;
407
408 for (psk = *l; psk;) {
409 tmp = psk;
410 psk = psk->next;
411 bin_clear_free(tmp, sizeof(*tmp));
412 }
413 *l = NULL;
414}
415
416
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800417static void hostapd_config_free_anqp_elem(struct hostapd_bss_config *conf)
418{
419 struct anqp_element *elem;
420
421 while ((elem = dl_list_first(&conf->anqp_elem, struct anqp_element,
422 list))) {
423 dl_list_del(&elem->list);
424 wpabuf_free(elem->payload);
425 os_free(elem);
426 }
427}
428
429
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800430void hostapd_config_free_bss(struct hostapd_bss_config *conf)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700431{
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700432 struct hostapd_eap_user *user, *prev_user;
433
434 if (conf == NULL)
435 return;
436
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800437 hostapd_config_clear_wpa_psk(&conf->ssid.wpa_psk);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700438
Dmitry Shmidtc2817022014-07-02 10:32:10 -0700439 str_clear_free(conf->ssid.wpa_passphrase);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700440 os_free(conf->ssid.wpa_psk_file);
441 hostapd_config_free_wep(&conf->ssid.wep);
442#ifdef CONFIG_FULL_DYNAMIC_VLAN
443 os_free(conf->ssid.vlan_tagged_interface);
444#endif /* CONFIG_FULL_DYNAMIC_VLAN */
445
446 user = conf->eap_user;
447 while (user) {
448 prev_user = user;
449 user = user->next;
450 hostapd_config_free_eap_user(prev_user);
451 }
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800452 os_free(conf->eap_user_sqlite);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700453
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700454 os_free(conf->eap_req_id_text);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800455 os_free(conf->erp_domain);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700456 os_free(conf->accept_mac);
457 os_free(conf->deny_mac);
458 os_free(conf->nas_identifier);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800459 if (conf->radius) {
460 hostapd_config_free_radius(conf->radius->auth_servers,
461 conf->radius->num_auth_servers);
462 hostapd_config_free_radius(conf->radius->acct_servers,
463 conf->radius->num_acct_servers);
464 }
Dmitry Shmidt04949592012-07-19 12:16:46 -0700465 hostapd_config_free_radius_attr(conf->radius_auth_req_attr);
466 hostapd_config_free_radius_attr(conf->radius_acct_req_attr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700467 os_free(conf->rsn_preauth_interfaces);
468 os_free(conf->ctrl_interface);
469 os_free(conf->ca_cert);
470 os_free(conf->server_cert);
471 os_free(conf->private_key);
472 os_free(conf->private_key_passwd);
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700473 os_free(conf->ocsp_stapling_response);
Dmitry Shmidt014a3ff2015-12-28 13:27:49 -0800474 os_free(conf->ocsp_stapling_response_multi);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700475 os_free(conf->dh_file);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800476 os_free(conf->openssl_ciphers);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700477 os_free(conf->pac_opaque_encr_key);
478 os_free(conf->eap_fast_a_id);
479 os_free(conf->eap_fast_a_id_info);
480 os_free(conf->eap_sim_db);
481 os_free(conf->radius_server_clients);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700482 os_free(conf->radius);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700483 os_free(conf->radius_das_shared_secret);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700484 hostapd_config_free_vlan(conf);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800485 os_free(conf->time_zone);
486
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700487#ifdef CONFIG_IEEE80211R
488 {
489 struct ft_remote_r0kh *r0kh, *r0kh_prev;
490 struct ft_remote_r1kh *r1kh, *r1kh_prev;
491
492 r0kh = conf->r0kh_list;
493 conf->r0kh_list = NULL;
494 while (r0kh) {
495 r0kh_prev = r0kh;
496 r0kh = r0kh->next;
497 os_free(r0kh_prev);
498 }
499
500 r1kh = conf->r1kh_list;
501 conf->r1kh_list = NULL;
502 while (r1kh) {
503 r1kh_prev = r1kh;
504 r1kh = r1kh->next;
505 os_free(r1kh_prev);
506 }
507 }
508#endif /* CONFIG_IEEE80211R */
509
510#ifdef CONFIG_WPS
511 os_free(conf->wps_pin_requests);
512 os_free(conf->device_name);
513 os_free(conf->manufacturer);
514 os_free(conf->model_name);
515 os_free(conf->model_number);
516 os_free(conf->serial_number);
517 os_free(conf->config_methods);
518 os_free(conf->ap_pin);
519 os_free(conf->extra_cred);
520 os_free(conf->ap_settings);
521 os_free(conf->upnp_iface);
522 os_free(conf->friendly_name);
523 os_free(conf->manufacturer_url);
524 os_free(conf->model_description);
525 os_free(conf->model_url);
526 os_free(conf->upc);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800527 {
528 unsigned int i;
529
530 for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
531 wpabuf_free(conf->wps_vendor_ext[i]);
532 }
Dmitry Shmidt04949592012-07-19 12:16:46 -0700533 wpabuf_free(conf->wps_nfc_dh_pubkey);
534 wpabuf_free(conf->wps_nfc_dh_privkey);
535 wpabuf_free(conf->wps_nfc_dev_pw);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700536#endif /* CONFIG_WPS */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800537
538 os_free(conf->roaming_consortium);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700539 os_free(conf->venue_name);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700540 os_free(conf->nai_realm_data);
541 os_free(conf->network_auth_type);
542 os_free(conf->anqp_3gpp_cell_net);
543 os_free(conf->domain_name);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800544 hostapd_config_free_anqp_elem(conf);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800545
546#ifdef CONFIG_RADIUS_TEST
547 os_free(conf->dump_msk_file);
548#endif /* CONFIG_RADIUS_TEST */
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700549
550#ifdef CONFIG_HS20
551 os_free(conf->hs20_oper_friendly_name);
552 os_free(conf->hs20_wan_metrics);
553 os_free(conf->hs20_connection_capability);
554 os_free(conf->hs20_operating_class);
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800555 os_free(conf->hs20_icons);
556 if (conf->hs20_osu_providers) {
557 size_t i;
558 for (i = 0; i < conf->hs20_osu_providers_count; i++) {
559 struct hs20_osu_provider *p;
560 size_t j;
561 p = &conf->hs20_osu_providers[i];
562 os_free(p->friendly_name);
563 os_free(p->server_uri);
564 os_free(p->method_list);
565 for (j = 0; j < p->icons_count; j++)
566 os_free(p->icons[j]);
567 os_free(p->icons);
568 os_free(p->osu_nai);
569 os_free(p->service_desc);
570 }
571 os_free(conf->hs20_osu_providers);
572 }
573 os_free(conf->subscr_remediation_url);
Dmitry Shmidt61d9df32012-08-29 16:22:06 -0700574#endif /* CONFIG_HS20 */
575
576 wpabuf_free(conf->vendor_elements);
Dmitry Shmidta54fa5f2013-01-15 13:53:35 -0800577
578 os_free(conf->sae_groups);
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700579
Dmitry Shmidt0207e232014-09-03 14:58:37 -0700580 os_free(conf->wowlan_triggers);
581
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700582 os_free(conf->server_id);
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800583
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800584#ifdef CONFIG_TESTING_OPTIONS
585 wpabuf_free(conf->own_ie_override);
586#endif /* CONFIG_TESTING_OPTIONS */
587
588 os_free(conf->no_probe_resp_if_seen_on);
589 os_free(conf->no_auth_if_seen_on);
590
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800591 os_free(conf);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700592}
593
594
595/**
596 * hostapd_config_free - Free hostapd configuration
597 * @conf: Configuration data from hostapd_config_read().
598 */
599void hostapd_config_free(struct hostapd_config *conf)
600{
601 size_t i;
602
603 if (conf == NULL)
604 return;
605
606 for (i = 0; i < conf->num_bss; i++)
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800607 hostapd_config_free_bss(conf->bss[i]);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700608 os_free(conf->bss);
609 os_free(conf->supported_rates);
610 os_free(conf->basic_rates);
Dmitry Shmidtdda10c22015-03-24 16:05:01 -0700611 os_free(conf->acs_ch_list.range);
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800612 os_free(conf->driver_params);
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800613#ifdef CONFIG_ACS
614 os_free(conf->acs_chan_bias);
615#endif /* CONFIG_ACS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700616
617 os_free(conf);
618}
619
620
621/**
622 * hostapd_maclist_found - Find a MAC address from a list
623 * @list: MAC address list
624 * @num_entries: Number of addresses in the list
625 * @addr: Address to search for
626 * @vlan_id: Buffer for returning VLAN ID or %NULL if not needed
627 * Returns: 1 if address is in the list or 0 if not.
628 *
629 * Perform a binary search for given MAC address from a pre-sorted list.
630 */
631int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
632 const u8 *addr, int *vlan_id)
633{
634 int start, end, middle, res;
635
636 start = 0;
637 end = num_entries - 1;
638
639 while (start <= end) {
640 middle = (start + end) / 2;
641 res = os_memcmp(list[middle].addr, addr, ETH_ALEN);
642 if (res == 0) {
643 if (vlan_id)
644 *vlan_id = list[middle].vlan_id;
645 return 1;
646 }
647 if (res < 0)
648 start = middle + 1;
649 else
650 end = middle - 1;
651 }
652
653 return 0;
654}
655
656
657int hostapd_rate_found(int *list, int rate)
658{
659 int i;
660
661 if (list == NULL)
662 return 0;
663
664 for (i = 0; list[i] >= 0; i++)
665 if (list[i] == rate)
666 return 1;
667
668 return 0;
669}
670
671
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700672int hostapd_vlan_id_valid(struct hostapd_vlan *vlan, int vlan_id)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700673{
674 struct hostapd_vlan *v = vlan;
675 while (v) {
676 if (v->vlan_id == vlan_id || v->vlan_id == VLAN_ID_WILDCARD)
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700677 return 1;
678 v = v->next;
679 }
680 return 0;
681}
682
683
684const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan, int vlan_id)
685{
686 struct hostapd_vlan *v = vlan;
687 while (v) {
688 if (v->vlan_id == vlan_id)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700689 return v->ifname;
690 v = v->next;
691 }
692 return NULL;
693}
694
695
696const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700697 const u8 *addr, const u8 *p2p_dev_addr,
698 const u8 *prev_psk)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700699{
700 struct hostapd_wpa_psk *psk;
701 int next_ok = prev_psk == NULL;
702
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700703 if (p2p_dev_addr && !is_zero_ether_addr(p2p_dev_addr)) {
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700704 wpa_printf(MSG_DEBUG, "Searching a PSK for " MACSTR
705 " p2p_dev_addr=" MACSTR " prev_psk=%p",
706 MAC2STR(addr), MAC2STR(p2p_dev_addr), prev_psk);
Dmitry Shmidtdf5a7e42014-04-02 12:59:59 -0700707 addr = NULL; /* Use P2P Device Address for matching */
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700708 } else {
709 wpa_printf(MSG_DEBUG, "Searching a PSK for " MACSTR
710 " prev_psk=%p",
711 MAC2STR(addr), prev_psk);
712 }
713
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700714 for (psk = conf->ssid.wpa_psk; psk != NULL; psk = psk->next) {
715 if (next_ok &&
Dmitry Shmidt391c59f2013-09-03 12:16:28 -0700716 (psk->group ||
717 (addr && os_memcmp(psk->addr, addr, ETH_ALEN) == 0) ||
718 (!addr && p2p_dev_addr &&
719 os_memcmp(psk->p2p_dev_addr, p2p_dev_addr, ETH_ALEN) ==
720 0)))
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700721 return psk->psk;
722
723 if (psk->psk == prev_psk)
724 next_ok = 1;
725 }
726
727 return NULL;
728}
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800729
730
731static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800732 struct hostapd_config *conf,
733 int full_config)
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800734{
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800735 if (full_config && bss->ieee802_1x && !bss->eap_server &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800736 !bss->radius->auth_servers) {
737 wpa_printf(MSG_ERROR, "Invalid IEEE 802.1X configuration (no "
738 "EAP authenticator configured).");
739 return -1;
740 }
741
742 if (bss->wpa) {
743 int wep, i;
744
745 wep = bss->default_wep_key_len > 0 ||
746 bss->individual_wep_key_len > 0;
747 for (i = 0; i < NUM_WEP_KEYS; i++) {
748 if (bss->ssid.wep.keys_set) {
749 wep = 1;
750 break;
751 }
752 }
753
754 if (wep) {
755 wpa_printf(MSG_ERROR, "WEP configuration in a WPA network is not supported");
756 return -1;
757 }
758 }
759
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800760 if (full_config && bss->wpa &&
761 bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800762 bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
763 wpa_printf(MSG_ERROR, "WPA-PSK using RADIUS enabled, but no "
764 "RADIUS checking (macaddr_acl=2) enabled.");
765 return -1;
766 }
767
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800768 if (full_config && bss->wpa && (bss->wpa_key_mgmt & WPA_KEY_MGMT_PSK) &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800769 bss->ssid.wpa_psk == NULL && bss->ssid.wpa_passphrase == NULL &&
770 bss->ssid.wpa_psk_file == NULL &&
771 (bss->wpa_psk_radius != PSK_RADIUS_REQUIRED ||
772 bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH)) {
773 wpa_printf(MSG_ERROR, "WPA-PSK enabled, but PSK or passphrase "
774 "is not configured.");
775 return -1;
776 }
777
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800778 if (full_config && hostapd_mac_comp_empty(bss->bssid) != 0) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800779 size_t i;
780
781 for (i = 0; i < conf->num_bss; i++) {
782 if (conf->bss[i] != bss &&
783 (hostapd_mac_comp(conf->bss[i]->bssid,
784 bss->bssid) == 0)) {
785 wpa_printf(MSG_ERROR, "Duplicate BSSID " MACSTR
786 " on interface '%s' and '%s'.",
787 MAC2STR(bss->bssid),
788 conf->bss[i]->iface, bss->iface);
789 return -1;
790 }
791 }
792 }
793
794#ifdef CONFIG_IEEE80211R
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800795 if (full_config && wpa_key_mgmt_ft(bss->wpa_key_mgmt) &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800796 (bss->nas_identifier == NULL ||
797 os_strlen(bss->nas_identifier) < 1 ||
798 os_strlen(bss->nas_identifier) > FT_R0KH_ID_MAX_LEN)) {
799 wpa_printf(MSG_ERROR, "FT (IEEE 802.11r) requires "
800 "nas_identifier to be configured as a 1..48 octet "
801 "string");
802 return -1;
803 }
804#endif /* CONFIG_IEEE80211R */
805
806#ifdef CONFIG_IEEE80211N
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800807 if (full_config && conf->ieee80211n &&
808 conf->hw_mode == HOSTAPD_MODE_IEEE80211B) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800809 bss->disable_11n = 1;
810 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) in 11b mode is not "
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700811 "allowed, disabling HT capabilities");
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800812 }
813
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800814 if (full_config && conf->ieee80211n &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800815 bss->ssid.security_policy == SECURITY_STATIC_WEP) {
816 bss->disable_11n = 1;
817 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) with WEP is not "
818 "allowed, disabling HT capabilities");
819 }
820
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800821 if (full_config && conf->ieee80211n && bss->wpa &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800822 !(bss->wpa_pairwise & WPA_CIPHER_CCMP) &&
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800823 !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
824 WPA_CIPHER_CCMP_256 | WPA_CIPHER_GCMP_256)))
825 {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800826 bss->disable_11n = 1;
827 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) with WPA/WPA2 "
828 "requires CCMP/GCMP to be enabled, disabling HT "
829 "capabilities");
830 }
831#endif /* CONFIG_IEEE80211N */
832
Dmitry Shmidt15907092014-03-25 10:42:57 -0700833#ifdef CONFIG_WPS
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800834 if (full_config && bss->wps_state && bss->ignore_broadcast_ssid) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800835 wpa_printf(MSG_INFO, "WPS: ignore_broadcast_ssid "
836 "configuration forced WPS to be disabled");
837 bss->wps_state = 0;
838 }
839
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800840 if (full_config && bss->wps_state &&
841 bss->ssid.wep.keys_set && bss->wpa == 0) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800842 wpa_printf(MSG_INFO, "WPS: WEP configuration forced WPS to be "
843 "disabled");
844 bss->wps_state = 0;
845 }
846
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800847 if (full_config && bss->wps_state && bss->wpa &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800848 (!(bss->wpa & 2) ||
Dmitry Shmidt1d755d02015-04-28 10:34:29 -0700849 !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)))) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800850 wpa_printf(MSG_INFO, "WPS: WPA/TKIP configuration without "
Dmitry Shmidt1d755d02015-04-28 10:34:29 -0700851 "WPA2/CCMP/GCMP forced WPS to be disabled");
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800852 bss->wps_state = 0;
853 }
Dmitry Shmidt15907092014-03-25 10:42:57 -0700854#endif /* CONFIG_WPS */
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800855
856#ifdef CONFIG_HS20
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800857 if (full_config && bss->hs20 &&
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800858 (!(bss->wpa & 2) ||
Dmitry Shmidtfb79edc2014-01-10 10:45:54 -0800859 !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
860 WPA_CIPHER_CCMP_256 |
861 WPA_CIPHER_GCMP_256)))) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800862 wpa_printf(MSG_ERROR, "HS 2.0: WPA2-Enterprise/CCMP "
863 "configuration is required for Hotspot 2.0 "
864 "functionality");
865 return -1;
866 }
867#endif /* CONFIG_HS20 */
868
869 return 0;
870}
871
872
Dmitry Shmidt05df46a2015-05-19 11:02:01 -0700873static int hostapd_config_check_cw(struct hostapd_config *conf, int queue)
874{
875 int tx_cwmin = conf->tx_queue[queue].cwmin;
876 int tx_cwmax = conf->tx_queue[queue].cwmax;
877 int ac_cwmin = conf->wmm_ac_params[queue].cwmin;
878 int ac_cwmax = conf->wmm_ac_params[queue].cwmax;
879
880 if (tx_cwmin > tx_cwmax) {
881 wpa_printf(MSG_ERROR,
882 "Invalid TX queue cwMin/cwMax values. cwMin(%d) greater than cwMax(%d)",
883 tx_cwmin, tx_cwmax);
884 return -1;
885 }
886 if (ac_cwmin > ac_cwmax) {
887 wpa_printf(MSG_ERROR,
888 "Invalid WMM AC cwMin/cwMax values. cwMin(%d) greater than cwMax(%d)",
889 ac_cwmin, ac_cwmax);
890 return -1;
891 }
892 return 0;
893}
894
895
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800896int hostapd_config_check(struct hostapd_config *conf, int full_config)
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800897{
898 size_t i;
899
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800900 if (full_config && conf->ieee80211d &&
901 (!conf->country[0] || !conf->country[1])) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800902 wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11d without "
903 "setting the country_code");
904 return -1;
905 }
906
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800907 if (full_config && conf->ieee80211h && !conf->ieee80211d) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800908 wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11h without "
909 "IEEE 802.11d enabled");
910 return -1;
911 }
912
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800913 if (full_config && conf->local_pwr_constraint != -1 &&
914 !conf->ieee80211d) {
915 wpa_printf(MSG_ERROR, "Cannot add Power Constraint element without Country element");
916 return -1;
917 }
918
919 if (full_config && conf->spectrum_mgmt_required &&
920 conf->local_pwr_constraint == -1) {
921 wpa_printf(MSG_ERROR, "Cannot set Spectrum Management bit without Country and Power Constraint elements");
922 return -1;
923 }
924
Dmitry Shmidt05df46a2015-05-19 11:02:01 -0700925 for (i = 0; i < NUM_TX_QUEUES; i++) {
926 if (hostapd_config_check_cw(conf, i))
927 return -1;
928 }
929
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800930 for (i = 0; i < conf->num_bss; i++) {
Dmitry Shmidt344abd32014-01-14 13:17:00 -0800931 if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800932 return -1;
933 }
934
935 return 0;
936}
937
938
Dmitry Shmidt71757432014-06-02 13:50:35 -0700939void hostapd_set_security_params(struct hostapd_bss_config *bss,
940 int full_config)
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800941{
942 if (bss->individual_wep_key_len == 0) {
943 /* individual keys are not use; can use key idx0 for
944 * broadcast keys */
945 bss->broadcast_key_idx_min = 0;
946 }
947
948 if ((bss->wpa & 2) && bss->rsn_pairwise == 0)
949 bss->rsn_pairwise = bss->wpa_pairwise;
950 bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa, bss->wpa_pairwise,
951 bss->rsn_pairwise);
952
Dmitry Shmidt71757432014-06-02 13:50:35 -0700953 if (full_config) {
954 bss->radius->auth_server = bss->radius->auth_servers;
955 bss->radius->acct_server = bss->radius->acct_servers;
956 }
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800957
958 if (bss->wpa && bss->ieee802_1x) {
959 bss->ssid.security_policy = SECURITY_WPA;
960 } else if (bss->wpa) {
961 bss->ssid.security_policy = SECURITY_WPA_PSK;
962 } else if (bss->ieee802_1x) {
963 int cipher = WPA_CIPHER_NONE;
964 bss->ssid.security_policy = SECURITY_IEEE_802_1X;
965 bss->ssid.wep.default_len = bss->default_wep_key_len;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800966 if (full_config && bss->default_wep_key_len) {
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800967 cipher = bss->default_wep_key_len >= 13 ?
968 WPA_CIPHER_WEP104 : WPA_CIPHER_WEP40;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800969 } else if (full_config && bss->ssid.wep.keys_set) {
970 if (bss->ssid.wep.len[0] >= 13)
971 cipher = WPA_CIPHER_WEP104;
972 else
973 cipher = WPA_CIPHER_WEP40;
974 }
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800975 bss->wpa_group = cipher;
976 bss->wpa_pairwise = cipher;
977 bss->rsn_pairwise = cipher;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800978 if (full_config)
979 bss->wpa_key_mgmt = WPA_KEY_MGMT_IEEE8021X_NO_WPA;
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800980 } else if (bss->ssid.wep.keys_set) {
981 int cipher = WPA_CIPHER_WEP40;
982 if (bss->ssid.wep.len[0] >= 13)
983 cipher = WPA_CIPHER_WEP104;
984 bss->ssid.security_policy = SECURITY_STATIC_WEP;
985 bss->wpa_group = cipher;
986 bss->wpa_pairwise = cipher;
987 bss->rsn_pairwise = cipher;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800988 if (full_config)
989 bss->wpa_key_mgmt = WPA_KEY_MGMT_NONE;
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800990 } else if (bss->osen) {
991 bss->ssid.security_policy = SECURITY_OSEN;
992 bss->wpa_group = WPA_CIPHER_CCMP;
993 bss->wpa_pairwise = 0;
994 bss->rsn_pairwise = WPA_CIPHER_CCMP;
Dmitry Shmidtcce06662013-11-04 18:44:24 -0800995 } else {
996 bss->ssid.security_policy = SECURITY_PLAINTEXT;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800997 if (full_config) {
998 bss->wpa_group = WPA_CIPHER_NONE;
999 bss->wpa_pairwise = WPA_CIPHER_NONE;
1000 bss->rsn_pairwise = WPA_CIPHER_NONE;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -08001001 bss->wpa_key_mgmt = WPA_KEY_MGMT_NONE;
Dmitry Shmidtd80a4012015-11-05 16:35:40 -08001002 }
Dmitry Shmidtcce06662013-11-04 18:44:24 -08001003 }
1004}