]> git.ipfire.org Git - thirdparty/hostap.git/blob - hostapd/main.c
WPS: Make UUID-from-MAC Address easily available
[thirdparty/hostap.git] / hostapd / main.c
1 /*
2 * hostapd / main()
3 * Copyright (c) 2002-2011, 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
9 #include "utils/includes.h"
10 #ifndef CONFIG_NATIVE_WINDOWS
11 #include <syslog.h>
12 #include <grp.h>
13 #endif /* CONFIG_NATIVE_WINDOWS */
14
15 #include "utils/common.h"
16 #include "utils/eloop.h"
17 #include "utils/uuid.h"
18 #include "crypto/random.h"
19 #include "crypto/tls.h"
20 #include "common/version.h"
21 #include "drivers/driver.h"
22 #include "eap_server/eap.h"
23 #include "eap_server/tncs.h"
24 #include "ap/hostapd.h"
25 #include "ap/ap_config.h"
26 #include "ap/ap_drv_ops.h"
27 #include "config_file.h"
28 #include "eap_register.h"
29 #include "ctrl_iface.h"
30
31
32 struct hapd_global {
33 void **drv_priv;
34 size_t drv_count;
35 };
36
37 static struct hapd_global global;
38
39
40 #ifndef CONFIG_NO_HOSTAPD_LOGGER
41 static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
42 int level, const char *txt, size_t len)
43 {
44 struct hostapd_data *hapd = ctx;
45 char *format, *module_str;
46 int maxlen;
47 int conf_syslog_level, conf_stdout_level;
48 unsigned int conf_syslog, conf_stdout;
49
50 maxlen = len + 100;
51 format = os_malloc(maxlen);
52 if (!format)
53 return;
54
55 if (hapd && hapd->conf) {
56 conf_syslog_level = hapd->conf->logger_syslog_level;
57 conf_stdout_level = hapd->conf->logger_stdout_level;
58 conf_syslog = hapd->conf->logger_syslog;
59 conf_stdout = hapd->conf->logger_stdout;
60 } else {
61 conf_syslog_level = conf_stdout_level = 0;
62 conf_syslog = conf_stdout = (unsigned int) -1;
63 }
64
65 switch (module) {
66 case HOSTAPD_MODULE_IEEE80211:
67 module_str = "IEEE 802.11";
68 break;
69 case HOSTAPD_MODULE_IEEE8021X:
70 module_str = "IEEE 802.1X";
71 break;
72 case HOSTAPD_MODULE_RADIUS:
73 module_str = "RADIUS";
74 break;
75 case HOSTAPD_MODULE_WPA:
76 module_str = "WPA";
77 break;
78 case HOSTAPD_MODULE_DRIVER:
79 module_str = "DRIVER";
80 break;
81 case HOSTAPD_MODULE_IAPP:
82 module_str = "IAPP";
83 break;
84 case HOSTAPD_MODULE_MLME:
85 module_str = "MLME";
86 break;
87 default:
88 module_str = NULL;
89 break;
90 }
91
92 if (hapd && hapd->conf && addr)
93 os_snprintf(format, maxlen, "%s: STA " MACSTR "%s%s: %s",
94 hapd->conf->iface, MAC2STR(addr),
95 module_str ? " " : "", module_str, txt);
96 else if (hapd && hapd->conf)
97 os_snprintf(format, maxlen, "%s:%s%s %s",
98 hapd->conf->iface, module_str ? " " : "",
99 module_str, txt);
100 else if (addr)
101 os_snprintf(format, maxlen, "STA " MACSTR "%s%s: %s",
102 MAC2STR(addr), module_str ? " " : "",
103 module_str, txt);
104 else
105 os_snprintf(format, maxlen, "%s%s%s",
106 module_str, module_str ? ": " : "", txt);
107
108 if ((conf_stdout & module) && level >= conf_stdout_level) {
109 wpa_debug_print_timestamp();
110 wpa_printf(MSG_INFO, "%s", format);
111 }
112
113 #ifndef CONFIG_NATIVE_WINDOWS
114 if ((conf_syslog & module) && level >= conf_syslog_level) {
115 int priority;
116 switch (level) {
117 case HOSTAPD_LEVEL_DEBUG_VERBOSE:
118 case HOSTAPD_LEVEL_DEBUG:
119 priority = LOG_DEBUG;
120 break;
121 case HOSTAPD_LEVEL_INFO:
122 priority = LOG_INFO;
123 break;
124 case HOSTAPD_LEVEL_NOTICE:
125 priority = LOG_NOTICE;
126 break;
127 case HOSTAPD_LEVEL_WARNING:
128 priority = LOG_WARNING;
129 break;
130 default:
131 priority = LOG_INFO;
132 break;
133 }
134 syslog(priority, "%s", format);
135 }
136 #endif /* CONFIG_NATIVE_WINDOWS */
137
138 os_free(format);
139 }
140 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
141
142
143 /**
144 * hostapd_driver_init - Preparate driver interface
145 */
146 static int hostapd_driver_init(struct hostapd_iface *iface)
147 {
148 struct wpa_init_params params;
149 size_t i;
150 struct hostapd_data *hapd = iface->bss[0];
151 struct hostapd_bss_config *conf = hapd->conf;
152 u8 *b = conf->bssid;
153 struct wpa_driver_capa capa;
154
155 if (hapd->driver == NULL || hapd->driver->hapd_init == NULL) {
156 wpa_printf(MSG_ERROR, "No hostapd driver wrapper available");
157 return -1;
158 }
159
160 /* Initialize the driver interface */
161 if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
162 b = NULL;
163
164 os_memset(&params, 0, sizeof(params));
165 for (i = 0; wpa_drivers[i]; i++) {
166 if (wpa_drivers[i] != hapd->driver)
167 continue;
168
169 if (global.drv_priv[i] == NULL &&
170 wpa_drivers[i]->global_init) {
171 global.drv_priv[i] = wpa_drivers[i]->global_init();
172 if (global.drv_priv[i] == NULL) {
173 wpa_printf(MSG_ERROR, "Failed to initialize "
174 "driver '%s'",
175 wpa_drivers[i]->name);
176 return -1;
177 }
178 }
179
180 params.global_priv = global.drv_priv[i];
181 break;
182 }
183 params.bssid = b;
184 params.ifname = hapd->conf->iface;
185 params.ssid = hapd->conf->ssid.ssid;
186 params.ssid_len = hapd->conf->ssid.ssid_len;
187 params.test_socket = hapd->conf->test_socket;
188 params.use_pae_group_addr = hapd->conf->use_pae_group_addr;
189
190 params.num_bridge = hapd->iface->num_bss;
191 params.bridge = os_calloc(hapd->iface->num_bss, sizeof(char *));
192 if (params.bridge == NULL)
193 return -1;
194 for (i = 0; i < hapd->iface->num_bss; i++) {
195 struct hostapd_data *bss = hapd->iface->bss[i];
196 if (bss->conf->bridge[0])
197 params.bridge[i] = bss->conf->bridge;
198 }
199
200 params.own_addr = hapd->own_addr;
201
202 hapd->drv_priv = hapd->driver->hapd_init(hapd, &params);
203 os_free(params.bridge);
204 if (hapd->drv_priv == NULL) {
205 wpa_printf(MSG_ERROR, "%s driver initialization failed.",
206 hapd->driver->name);
207 hapd->driver = NULL;
208 return -1;
209 }
210
211 if (hapd->driver->get_capa &&
212 hapd->driver->get_capa(hapd->drv_priv, &capa) == 0) {
213 iface->drv_flags = capa.flags;
214 iface->probe_resp_offloads = capa.probe_resp_offloads;
215 iface->extended_capa = capa.extended_capa;
216 iface->extended_capa_mask = capa.extended_capa_mask;
217 iface->extended_capa_len = capa.extended_capa_len;
218 iface->drv_max_acl_mac_addrs = capa.max_acl_mac_addrs;
219 }
220
221 return 0;
222 }
223
224
225 /**
226 * hostapd_interface_init - Read configuration file and init BSS data
227 *
228 * This function is used to parse configuration file for a full interface (one
229 * or more BSSes sharing the same radio) and allocate memory for the BSS
230 * interfaces. No actiual driver operations are started.
231 */
232 static struct hostapd_iface *
233 hostapd_interface_init(struct hapd_interfaces *interfaces,
234 const char *config_fname, int debug)
235 {
236 struct hostapd_iface *iface;
237 int k;
238
239 wpa_printf(MSG_ERROR, "Configuration file: %s", config_fname);
240 iface = hostapd_init(interfaces, config_fname);
241 if (!iface)
242 return NULL;
243 iface->interfaces = interfaces;
244
245 for (k = 0; k < debug; k++) {
246 if (iface->bss[0]->conf->logger_stdout_level > 0)
247 iface->bss[0]->conf->logger_stdout_level--;
248 }
249
250 if (iface->conf->bss[0]->iface[0] == '\0' &&
251 !hostapd_drv_none(iface->bss[0])) {
252 wpa_printf(MSG_ERROR, "Interface name not specified in %s",
253 config_fname);
254 hostapd_interface_deinit_free(iface);
255 return NULL;
256 }
257
258 return iface;
259 }
260
261
262 /**
263 * handle_term - SIGINT and SIGTERM handler to terminate hostapd process
264 */
265 static void handle_term(int sig, void *signal_ctx)
266 {
267 wpa_printf(MSG_DEBUG, "Signal %d received - terminating", sig);
268 eloop_terminate();
269 }
270
271
272 #ifndef CONFIG_NATIVE_WINDOWS
273
274 static int handle_reload_iface(struct hostapd_iface *iface, void *ctx)
275 {
276 if (hostapd_reload_config(iface) < 0) {
277 wpa_printf(MSG_WARNING, "Failed to read new configuration "
278 "file - continuing with old.");
279 }
280 return 0;
281 }
282
283
284 /**
285 * handle_reload - SIGHUP handler to reload configuration
286 */
287 static void handle_reload(int sig, void *signal_ctx)
288 {
289 struct hapd_interfaces *interfaces = signal_ctx;
290 wpa_printf(MSG_DEBUG, "Signal %d received - reloading configuration",
291 sig);
292 hostapd_for_each_interface(interfaces, handle_reload_iface, NULL);
293 }
294
295
296 static void handle_dump_state(int sig, void *signal_ctx)
297 {
298 /* Not used anymore - ignore signal */
299 }
300 #endif /* CONFIG_NATIVE_WINDOWS */
301
302
303 static int hostapd_global_init(struct hapd_interfaces *interfaces,
304 const char *entropy_file)
305 {
306 int i;
307
308 os_memset(&global, 0, sizeof(global));
309
310 hostapd_logger_register_cb(hostapd_logger_cb);
311
312 if (eap_server_register_methods()) {
313 wpa_printf(MSG_ERROR, "Failed to register EAP methods");
314 return -1;
315 }
316
317 if (eloop_init()) {
318 wpa_printf(MSG_ERROR, "Failed to initialize event loop");
319 return -1;
320 }
321
322 random_init(entropy_file);
323
324 #ifndef CONFIG_NATIVE_WINDOWS
325 eloop_register_signal(SIGHUP, handle_reload, interfaces);
326 eloop_register_signal(SIGUSR1, handle_dump_state, interfaces);
327 #endif /* CONFIG_NATIVE_WINDOWS */
328 eloop_register_signal_terminate(handle_term, interfaces);
329
330 #ifndef CONFIG_NATIVE_WINDOWS
331 openlog("hostapd", 0, LOG_DAEMON);
332 #endif /* CONFIG_NATIVE_WINDOWS */
333
334 for (i = 0; wpa_drivers[i]; i++)
335 global.drv_count++;
336 if (global.drv_count == 0) {
337 wpa_printf(MSG_ERROR, "No drivers enabled");
338 return -1;
339 }
340 global.drv_priv = os_calloc(global.drv_count, sizeof(void *));
341 if (global.drv_priv == NULL)
342 return -1;
343
344 return 0;
345 }
346
347
348 static void hostapd_global_deinit(const char *pid_file)
349 {
350 int i;
351
352 for (i = 0; wpa_drivers[i] && global.drv_priv; i++) {
353 if (!global.drv_priv[i])
354 continue;
355 wpa_drivers[i]->global_deinit(global.drv_priv[i]);
356 }
357 os_free(global.drv_priv);
358 global.drv_priv = NULL;
359
360 #ifdef EAP_SERVER_TNC
361 tncs_global_deinit();
362 #endif /* EAP_SERVER_TNC */
363
364 random_deinit();
365
366 eloop_destroy();
367
368 #ifndef CONFIG_NATIVE_WINDOWS
369 closelog();
370 #endif /* CONFIG_NATIVE_WINDOWS */
371
372 eap_server_unregister_methods();
373
374 os_daemonize_terminate(pid_file);
375 }
376
377
378 static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
379 const char *pid_file)
380 {
381 #ifdef EAP_SERVER_TNC
382 int tnc = 0;
383 size_t i, k;
384
385 for (i = 0; !tnc && i < ifaces->count; i++) {
386 for (k = 0; k < ifaces->iface[i]->num_bss; k++) {
387 if (ifaces->iface[i]->bss[0]->conf->tnc) {
388 tnc++;
389 break;
390 }
391 }
392 }
393
394 if (tnc && tncs_global_init() < 0) {
395 wpa_printf(MSG_ERROR, "Failed to initialize TNCS");
396 return -1;
397 }
398 #endif /* EAP_SERVER_TNC */
399
400 if (daemonize && os_daemonize(pid_file)) {
401 perror("daemon");
402 return -1;
403 }
404
405 eloop_run();
406
407 return 0;
408 }
409
410
411 static void show_version(void)
412 {
413 fprintf(stderr,
414 "hostapd v" VERSION_STR "\n"
415 "User space daemon for IEEE 802.11 AP management,\n"
416 "IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator\n"
417 "Copyright (c) 2002-2014, Jouni Malinen <j@w1.fi> "
418 "and contributors\n");
419 }
420
421
422 static void usage(void)
423 {
424 show_version();
425 fprintf(stderr,
426 "\n"
427 "usage: hostapd [-hdBKtv] [-P <PID file>] [-e <entropy file>] "
428 "\\\n"
429 " [-g <global ctrl_iface>] [-G <group>] \\\n"
430 " <configuration file(s)>\n"
431 "\n"
432 "options:\n"
433 " -h show this usage\n"
434 " -d show more debug messages (-dd for even more)\n"
435 " -B run daemon in the background\n"
436 " -e entropy file\n"
437 " -g global control interface path\n"
438 " -G group for control interfaces\n"
439 " -P PID file\n"
440 " -K include key data in debug messages\n"
441 #ifdef CONFIG_DEBUG_FILE
442 " -f log output to debug file instead of stdout\n"
443 #endif /* CONFIG_DEBUG_FILE */
444 #ifdef CONFIG_DEBUG_LINUX_TRACING
445 " -T = record to Linux tracing in addition to logging\n"
446 " (records all messages regardless of debug verbosity)\n"
447 #endif /* CONFIG_DEBUG_LINUX_TRACING */
448 " -t include timestamps in some debug messages\n"
449 " -v show hostapd version\n");
450
451 exit(1);
452 }
453
454
455 static const char * hostapd_msg_ifname_cb(void *ctx)
456 {
457 struct hostapd_data *hapd = ctx;
458 if (hapd && hapd->iconf && hapd->iconf->bss &&
459 hapd->iconf->num_bss > 0 && hapd->iconf->bss[0])
460 return hapd->iconf->bss[0]->iface;
461 return NULL;
462 }
463
464
465 static int hostapd_get_global_ctrl_iface(struct hapd_interfaces *interfaces,
466 const char *path)
467 {
468 char *pos;
469 os_free(interfaces->global_iface_path);
470 interfaces->global_iface_path = os_strdup(path);
471 if (interfaces->global_iface_path == NULL)
472 return -1;
473 pos = os_strrchr(interfaces->global_iface_path, '/');
474 if (pos == NULL) {
475 wpa_printf(MSG_ERROR, "No '/' in the global control interface "
476 "file");
477 os_free(interfaces->global_iface_path);
478 interfaces->global_iface_path = NULL;
479 return -1;
480 }
481
482 *pos = '\0';
483 interfaces->global_iface_name = pos + 1;
484
485 return 0;
486 }
487
488
489 static int hostapd_get_ctrl_iface_group(struct hapd_interfaces *interfaces,
490 const char *group)
491 {
492 #ifndef CONFIG_NATIVE_WINDOWS
493 struct group *grp;
494 grp = getgrnam(group);
495 if (grp == NULL) {
496 wpa_printf(MSG_ERROR, "Unknown group '%s'", group);
497 return -1;
498 }
499 interfaces->ctrl_iface_group = grp->gr_gid;
500 #endif /* CONFIG_NATIVE_WINDOWS */
501 return 0;
502 }
503
504
505 #ifdef CONFIG_WPS
506 static int gen_uuid(const char *txt_addr)
507 {
508 u8 addr[ETH_ALEN];
509 u8 uuid[UUID_LEN];
510 char buf[100];
511
512 if (hwaddr_aton(txt_addr, addr) < 0)
513 return -1;
514
515 uuid_gen_mac_addr(addr, uuid);
516 if (uuid_bin2str(uuid, buf, sizeof(buf)) < 0)
517 return -1;
518
519 printf("%s\n", buf);
520
521 return 0;
522 }
523 #endif /* CONFIG_WPS */
524
525
526 int main(int argc, char *argv[])
527 {
528 struct hapd_interfaces interfaces;
529 int ret = 1;
530 size_t i, j;
531 int c, debug = 0, daemonize = 0;
532 char *pid_file = NULL;
533 const char *log_file = NULL;
534 const char *entropy_file = NULL;
535 char **bss_config = NULL, **tmp_bss;
536 size_t num_bss_configs = 0;
537 #ifdef CONFIG_DEBUG_LINUX_TRACING
538 int enable_trace_dbg = 0;
539 #endif /* CONFIG_DEBUG_LINUX_TRACING */
540
541 if (os_program_init())
542 return -1;
543
544 os_memset(&interfaces, 0, sizeof(interfaces));
545 interfaces.reload_config = hostapd_reload_config;
546 interfaces.config_read_cb = hostapd_config_read;
547 interfaces.for_each_interface = hostapd_for_each_interface;
548 interfaces.ctrl_iface_init = hostapd_ctrl_iface_init;
549 interfaces.ctrl_iface_deinit = hostapd_ctrl_iface_deinit;
550 interfaces.driver_init = hostapd_driver_init;
551 interfaces.global_iface_path = NULL;
552 interfaces.global_iface_name = NULL;
553 interfaces.global_ctrl_sock = -1;
554
555 for (;;) {
556 c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
557 if (c < 0)
558 break;
559 switch (c) {
560 case 'h':
561 usage();
562 break;
563 case 'd':
564 debug++;
565 if (wpa_debug_level > 0)
566 wpa_debug_level--;
567 break;
568 case 'B':
569 daemonize++;
570 break;
571 case 'e':
572 entropy_file = optarg;
573 break;
574 case 'f':
575 log_file = optarg;
576 break;
577 case 'K':
578 wpa_debug_show_keys++;
579 break;
580 case 'P':
581 os_free(pid_file);
582 pid_file = os_rel2abs_path(optarg);
583 break;
584 case 't':
585 wpa_debug_timestamp++;
586 break;
587 #ifdef CONFIG_DEBUG_LINUX_TRACING
588 case 'T':
589 enable_trace_dbg = 1;
590 break;
591 #endif /* CONFIG_DEBUG_LINUX_TRACING */
592 case 'v':
593 show_version();
594 exit(1);
595 break;
596 case 'g':
597 if (hostapd_get_global_ctrl_iface(&interfaces, optarg))
598 return -1;
599 break;
600 case 'G':
601 if (hostapd_get_ctrl_iface_group(&interfaces, optarg))
602 return -1;
603 break;
604 case 'b':
605 tmp_bss = os_realloc_array(bss_config,
606 num_bss_configs + 1,
607 sizeof(char *));
608 if (tmp_bss == NULL)
609 goto out;
610 bss_config = tmp_bss;
611 bss_config[num_bss_configs++] = optarg;
612 break;
613 #ifdef CONFIG_WPS
614 case 'u':
615 return gen_uuid(optarg);
616 #endif /* CONFIG_WPS */
617 default:
618 usage();
619 break;
620 }
621 }
622
623 if (optind == argc && interfaces.global_iface_path == NULL &&
624 num_bss_configs == 0)
625 usage();
626
627 wpa_msg_register_ifname_cb(hostapd_msg_ifname_cb);
628
629 if (log_file)
630 wpa_debug_open_file(log_file);
631 #ifdef CONFIG_DEBUG_LINUX_TRACING
632 if (enable_trace_dbg) {
633 int tret = wpa_debug_open_linux_tracing();
634 if (tret) {
635 wpa_printf(MSG_ERROR, "Failed to enable trace logging");
636 return -1;
637 }
638 }
639 #endif /* CONFIG_DEBUG_LINUX_TRACING */
640
641 interfaces.count = argc - optind;
642 if (interfaces.count || num_bss_configs) {
643 interfaces.iface = os_calloc(interfaces.count + num_bss_configs,
644 sizeof(struct hostapd_iface *));
645 if (interfaces.iface == NULL) {
646 wpa_printf(MSG_ERROR, "malloc failed");
647 return -1;
648 }
649 }
650
651 if (hostapd_global_init(&interfaces, entropy_file)) {
652 wpa_printf(MSG_ERROR, "Failed to initilize global context");
653 return -1;
654 }
655
656 /* Allocate and parse configuration for full interface files */
657 for (i = 0; i < interfaces.count; i++) {
658 interfaces.iface[i] = hostapd_interface_init(&interfaces,
659 argv[optind + i],
660 debug);
661 if (!interfaces.iface[i]) {
662 wpa_printf(MSG_ERROR, "Failed to initialize interface");
663 goto out;
664 }
665 }
666
667 /* Allocate and parse configuration for per-BSS files */
668 for (i = 0; i < num_bss_configs; i++) {
669 struct hostapd_iface *iface;
670 char *fname;
671
672 wpa_printf(MSG_INFO, "BSS config: %s", bss_config[i]);
673 fname = os_strchr(bss_config[i], ':');
674 if (fname == NULL) {
675 wpa_printf(MSG_ERROR,
676 "Invalid BSS config identifier '%s'",
677 bss_config[i]);
678 goto out;
679 }
680 *fname++ = '\0';
681 iface = hostapd_interface_init_bss(&interfaces, bss_config[i],
682 fname, debug);
683 if (iface == NULL)
684 goto out;
685 for (j = 0; j < interfaces.count; j++) {
686 if (interfaces.iface[j] == iface)
687 break;
688 }
689 if (j == interfaces.count) {
690 struct hostapd_iface **tmp;
691 tmp = os_realloc_array(interfaces.iface,
692 interfaces.count + 1,
693 sizeof(struct hostapd_iface *));
694 if (tmp == NULL) {
695 hostapd_interface_deinit_free(iface);
696 goto out;
697 }
698 interfaces.iface = tmp;
699 interfaces.iface[interfaces.count++] = iface;
700 }
701 }
702
703 /*
704 * Enable configured interfaces. Depending on channel configuration,
705 * this may complete full initialization before returning or use a
706 * callback mechanism to complete setup in case of operations like HT
707 * co-ex scans, ACS, or DFS are needed to determine channel parameters.
708 * In such case, the interface will be enabled from eloop context within
709 * hostapd_global_run().
710 */
711 interfaces.terminate_on_error = interfaces.count;
712 for (i = 0; i < interfaces.count; i++) {
713 if (hostapd_driver_init(interfaces.iface[i]) ||
714 hostapd_setup_interface(interfaces.iface[i]))
715 goto out;
716 }
717
718 hostapd_global_ctrl_iface_init(&interfaces);
719
720 if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
721 wpa_printf(MSG_ERROR, "Failed to start eloop");
722 goto out;
723 }
724
725 ret = 0;
726
727 out:
728 hostapd_global_ctrl_iface_deinit(&interfaces);
729 /* Deinitialize all interfaces */
730 for (i = 0; i < interfaces.count; i++)
731 hostapd_interface_deinit_free(interfaces.iface[i]);
732 os_free(interfaces.iface);
733
734 hostapd_global_deinit(pid_file);
735 os_free(pid_file);
736
737 if (log_file)
738 wpa_debug_close_file();
739 wpa_debug_close_linux_tracing();
740
741 os_free(bss_config);
742
743 os_program_deinit();
744
745 return ret;
746 }