hostapd: update to 20120326
[openwrt/svn-archive/archive.git] / package / hostapd / patches / 400-scan_wait.patch
1 --- a/src/ap/hostapd.h
2 +++ b/src/ap/hostapd.h
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);
8 };
9
10 /* hostapd.c */
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);
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 @@ -31,6 +31,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 extern struct wpa_driver_ops *wpa_drivers[];
33
34 @@ -145,6 +147,16 @@ 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 + return 0;
46 +}
47 +
48
49 /**
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)
53 goto fail;
54
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
60 }
61
62
63 -static void hostapd_global_deinit(const char *pid_file)
64 +static void hostapd_global_deinit(void)
65 {
66 int i;
67
68 @@ -449,8 +462,7 @@ static void hostapd_global_deinit(const
69 }
70
71
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)
75 {
76 #ifdef EAP_SERVER_TNC
77 int tnc = 0;
78 @@ -471,11 +483,6 @@ static int hostapd_global_run(struct hap
79 }
80 #endif /* EAP_SERVER_TNC */
81
82 - if (daemonize && os_daemonize(pid_file)) {
83 - perror("daemon");
84 - return -1;
85 - }
86 -
87 eloop_run();
88
89 return 0;
90 @@ -532,8 +539,7 @@ int main(int argc, char *argv[])
91 struct hapd_interfaces interfaces;
92 int ret = 1;
93 size_t i;
94 - int c, debug = 0, daemonize = 0;
95 - char *pid_file = NULL;
96 + int c, debug = 0;
97 const char *log_file = NULL;
98 const char *entropy_file = NULL;
99
100 @@ -611,7 +617,7 @@ int main(int argc, char *argv[])
101 goto out;
102 }
103
104 - if (hostapd_global_run(&interfaces, daemonize, pid_file))
105 + if (hostapd_global_run(&interfaces))
106 goto out;
107
108 ret = 0;
109 @@ -622,7 +628,7 @@ int main(int argc, char *argv[])
110 hostapd_interface_deinit_free(interfaces.iface[i]);
111 os_free(interfaces.iface);
112
113 - hostapd_global_deinit(pid_file);
114 + hostapd_global_deinit();
115 os_free(pid_file);
116
117 if (log_file)
118 --- a/hostapd/config_file.c
119 +++ b/hostapd/config_file.c
120 @@ -1941,6 +1941,8 @@ static int hostapd_config_fill(struct ho
121 }
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 {
132
133 int ht_op_mode_fixed;
134 u16 ht_capab;
135 + int noscan;
136 int ieee80211n;
137 int secondary_channel;
138 int require_ht;
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
142 {
143 struct wpa_driver_scan_params params;
144
145 - if (!iface->conf->secondary_channel)
146 + if (!iface->conf->secondary_channel || iface->conf->noscan)
147 return 0; /* HT40 not used */
148
149 wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "