2013-02-16 14:26:03 +00:00
|
|
|
--- a/hostapd/main.c
|
|
|
|
+++ b/hostapd/main.c
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -37,6 +37,8 @@ struct hapd_global {
|
2014-04-06 12:13:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
2017-01-25 07:32:00 +00:00
|
|
|
@@ -147,6 +149,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
|
2017-01-25 07:32:00 +00:00
|
|
|
@@ -165,6 +175,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;
|
2017-01-25 07:32:00 +00:00
|
|
|
@@ -405,8 +417,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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-25 07:32:00 +00:00
|
|
|
@@ -432,18 +442,6 @@ static int hostapd_global_run(struct hap
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
|
|
|
#endif /* EAP_SERVER_TNC */
|
|
|
|
|
2016-05-12 12:07:15 +00:00
|
|
|
- if (daemonize) {
|
|
|
|
- if (os_daemonize(pid_file)) {
|
|
|
|
- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
- if (eloop_sock_requeue()) {
|
|
|
|
- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
|
|
|
|
- strerror(errno));
|
|
|
|
- return -1;
|
|
|
|
- }
|
2013-02-16 14:26:03 +00:00
|
|
|
- }
|
|
|
|
-
|
|
|
|
eloop_run();
|
|
|
|
|
|
|
|
return 0;
|
2017-01-25 07:32:00 +00:00
|
|
|
@@ -645,8 +643,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;
|