diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-06-30 21:01:13 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-06-30 21:01:13 +0000 |
commit | ee68734929edb30f90a95bc3150038333b345476 (patch) | |
tree | 6b66081ac9aae8fdf95fbd7504d77d2dcec36412 /package/network/services/hostapd/patches/450-reload_freq_change.patch | |
parent | 60b040bbafc2adf2c439e1b80cba6c6c5fd0d244 (diff) | |
download | upstream-ee68734929edb30f90a95bc3150038333b345476.tar.gz upstream-ee68734929edb30f90a95bc3150038333b345476.tar.bz2 upstream-ee68734929edb30f90a95bc3150038333b345476.zip |
hostapd: fix multi-ssid and AP+STA, clean up code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 37111
Diffstat (limited to 'package/network/services/hostapd/patches/450-reload_freq_change.patch')
-rw-r--r-- | package/network/services/hostapd/patches/450-reload_freq_change.patch | 94 |
1 files changed, 76 insertions, 18 deletions
diff --git a/package/network/services/hostapd/patches/450-reload_freq_change.patch b/package/network/services/hostapd/patches/450-reload_freq_change.patch index ffa757e9ca..5dc2a85549 100644 --- a/package/network/services/hostapd/patches/450-reload_freq_change.patch +++ b/package/network/services/hostapd/patches/450-reload_freq_change.patch @@ -1,27 +1,85 @@ --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -156,6 +156,24 @@ int hostapd_reload_config(struct hostapd - oldconf = hapd->iconf; - iface->conf = newconf; +@@ -133,38 +133,51 @@ static void hostapd_clear_old(struct hos + int hostapd_reload_config(struct hostapd_iface *iface) + { + struct hostapd_data *hapd = iface->bss[0]; +- struct hostapd_config *newconf, *oldconf; ++ struct hostapd_config *conf = hapd->iconf, *oldconf = NULL; + size_t j; -+ hostapd_select_hw_mode(iface); -+ iface->freq = hostapd_hw_get_freq(hapd, newconf->channel); +- if (iface->config_fname == NULL) { +- /* Only in-memory config in use - assume it has been updated */ ++ if (iface->config_fname) { ++ if (iface->interfaces == NULL || ++ iface->interfaces->config_read_cb == NULL) ++ return -1; ++ conf = iface->interfaces->config_read_cb(iface->config_fname); ++ if (conf == NULL) ++ return -1; + -+ if (hostapd_set_freq(hapd, newconf->hw_mode, iface->freq, -+ newconf->channel, -+ newconf->ieee80211n, -+ newconf->ieee80211ac, -+ newconf->secondary_channel, -+ newconf->vht_oper_chwidth, -+ newconf->vht_oper_centr_freq_seg0_idx, -+ newconf->vht_oper_centr_freq_seg1_idx)) { -+ wpa_printf(MSG_ERROR, "Could not set channel for " -+ "kernel driver"); + hostapd_clear_old(iface); +- for (j = 0; j < iface->num_bss; j++) +- hostapd_reload_bss(iface->bss[j]); +- return 0; +- } + +- if (iface->interfaces == NULL || +- iface->interfaces->config_read_cb == NULL) +- return -1; +- newconf = iface->interfaces->config_read_cb(iface->config_fname); +- if (newconf == NULL) +- return -1; ++ oldconf = hapd->iconf; ++ iface->conf = conf; + } -+ + +- hostapd_clear_old(iface); ++ hostapd_select_hw_mode(iface); ++ iface->freq = hostapd_hw_get_freq(hapd, conf->channel); + +- oldconf = hapd->iconf; +- iface->conf = newconf; + if (iface->current_mode) + hostapd_prepare_rates(iface, iface->current_mode); -+ + for (j = 0; j < iface->num_bss; j++) { hapd = iface->bss[j]; - hapd->iconf = newconf; +- hapd->iconf = newconf; +- hapd->conf = &newconf->bss[j]; ++ hapd->iconf = iface->conf; ++ hapd->conf = &iface->conf->bss[j]; ++ ++ if (hostapd_set_freq(hapd, conf->hw_mode, iface->freq, ++ conf->channel, ++ conf->ieee80211n, ++ conf->ieee80211ac, ++ conf->secondary_channel, ++ conf->vht_oper_chwidth, ++ conf->vht_oper_centr_freq_seg0_idx, ++ conf->vht_oper_centr_freq_seg1_idx)) { ++ wpa_printf(MSG_ERROR, "Could not set channel for " ++ "kernel driver"); ++ } ++ + hostapd_reload_bss(hapd); + } + +- hostapd_config_free(oldconf); +- ++ if (oldconf) ++ hostapd_config_free(oldconf); + + return 0; + } +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -6466,7 +6466,7 @@ static int wpa_driver_nl80211_set_freq(s + + nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_WIPHY); + +- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex); ++ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex); + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq); + if (freq->vht_enabled) { + switch (freq->bandwidth) { |