summaryrefslogtreecommitdiff
path: root/package/hostapd/patches/500-scan_wait.patch
blob: d4c5938de20a6f8b7b560c8f5308b3575d752900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -229,6 +229,7 @@ struct hostapd_iface {
 	int (*for_each_interface)(struct hapd_interfaces *interfaces,
 				  int (*cb)(struct hostapd_iface *iface,
 					    void *ctx), void *ctx);
+	int (*init_complete)(struct hostapd_iface *iface);
 };
 
 /* hostapd.c */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -807,6 +807,9 @@ int hostapd_setup_interface_complete(str
 	wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
 		   iface->bss[0]->conf->iface);
 
+	if (iface->init_complete)
+		iface->init_complete(iface);
+
 	return 0;
 }
 
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -36,6 +36,8 @@
 extern int wpa_debug_level;
 extern int wpa_debug_show_keys;
 extern int wpa_debug_timestamp;
+static int daemonize = 0;
+static char *pid_file = NULL;
 
 
 struct hapd_interfaces {
@@ -163,6 +165,16 @@ static void hostapd_logger_cb(void *ctx,
 }
 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
 
+static int hostapd_init_complete(struct hostapd_iface *iface)
+{
+	if (daemonize && os_daemonize(pid_file)) {
+		perror("daemon");
+		return -1;
+	}
+	daemonize = 0;
+	return 0;
+}
+
 
 /**
  * hostapd_init - Allocate and initialize per-interface data
@@ -184,6 +196,7 @@ static struct hostapd_iface * hostapd_in
 	if (hapd_iface == NULL)
 		goto fail;
 
+	hapd_iface->init_complete = hostapd_init_complete;
 	hapd_iface->reload_config = hostapd_reload_config;
 	hapd_iface->config_read_cb = hostapd_config_read;
 	hapd_iface->config_fname = os_strdup(config_file);
@@ -399,7 +412,7 @@ static int hostapd_global_init(struct ha
 }
 
 
-static void hostapd_global_deinit(const char *pid_file)
+static void hostapd_global_deinit(void)
 {
 #ifdef EAP_SERVER_TNC
 	tncs_global_deinit();
@@ -419,8 +432,7 @@ static void hostapd_global_deinit(const 
 }
 
 
-static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
-			      const char *pid_file)
+static int hostapd_global_run(struct hapd_interfaces *iface)
 {
 #ifdef EAP_SERVER_TNC
 	int tnc = 0;
@@ -441,11 +453,6 @@ static int hostapd_global_run(struct hap
 	}
 #endif /* EAP_SERVER_TNC */
 
-	if (daemonize && os_daemonize(pid_file)) {
-		perror("daemon");
-		return -1;
-	}
-
 	eloop_run();
 
 	return 0;
@@ -501,8 +508,7 @@ int main(int argc, char *argv[])
 	struct hapd_interfaces interfaces;
 	int ret = 1;
 	size_t i;
-	int c, debug = 0, daemonize = 0;
-	char *pid_file = NULL;
+	int c, debug = 0;
 	const char *log_file = NULL;
 
 	if (os_program_init())
@@ -576,7 +582,7 @@ int main(int argc, char *argv[])
 			goto out;
 	}
 
-	if (hostapd_global_run(&interfaces, daemonize, pid_file))
+	if (hostapd_global_run(&interfaces))
 		goto out;
 
 	ret = 0;
@@ -587,7 +593,7 @@ int main(int argc, char *argv[])
 		hostapd_interface_deinit_free(interfaces.iface[i]);
 	os_free(interfaces.iface);
 
-	hostapd_global_deinit(pid_file);
+	hostapd_global_deinit();
 	os_free(pid_file);
 
 	if (log_file)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1891,6 +1891,8 @@ struct hostapd_config * hostapd_config_r
 			}
 #endif /* CONFIG_IEEE80211W */
 #ifdef CONFIG_IEEE80211N
+		} else if (os_strcmp(buf, "noscan") == 0) {
+			conf->noscan = atoi(pos);
 		} else if (os_strcmp(buf, "ieee80211n") == 0) {
 			conf->ieee80211n = atoi(pos);
 		} else if (os_strcmp(buf, "ht_capab") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -390,6 +390,7 @@ struct hostapd_config {
 
 	int ht_op_mode_fixed;
 	u16 ht_capab;
+	int noscan;
 	int ieee80211n;
 	int secondary_channel;
 	int require_ht;
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -463,7 +463,7 @@ static int ieee80211n_check_40mhz(struct
 {
 	struct wpa_driver_scan_params params;
 
-	if (!iface->conf->secondary_channel)
+	if (!iface->conf->secondary_channel || iface->conf->noscan)
 		return 0; /* HT40 not used */
 
 	wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "