OpenWrt – Diff between revs 2 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 2 Rev 3
Line 28... Line 28...
28 #include "common/ieee802_11_defs.h" 28 #include "common/ieee802_11_defs.h"
29 +#include "common/ieee802_11_common.h" 29 +#include "common/ieee802_11_common.h"
30 #include "drivers/driver.h" 30 #include "drivers/driver.h"
31 #include "eap_peer/eap.h" 31 #include "eap_peer/eap.h"
32 #include "wpa_supplicant_i.h" 32 #include "wpa_supplicant_i.h"
33 @@ -294,6 +295,10 @@ void calculate_update_time(const struct 33 @@ -290,6 +291,10 @@ void calculate_update_time(const struct
34 static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, 34 static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
35 struct os_reltime *fetch_time) 35 struct os_reltime *fetch_time)
36 { 36 {
37 + struct ieee80211_ht_capabilities *capab; 37 + struct ieee80211_ht_capabilities *capab;
38 + struct ieee80211_ht_operation *oper; 38 + struct ieee80211_ht_operation *oper;
39 + struct ieee802_11_elems elems; 39 + struct ieee802_11_elems elems;
40 + 40 +
41 dst->flags = src->flags; 41 dst->flags = src->flags;
42 os_memcpy(dst->bssid, src->bssid, ETH_ALEN); 42 os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
43 dst->freq = src->freq; 43 dst->freq = src->freq;
44 @@ -306,6 +311,15 @@ static void wpa_bss_copy_res(struct wpa_ 44 @@ -302,6 +307,15 @@ static void wpa_bss_copy_res(struct wpa_
45 dst->est_throughput = src->est_throughput; 45 dst->est_throughput = src->est_throughput;
46 dst->snr = src->snr; 46 dst->snr = src->snr;
Line 47... Line 47...
47 47
48 + memset(&elems, 0, sizeof(elems)); 48 + memset(&elems, 0, sizeof(elems));
Line 57... Line 57...
57 calculate_update_time(fetch_time, src->age, &dst->last_update); 57 calculate_update_time(fetch_time, src->age, &dst->last_update);
58 } 58 }
Line 59... Line 59...
59 59
60 --- a/wpa_supplicant/bss.h 60 --- a/wpa_supplicant/bss.h
61 +++ b/wpa_supplicant/bss.h 61 +++ b/wpa_supplicant/bss.h
62 @@ -82,6 +82,10 @@ struct wpa_bss { 62 @@ -80,6 +80,10 @@ struct wpa_bss {
63 u8 ssid[SSID_MAX_LEN]; 63 u8 ssid[SSID_MAX_LEN];
64 /** Length of SSID */ 64 /** Length of SSID */
65 size_t ssid_len; 65 size_t ssid_len;
66 + /** HT capabilities */ 66 + /** HT capabilities */
Line 164... Line 164...
164 +} 164 +}
165 + 165 +
166 /* Configure default/group WEP keys for static WEP */ 166 /* Configure default/group WEP keys for static WEP */
167 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) 167 int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
168 { 168 {
169 @@ -920,12 +969,16 @@ void wpa_supplicant_set_state(struct wpa 169 @@ -893,12 +942,16 @@ void wpa_supplicant_set_state(struct wpa
Line 170... Line 170...
170 170
Line 171... Line 171...
171 sme_sched_obss_scan(wpa_s, 1); 171 sme_sched_obss_scan(wpa_s, 1);
172 172
Line 181... Line 181...
181 + if (wpa_s->hostapd) 181 + if (wpa_s->hostapd)
182 + hostapd_stop(wpa_s); 182 + hostapd_stop(wpa_s);
183 wpa_s->new_connection = 1; 183 wpa_s->new_connection = 1;
184 wpa_drv_set_operstate(wpa_s, 0); 184 wpa_drv_set_operstate(wpa_s, 0);
185 #ifndef IEEE8021X_EAPOL 185 #ifndef IEEE8021X_EAPOL
186 @@ -1977,6 +2030,8 @@ void wpa_supplicant_associate(struct wpa 186 @@ -1920,6 +1973,8 @@ void wpa_supplicant_associate(struct wpa
187 wpa_ssid_txt(ssid->ssid, ssid->ssid_len), 187 wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
188 ssid->id); 188 ssid->id);
189 wpas_notify_mesh_group_started(wpa_s, ssid); 189 wpas_notify_mesh_group_started(wpa_s, ssid);
190 + if (wpa_s->hostapd) 190 + if (wpa_s->hostapd)
191 + hostapd_reload(wpa_s, wpa_s->current_bss); 191 + hostapd_reload(wpa_s, wpa_s->current_bss);
192 #else /* CONFIG_MESH */ 192 #else /* CONFIG_MESH */
193 wpa_msg(wpa_s, MSG_ERROR, 193 wpa_msg(wpa_s, MSG_ERROR,
194 "mesh mode support not included in the build"); 194 "mesh mode support not included in the build");
195 @@ -5487,6 +5542,16 @@ static int wpa_supplicant_init_iface(str 195 @@ -5362,6 +5417,16 @@ static int wpa_supplicant_init_iface(str
196 sizeof(wpa_s->bridge_ifname)); 196 sizeof(wpa_s->bridge_ifname));
197 } 197 }
Line 198... Line 198...
198 198
199 + if (iface->hostapd_ctrl) { 199 + if (iface->hostapd_ctrl) {
Line 207... Line 207...
207 + } 207 + }
208 + 208 +
209 /* RSNA Supplicant Key Management - INITIALIZE */ 209 /* RSNA Supplicant Key Management - INITIALIZE */
210 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE); 210 eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
211 eapol_sm_notify_portValid(wpa_s->eapol, FALSE); 211 eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
212 @@ -5808,6 +5873,11 @@ static void wpa_supplicant_deinit_iface( 212 @@ -5683,6 +5748,11 @@ static void wpa_supplicant_deinit_iface(
213 if (terminate) 213 if (terminate)
214 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); 214 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
Line 215... Line 215...
215 215
216 + if (wpa_s->hostapd) { 216 + if (wpa_s->hostapd) {
Line 242... Line 242...
242 + struct wpa_ctrl *hostapd; 242 + struct wpa_ctrl *hostapd;
243 + 243 +
244 char *confname; 244 char *confname;
245 char *confanother; 245 char *confanother;
Line 246... Line -...
246 -  
247 --- a/hostapd/ctrl_iface.c -  
248 +++ b/hostapd/ctrl_iface.c -  
249 @@ -2328,6 +2328,11 @@ static int hostapd_ctrl_iface_chan_switc -  
250 if (ret) -  
251 return ret; -  
252 -  
253 + if (os_strstr(pos, " auto-ht")) { -  
254 + settings.freq_params.ht_enabled = iface->conf->ieee80211n; -  
255 + settings.freq_params.vht_enabled = iface->conf->ieee80211ac; -  
256 + } -  
257 + -  
258 for (i = 0; i < iface->num_bss; i++) { -  
259 -  
260 /* Save CHAN_SWITCH VHT config */ -  
261 --- a/src/ap/beacon.c -  
262 +++ b/src/ap/beacon.c -  
263 @@ -1381,11 +1381,6 @@ int ieee802_11_set_beacon(struct hostapd -  
264 struct wpabuf *beacon, *proberesp, *assocresp; -  
265 int res, ret = -1; -  
266 -  
267 - if (hapd->csa_in_progress) { -  
268 - wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period"); -  
269 - return -1; -  
270 - } -  
271 - -  
272 hapd->beacon_set_done = 1; -  
273 -  
274 if (ieee802_11_build_ap_params(hapd, &params) < 0) -  
275 --- a/src/drivers/driver.h -  
276 +++ b/src/drivers/driver.h -  
277 @@ -4469,6 +4469,13 @@ enum wpa_event_type { -  
278 EVENT_CH_SWITCH, -  
279 -  
280 /** -  
281 + * EVENT_CH_SWITCH - AP or GO will switch channels soon -  
282 + * -  
283 + * Described in wpa_event_data.ch_switch -  
284 + * */ -  
285 + EVENT_CH_SWITCH_STARTED, -  
286 + -  
287 + /** -  
288 * EVENT_WNM - Request WNM operation -  
289 * -  
290 * This event can be used to request a WNM operation to be performed. -  
291 @@ -5306,6 +5313,7 @@ union wpa_event_data { -  
292 -  
293 /** -  
294 * struct ch_switch -  
295 + * @count: countdown until channel switch -  
296 * @freq: Frequency of new channel in MHz -  
297 * @ht_enabled: Whether this is an HT channel -  
298 * @ch_offset: Secondary channel offset -  
299 @@ -5314,6 +5322,7 @@ union wpa_event_data { -  
300 * @cf2: Center frequency 2 -  
301 */ -  
302 struct ch_switch { -  
303 + int count; -  
304 int freq; -  
305 int ht_enabled; -  
306 int ch_offset; -  
307 --- a/src/drivers/driver_nl80211_event.c -  
308 +++ b/src/drivers/driver_nl80211_event.c -  
309 @@ -526,7 +526,8 @@ static int calculate_chan_offset(int wid -  
310 static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv, -  
311 struct nlattr *ifindex, struct nlattr *freq, -  
312 struct nlattr *type, struct nlattr *bw, -  
313 - struct nlattr *cf1, struct nlattr *cf2) -  
314 + struct nlattr *cf1, struct nlattr *cf2, -  
315 + struct nlattr *count) -  
316 { -  
317 struct i802_bss *bss; -  
318 union wpa_event_data data; -  
319 @@ -584,11 +585,15 @@ static void mlme_event_ch_switch(struct -  
320 data.ch_switch.cf1 = nla_get_u32(cf1); -  
321 if (cf2) -  
322 data.ch_switch.cf2 = nla_get_u32(cf2); -  
323 + if (count) -  
324 + data.ch_switch.count = nla_get_u32(count); -  
325 -  
326 bss->freq = data.ch_switch.freq; -  
327 drv->assoc_freq = data.ch_switch.freq; -  
328 -  
329 - wpa_supplicant_event(bss->ctx, EVENT_CH_SWITCH, &data); -  
330 + wpa_supplicant_event(bss->ctx, -  
331 + count ? EVENT_CH_SWITCH_STARTED : EVENT_CH_SWITCH, -  
332 + &data); -  
333 } -  
334 -  
335 -  
336 @@ -2446,6 +2451,7 @@ static void do_process_drv_event(struct -  
337 tb[NL80211_ATTR_PMK], -  
338 tb[NL80211_ATTR_PMKID]); -  
339 break; -  
340 + case NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: -  
341 case NL80211_CMD_CH_SWITCH_NOTIFY: -  
342 mlme_event_ch_switch(drv, -  
343 tb[NL80211_ATTR_IFINDEX], -  
344 @@ -2453,7 +2459,8 @@ static void do_process_drv_event(struct -  
345 tb[NL80211_ATTR_WIPHY_CHANNEL_TYPE], -  
346 tb[NL80211_ATTR_CHANNEL_WIDTH], -  
347 tb[NL80211_ATTR_CENTER_FREQ1], -  
348 - tb[NL80211_ATTR_CENTER_FREQ2]); -  
349 + tb[NL80211_ATTR_CENTER_FREQ2], -  
350 + tb[NL80211_ATTR_CH_SWITCH_COUNT]); -  
351 break; -  
352 case NL80211_CMD_DISCONNECT: -  
353 mlme_event_disconnect(drv, tb[NL80211_ATTR_REASON_CODE], -  
354 --- a/wpa_supplicant/events.c -  
355 +++ b/wpa_supplicant/events.c -  
356 @@ -4026,6 +4026,60 @@ static void wpas_event_assoc_reject(stru -  
357 } -  
358 -  
359 -  
360 +static void -  
361 +supplicant_ch_switch_started(struct wpa_supplicant *wpa_s, -  
362 + union wpa_event_data *data) -  
363 +{ -  
364 + char buf[256]; -  
365 + size_t len = sizeof(buf); -  
366 + char *cmd = NULL; -  
367 + int width = 20; -  
368 + int ret; -  
369 + -  
370 + if (!wpa_s->hostapd) -  
371 + return; -  
372 + -  
373 + wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_CHANNEL_SWITCH -  
374 + "count=%d freq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d", -  
375 + data->ch_switch.count, -  
376 + data->ch_switch.freq, -  
377 + data->ch_switch.ht_enabled, -  
378 + data->ch_switch.ch_offset, -  
379 + channel_width_to_string(data->ch_switch.ch_width), -  
380 + data->ch_switch.cf1, -  
381 + data->ch_switch.cf2); -  
382 + -  
383 + switch (data->ch_switch.ch_width) { -  
384 + case CHAN_WIDTH_20_NOHT: -  
385 + case CHAN_WIDTH_20: -  
386 + width = 20; -  
387 + break; -  
388 + case CHAN_WIDTH_40: -  
389 + width = 40; -  
390 + break; -  
391 + case CHAN_WIDTH_80: -  
392 + width = 80; -  
393 + break; -  
394 + case CHAN_WIDTH_160: -  
395 + case CHAN_WIDTH_80P80: -  
396 + width = 160; -  
397 + break; -  
398 + } -  
399 + -  
400 + asprintf(&cmd, "CHAN_SWITCH %d %d sec_channel_offset=%d center_freq1=%d center_freq2=%d, bandwidth=%d auto-ht\n", -  
401 + data->ch_switch.count - 1, -  
402 + data->ch_switch.freq, -  
403 + data->ch_switch.ch_offset, -  
404 + data->ch_switch.cf1, -  
405 + data->ch_switch.cf2, -  
406 + width); -  
407 + ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); -  
408 + free(cmd); -  
409 + -  
410 + if (ret < 0) -  
411 + wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); -  
412 +} -  
413 + -  
414 void supplicant_event(void *ctx, enum wpa_event_type event, -  
415 union wpa_event_data *data) -  
416 { -  
417 @@ -4309,6 +4363,10 @@ void supplicant_event(void *ctx, enum wp -  
418 data->rx_from_unknown.wds); -  
419 break; -  
420 #endif /* CONFIG_AP */ -  
421 + case EVENT_CH_SWITCH_STARTED: -  
422 + supplicant_ch_switch_started(wpa_s, data); -  
423 + break; -  
424 + -  
425 case EVENT_CH_SWITCH: -  
426 if (!data || !wpa_s->current_ssid) -