3 @@ -229,6 +229,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 @@ -807,6 +807,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;
33 struct hapd_interfaces {
34 @@ -163,6 +165,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 @@ -184,6 +196,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 @@ -399,7 +412,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 @@ -419,8 +432,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 @@ -441,11 +453,6 @@ static int hostapd_global_run(struct hap
80 #endif /* EAP_SERVER_TNC */
82 - if (daemonize && os_daemonize(pid_file)) {
90 @@ -501,8 +508,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;
99 if (os_program_init())
100 @@ -576,7 +582,7 @@ int main(int argc, char *argv[])
104 - if (hostapd_global_run(&interfaces, daemonize, pid_file))
105 + if (hostapd_global_run(&interfaces))
109 @@ -587,7 +593,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 @@ -1891,6 +1891,8 @@ struct hostapd_config * hostapd_config_r
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 @@ -390,6 +390,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 @@ -463,7 +463,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 "