2013-02-16 14:26:03 +00:00
|
|
|
--- a/hostapd/main.c
|
|
|
|
+++ b/hostapd/main.c
|
2019-05-03 23:52:25 +00:00
|
|
|
@@ -39,6 +39,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
|
2020-05-03 13:20:52 +00:00
|
|
|
@@ -146,6 +148,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
|
2023-07-06 06:16:50 +00:00
|
|
|
@@ -217,6 +227,8 @@ static int hostapd_driver_init(struct ho
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
2023-07-06 06:16:50 +00:00
|
|
|
#endif /* CONFIG_IEEE80211BE */
|
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;
|
2023-07-06 06:16:50 +00:00
|
|
|
@@ -497,8 +509,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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-07-06 06:16:50 +00:00
|
|
|
@@ -524,18 +534,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;
|
2023-07-06 06:16:50 +00:00
|
|
|
@@ -739,8 +737,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;
|