3 @@ -133,38 +133,51 @@ static void hostapd_clear_old(struct hos
4 int hostapd_reload_config(struct hostapd_iface *iface)
6 struct hostapd_data *hapd = iface->bss[0];
7 - struct hostapd_config *newconf, *oldconf;
8 + struct hostapd_config *conf = hapd->iconf, *oldconf = NULL;
11 - if (iface->config_fname == NULL) {
12 - /* Only in-memory config in use - assume it has been updated */
13 + if (iface->config_fname) {
14 + if (iface->interfaces == NULL ||
15 + iface->interfaces->config_read_cb == NULL)
17 + conf = iface->interfaces->config_read_cb(iface->config_fname);
21 hostapd_clear_old(iface);
22 - for (j = 0; j < iface->num_bss; j++)
23 - hostapd_reload_bss(iface->bss[j]);
27 - if (iface->interfaces == NULL ||
28 - iface->interfaces->config_read_cb == NULL)
30 - newconf = iface->interfaces->config_read_cb(iface->config_fname);
31 - if (newconf == NULL)
33 + oldconf = hapd->iconf;
37 - hostapd_clear_old(iface);
38 + hostapd_select_hw_mode(iface);
39 + iface->freq = hostapd_hw_get_freq(hapd, conf->channel);
41 - oldconf = hapd->iconf;
42 - iface->conf = newconf;
43 + if (iface->current_mode)
44 + hostapd_prepare_rates(iface, iface->current_mode);
46 for (j = 0; j < iface->num_bss; j++) {
48 - hapd->iconf = newconf;
49 - hapd->conf = &newconf->bss[j];
50 + hapd->iconf = iface->conf;
51 + hapd->conf = &iface->conf->bss[j];
53 + if (hostapd_set_freq(hapd, conf->hw_mode, iface->freq,
57 + conf->secondary_channel,
58 + conf->vht_oper_chwidth,
59 + conf->vht_oper_centr_freq_seg0_idx,
60 + conf->vht_oper_centr_freq_seg1_idx)) {
61 + wpa_printf(MSG_ERROR, "Could not set channel for "
65 hostapd_reload_bss(hapd);
68 - hostapd_config_free(oldconf);
71 + hostapd_config_free(oldconf);
75 --- a/src/drivers/driver_nl80211.c
76 +++ b/src/drivers/driver_nl80211.c
77 @@ -6511,7 +6511,7 @@ static int wpa_driver_nl80211_set_freq(s
79 nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_WIPHY);
81 - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
82 + NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
83 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq);
84 if (freq->vht_enabled) {
85 switch (freq->bandwidth) {