2013-02-16 14:26:03 +00:00
|
|
|
--- a/hostapd/main.c
|
|
|
|
+++ b/hostapd/main.c
|
2014-04-06 12:13:55 +00:00
|
|
|
@@ -36,6 +36,8 @@ struct hapd_global {
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct hapd_global global;
|
2013-02-16 14:26:03 +00:00
|
|
|
+static int daemonize = 0;
|
|
|
|
+static char *pid_file = NULL;
|
|
|
|
|
|
|
|
|
2014-04-06 12:13:55 +00:00
|
|
|
#ifndef CONFIG_NO_HOSTAPD_LOGGER
|
|
|
|
@@ -141,6 +143,14 @@ static void hostapd_logger_cb(void *ctx,
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
2013-02-16 19:00:34 +00:00
|
|
|
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
|
2013-02-16 14:26:03 +00:00
|
|
|
|
|
|
|
+static void hostapd_setup_complete_cb(void *ctx)
|
|
|
|
+{
|
|
|
|
+ if (daemonize && os_daemonize(pid_file)) {
|
|
|
|
+ perror("daemon");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ daemonize = 0;
|
|
|
|
+}
|
|
|
|
|
2013-02-16 19:00:34 +00:00
|
|
|
/**
|
2013-11-25 15:43:15 +00:00
|
|
|
* hostapd_driver_init - Preparate driver interface
|
2014-04-06 12:13:55 +00:00
|
|
|
@@ -159,6 +169,8 @@ static int hostapd_driver_init(struct ho
|
2013-11-25 15:43:15 +00:00
|
|
|
return -1;
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
|
|
|
|
2013-11-25 15:43:15 +00:00
|
|
|
+ hapd->setup_complete_cb = hostapd_setup_complete_cb;
|
|
|
|
+
|
|
|
|
/* Initialize the driver interface */
|
|
|
|
if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
|
|
|
|
b = NULL;
|
2014-10-17 06:15:35 +00:00
|
|
|
@@ -372,8 +384,6 @@ static void hostapd_global_deinit(const
|
2013-02-16 14:26:03 +00:00
|
|
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
|
|
|
|
|
|
|
eap_server_unregister_methods();
|
|
|
|
-
|
|
|
|
- os_daemonize_terminate(pid_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-06 12:13:55 +00:00
|
|
|
@@ -399,11 +409,6 @@ static int hostapd_global_run(struct hap
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
|
|
|
#endif /* EAP_SERVER_TNC */
|
|
|
|
|
|
|
|
- if (daemonize && os_daemonize(pid_file)) {
|
|
|
|
- perror("daemon");
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
eloop_run();
|
|
|
|
|
|
|
|
return 0;
|
2014-04-06 12:13:55 +00:00
|
|
|
@@ -533,8 +538,7 @@ int main(int argc, char *argv[])
|
2013-02-16 14:26:03 +00:00
|
|
|
struct hapd_interfaces interfaces;
|
|
|
|
int ret = 1;
|
2013-11-25 15:43:15 +00:00
|
|
|
size_t i, j;
|
2013-02-16 14:26:03 +00:00
|
|
|
- int c, debug = 0, daemonize = 0;
|
|
|
|
- char *pid_file = NULL;
|
|
|
|
+ int c, debug = 0;
|
|
|
|
const char *log_file = NULL;
|
|
|
|
const char *entropy_file = NULL;
|
2013-11-25 15:43:15 +00:00
|
|
|
char **bss_config = NULL, **tmp_bss;
|