81c20970e7466c29d20d83dd354aa81d081dc1d7
[openwrt/openwrt.git] / package / network / services / hostapd / patches / 340-reload_freq_change.patch
1 --- a/src/ap/hostapd.c
2 +++ b/src/ap/hostapd.c
3 @@ -103,6 +103,25 @@ static void hostapd_reload_bss(struct ho
4 #endif /* CONFIG_NO_RADIUS */
5
6 ssid = &hapd->conf->ssid;
7 +
8 + hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq,
9 + hapd->iconf->channel,
10 + hapd->iconf->ieee80211n,
11 + hapd->iconf->ieee80211ac,
12 + hapd->iconf->secondary_channel,
13 + hapd->iconf->vht_oper_chwidth,
14 + hapd->iconf->vht_oper_centr_freq_seg0_idx,
15 + hapd->iconf->vht_oper_centr_freq_seg1_idx);
16 +
17 + if (hapd->iface->current_mode) {
18 + if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
19 + wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
20 + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
21 + HOSTAPD_LEVEL_WARNING,
22 + "Failed to prepare rates table.");
23 + }
24 + }
25 +
26 if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
27 ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
28 /*
29 @@ -200,6 +219,7 @@ int hostapd_reload_config(struct hostapd
30 struct hostapd_data *hapd = iface->bss[0];
31 struct hostapd_config *newconf, *oldconf;
32 size_t j;
33 + int i;
34
35 if (iface->config_fname == NULL) {
36 /* Only in-memory config in use - assume it has been updated */
37 @@ -250,21 +270,20 @@ int hostapd_reload_config(struct hostapd
38 }
39 iface->conf = newconf;
40
41 + for (i = 0; i < iface->num_hw_features; i++) {
42 + struct hostapd_hw_modes *mode = &iface->hw_features[i];
43 + if (mode->mode == iface->conf->hw_mode) {
44 + iface->current_mode = mode;
45 + break;
46 + }
47 + }
48 +
49 + if (iface->conf->channel)
50 + iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
51 +
52 for (j = 0; j < iface->num_bss; j++) {
53 hapd = iface->bss[j];
54 hapd->iconf = newconf;
55 - hapd->iconf->channel = oldconf->channel;
56 - hapd->iconf->acs = oldconf->acs;
57 - hapd->iconf->secondary_channel = oldconf->secondary_channel;
58 - hapd->iconf->ieee80211n = oldconf->ieee80211n;
59 - hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
60 - hapd->iconf->ht_capab = oldconf->ht_capab;
61 - hapd->iconf->vht_capab = oldconf->vht_capab;
62 - hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth;
63 - hapd->iconf->vht_oper_centr_freq_seg0_idx =
64 - oldconf->vht_oper_centr_freq_seg0_idx;
65 - hapd->iconf->vht_oper_centr_freq_seg1_idx =
66 - oldconf->vht_oper_centr_freq_seg1_idx;
67 hapd->conf = newconf->bss[j];
68 hostapd_reload_bss(hapd);
69 }