Root/package/hostapd/patches/130-scan_wait.patch

1--- a/src/ap/hostapd.h
2+++ b/src/ap/hostapd.h
3@@ -245,6 +245,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);
8 };
9 
10 /* hostapd.c */
11--- a/src/ap/hostapd.c
12+++ b/src/ap/hostapd.c
13@@ -755,6 +755,9 @@ int hostapd_setup_interface_complete(str
14     wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
15            iface->bss[0]->conf->iface);
16 
17+ if (iface->init_complete)
18+ iface->init_complete(iface);
19+
20     return 0;
21 }
22 
23--- a/hostapd/main.c
24+++ b/hostapd/main.c
25@@ -35,6 +35,8 @@
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;
31 
32 
33 struct hapd_interfaces {
34@@ -162,6 +164,15 @@ static void hostapd_logger_cb(void *ctx,
35 }
36 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
37 
38+static int hostapd_init_complete(struct hostapd_iface *iface)
39+{
40+ if (daemonize && os_daemonize(pid_file)) {
41+ perror("daemon");
42+ return -1;
43+ }
44+ daemonize = 0;
45+}
46+
47 
48 /**
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)
52         goto fail;
53 
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
59 }
60 
61 
62-static void hostapd_global_deinit(const char *pid_file)
63+static void hostapd_global_deinit(void)
64 {
65 #ifdef EAP_SERVER_TNC
66     tncs_global_deinit();
67@@ -409,8 +421,7 @@ static void hostapd_global_deinit(const
68 }
69 
70 
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)
74 {
75 #ifdef EAP_SERVER_TNC
76     int tnc = 0;
77@@ -431,11 +442,6 @@ static int hostapd_global_run(struct hap
78     }
79 #endif /* EAP_SERVER_TNC */
80 
81- if (daemonize && os_daemonize(pid_file)) {
82- perror("daemon");
83- return -1;
84- }
85-
86     eloop_run();
87 
88     return 0;
89@@ -479,8 +485,7 @@ int main(int argc, char *argv[])
90     struct hapd_interfaces interfaces;
91     int ret = 1;
92     size_t i;
93- int c, debug = 0, daemonize = 0;
94- char *pid_file = NULL;
95+ int c, debug = 0;
96 
97     if (os_program_init())
98         return -1;
99@@ -545,7 +550,7 @@ int main(int argc, char *argv[])
100             goto out;
101     }
102 
103- if (hostapd_global_run(&interfaces, daemonize, pid_file))
104+ if (hostapd_global_run(&interfaces))
105         goto out;
106 
107     ret = 0;
108@@ -556,7 +561,7 @@ int main(int argc, char *argv[])
109         hostapd_interface_deinit_free(interfaces.iface[i]);
110     os_free(interfaces.iface);
111 
112- hostapd_global_deinit(pid_file);
113+ hostapd_global_deinit();
114     os_free(pid_file);
115 
116     os_program_deinit();
117--- a/hostapd/config_file.c
118+++ b/hostapd/config_file.c
119@@ -1857,6 +1857,8 @@ struct hostapd_config * hostapd_config_r
120             }
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@@ -369,6 +369,7 @@ struct hostapd_config {
131 
132     int ht_op_mode_fixed;
133     u16 ht_capab;
134+ int noscan;
135     int ieee80211n;
136     int secondary_channel;
137 };
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
141 {
142     struct wpa_driver_scan_params params;
143 
144- if (!iface->conf->secondary_channel)
145+ if (!iface->conf->secondary_channel || iface->conf->noscan)
146         return 0; /* HT40 not used */
147 
148     wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "
149

Archive Download this file



interactive