2013-02-16 22:26:03 +08:00
|
|
|
--- a/hostapd/main.c
|
|
|
|
+++ b/hostapd/main.c
|
2014-04-06 20:13:55 +08:00
|
|
|
@@ -36,6 +36,8 @@ struct hapd_global {
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct hapd_global global;
|
2013-02-16 22:26:03 +08:00
|
|
|
+static int daemonize = 0;
|
|
|
|
+static char *pid_file = NULL;
|
|
|
|
|
|
|
|
|
2014-04-06 20:13:55 +08:00
|
|
|
#ifndef CONFIG_NO_HOSTAPD_LOGGER
|
2014-10-26 00:48:45 +08:00
|
|
|
@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
|
2013-02-16 22:26:03 +08:00
|
|
|
}
|
2013-02-17 03:00:34 +08:00
|
|
|
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
|
2013-02-16 22:26:03 +08:00
|
|
|
|
|
|
|
+static void hostapd_setup_complete_cb(void *ctx)
|
|
|
|
+{
|
|
|
|
+ if (daemonize && os_daemonize(pid_file)) {
|
|
|
|
+ perror("daemon");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ daemonize = 0;
|
|
|
|
+}
|
|
|
|
|
2013-02-17 03:00:34 +08:00
|
|
|
/**
|
2013-11-25 23:43:15 +08:00
|
|
|
* hostapd_driver_init - Preparate driver interface
|
2014-10-26 00:48:45 +08:00
|
|
|
@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
|
2013-11-25 23:43:15 +08:00
|
|
|
return -1;
|
2013-02-16 22:26:03 +08:00
|
|
|
}
|
|
|
|
|
2013-11-25 23:43:15 +08: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-26 00:48:45 +08:00
|
|
|
@@ -374,8 +386,6 @@ static void hostapd_global_deinit(const
|
2013-02-16 22:26:03 +08:00
|
|
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
|
|
|
|
|
|
|
eap_server_unregister_methods();
|
|
|
|
-
|
|
|
|
- os_daemonize_terminate(pid_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-26 00:48:45 +08:00
|
|
|
@@ -401,11 +411,6 @@ static int hostapd_global_run(struct hap
|
2013-02-16 22:26:03 +08:00
|
|
|
}
|
|
|
|
#endif /* EAP_SERVER_TNC */
|
|
|
|
|
|
|
|
- if (daemonize && os_daemonize(pid_file)) {
|
|
|
|
- perror("daemon");
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
eloop_run();
|
|
|
|
|
|
|
|
return 0;
|
2014-10-26 00:48:45 +08:00
|
|
|
@@ -535,8 +540,7 @@ int main(int argc, char *argv[])
|
2013-02-16 22:26:03 +08:00
|
|
|
struct hapd_interfaces interfaces;
|
|
|
|
int ret = 1;
|
2013-11-25 23:43:15 +08:00
|
|
|
size_t i, j;
|
2013-02-16 22:26:03 +08: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 23:43:15 +08:00
|
|
|
char **bss_config = NULL, **tmp_bss;
|