3 @@ -247,6 +247,7 @@ struct hostapd_iface {
4 int (*for_each_interface)(struct hapd_interfaces *interfaces,
5 int (*cb)(struct hostapd_iface *iface,
6 void *ctx), void *ctx);
7 + int (*init_complete)(struct hostapd_iface *iface);
11 --- a/src/ap/hostapd.c
12 +++ b/src/ap/hostapd.c
13 @@ -851,6 +851,9 @@ int hostapd_setup_interface_complete(str
14 wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
15 iface->bss[0]->conf->iface);
17 + if (iface->init_complete)
18 + iface->init_complete(iface);
26 extern int wpa_debug_level;
27 extern int wpa_debug_show_keys;
28 extern int wpa_debug_timestamp;
29 +static int daemonize = 0;
30 +static char *pid_file = NULL;
32 extern struct wpa_driver_ops *wpa_drivers[];
34 @@ -145,6 +147,16 @@ static void hostapd_logger_cb(void *ctx,
36 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
38 +static int hostapd_init_complete(struct hostapd_iface *iface)
40 + if (daemonize && os_daemonize(pid_file)) {
50 * hostapd_init - Allocate and initialize per-interface data
51 @@ -166,6 +178,7 @@ static struct hostapd_iface * hostapd_in
52 if (hapd_iface == NULL)
55 + hapd_iface->init_complete = hostapd_init_complete;
56 hapd_iface->reload_config = hostapd_reload_config;
57 hapd_iface->config_read_cb = hostapd_config_read;
58 hapd_iface->config_fname = os_strdup(config_file);
59 @@ -419,7 +432,7 @@ static int hostapd_global_init(struct ha
63 -static void hostapd_global_deinit(const char *pid_file)
64 +static void hostapd_global_deinit(void)
68 @@ -449,8 +462,7 @@ static void hostapd_global_deinit(const
72 -static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
73 - const char *pid_file)
74 +static int hostapd_global_run(struct hapd_interfaces *iface)
78 @@ -471,11 +483,6 @@ static int hostapd_global_run(struct hap
80 #endif /* EAP_SERVER_TNC */
82 - if (daemonize && os_daemonize(pid_file)) {
90 @@ -532,8 +539,7 @@ int main(int argc, char *argv[])
91 struct hapd_interfaces interfaces;
94 - int c, debug = 0, daemonize = 0;
95 - char *pid_file = NULL;
97 const char *log_file = NULL;
98 const char *entropy_file = NULL;
100 @@ -611,7 +617,7 @@ int main(int argc, char *argv[])
104 - if (hostapd_global_run(&interfaces, daemonize, pid_file))
105 + if (hostapd_global_run(&interfaces))
109 @@ -622,7 +628,7 @@ int main(int argc, char *argv[])
110 hostapd_interface_deinit_free(interfaces.iface[i]);
111 os_free(interfaces.iface);
113 - hostapd_global_deinit(pid_file);
114 + hostapd_global_deinit();
118 --- a/hostapd/config_file.c
119 +++ b/hostapd/config_file.c
120 @@ -1941,6 +1941,8 @@ static int hostapd_config_fill(struct ho
122 #endif /* CONFIG_IEEE80211W */
123 #ifdef CONFIG_IEEE80211N
124 + } else if (os_strcmp(buf, "noscan") == 0) {
125 + conf->noscan = atoi(pos);
126 } else if (os_strcmp(buf, "ieee80211n") == 0) {
127 conf->ieee80211n = atoi(pos);
128 } else if (os_strcmp(buf, "ht_capab") == 0) {
129 --- a/src/ap/ap_config.h
130 +++ b/src/ap/ap_config.h
131 @@ -430,6 +430,7 @@ struct hostapd_config {
133 int ht_op_mode_fixed;
137 int secondary_channel;
139 --- a/src/ap/hw_features.c
140 +++ b/src/ap/hw_features.c
141 @@ -451,7 +451,7 @@ static int ieee80211n_check_40mhz(struct
143 struct wpa_driver_scan_params params;
145 - if (!iface->conf->secondary_channel)
146 + if (!iface->conf->secondary_channel || iface->conf->noscan)
147 return 0; /* HT40 not used */
149 wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "