b59107463477b5b313dc37eba28cf69d96bfbc00
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / patches / 340-reload_freq_change.patch
1 --- a/src/ap/hostapd.c
2 +++ b/src/ap/hostapd.c
3 @@ -119,6 +119,29 @@ 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->enable_edmg,
11 + hapd->iconf->edmg_channel,
12 + hapd->iconf->ieee80211n,
13 + hapd->iconf->ieee80211ac,
14 + hapd->iconf->ieee80211ax,
15 + hapd->iconf->ieee80211be,
16 + hapd->iconf->secondary_channel,
17 + hostapd_get_oper_chwidth(hapd->iconf),
18 + hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf),
19 + hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf));
20 +
21 + if (hapd->iface->current_mode) {
22 + if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
23 + wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
24 + hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
25 + HOSTAPD_LEVEL_WARNING,
26 + "Failed to prepare rates table.");
27 + }
28 + }
29 +
30 if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
31 ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
32 /*
33 @@ -220,6 +243,7 @@ int hostapd_reload_config(struct hostapd
34 struct hostapd_data *hapd = iface->bss[0];
35 struct hostapd_config *newconf, *oldconf;
36 size_t j;
37 + int i;
38
39 if (iface->config_fname == NULL) {
40 /* Only in-memory config in use - assume it has been updated */
41 @@ -270,24 +294,20 @@ int hostapd_reload_config(struct hostapd
42 }
43 iface->conf = newconf;
44
45 + for (i = 0; i < iface->num_hw_features; i++) {
46 + struct hostapd_hw_modes *mode = &iface->hw_features[i];
47 + if (mode->mode == iface->conf->hw_mode) {
48 + iface->current_mode = mode;
49 + break;
50 + }
51 + }
52 +
53 + if (iface->conf->channel)
54 + iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
55 +
56 for (j = 0; j < iface->num_bss; j++) {
57 hapd = iface->bss[j];
58 hapd->iconf = newconf;
59 - hapd->iconf->channel = oldconf->channel;
60 - hapd->iconf->acs = oldconf->acs;
61 - hapd->iconf->secondary_channel = oldconf->secondary_channel;
62 - hapd->iconf->ieee80211n = oldconf->ieee80211n;
63 - hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
64 - hapd->iconf->ht_capab = oldconf->ht_capab;
65 - hapd->iconf->vht_capab = oldconf->vht_capab;
66 - hostapd_set_oper_chwidth(hapd->iconf,
67 - hostapd_get_oper_chwidth(oldconf));
68 - hostapd_set_oper_centr_freq_seg0_idx(
69 - hapd->iconf,
70 - hostapd_get_oper_centr_freq_seg0_idx(oldconf));
71 - hostapd_set_oper_centr_freq_seg1_idx(
72 - hapd->iconf,
73 - hostapd_get_oper_centr_freq_seg1_idx(oldconf));
74 hapd->conf = newconf->bss[j];
75 hostapd_reload_bss(hapd);
76 }