3 @@ -221,6 +221,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 @@ -779,6 +779,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 @@ -162,6 +164,15 @@ 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)) {
49 * hostapd_init - Allocate and initialize per-interface data
50 @@ -183,6 +194,7 @@ static struct hostapd_iface * hostapd_in
51 if (hapd_iface == NULL)
54 + hapd_iface->init_complete = hostapd_init_complete;
55 hapd_iface->reload_config = hostapd_reload_config;
56 hapd_iface->config_read_cb = hostapd_config_read;
57 hapd_iface->config_fname = os_strdup(config_file);
58 @@ -391,7 +403,7 @@ static int hostapd_global_init(struct ha
62 -static void hostapd_global_deinit(const char *pid_file)
63 +static void hostapd_global_deinit(void)
67 @@ -409,8 +421,7 @@ static void hostapd_global_deinit(const
71 -static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
72 - const char *pid_file)
73 +static int hostapd_global_run(struct hapd_interfaces *iface)
77 @@ -431,11 +442,6 @@ static int hostapd_global_run(struct hap
79 #endif /* EAP_SERVER_TNC */
81 - if (daemonize && os_daemonize(pid_file)) {
89 @@ -479,8 +485,7 @@ int main(int argc, char *argv[])
90 struct hapd_interfaces interfaces;
93 - int c, debug = 0, daemonize = 0;
94 - char *pid_file = NULL;
97 if (os_program_init())
99 @@ -545,7 +550,7 @@ int main(int argc, char *argv[])
103 - if (hostapd_global_run(&interfaces, daemonize, pid_file))
104 + if (hostapd_global_run(&interfaces))
108 @@ -556,7 +561,7 @@ int main(int argc, char *argv[])
109 hostapd_interface_deinit_free(interfaces.iface[i]);
110 os_free(interfaces.iface);
112 - hostapd_global_deinit(pid_file);
113 + hostapd_global_deinit();
117 --- a/hostapd/config_file.c
118 +++ b/hostapd/config_file.c
119 @@ -1890,6 +1890,8 @@ struct hostapd_config * hostapd_config_r
121 #endif /* CONFIG_IEEE80211W */
122 #ifdef CONFIG_IEEE80211N
123 + } else if (os_strcmp(buf, "noscan") == 0) {
124 + conf->noscan = atoi(pos);
125 } else if (os_strcmp(buf, "ieee80211n") == 0) {
126 conf->ieee80211n = atoi(pos);
127 } else if (os_strcmp(buf, "ht_capab") == 0) {
128 --- a/src/ap/ap_config.h
129 +++ b/src/ap/ap_config.h
130 @@ -382,6 +382,7 @@ struct hostapd_config {
132 int ht_op_mode_fixed;
136 int secondary_channel;
138 --- a/src/ap/hw_features.c
139 +++ b/src/ap/hw_features.c
140 @@ -460,7 +460,7 @@ static int ieee80211n_check_40mhz(struct
142 struct wpa_driver_scan_params params;
144 - if (!iface->conf->secondary_channel)
145 + if (!iface->conf->secondary_channel || iface->conf->noscan)
146 return 0; /* HT40 not used */
148 wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "