diff mbox

Don't overwrite channel when hostAP is working.

Message ID 1395386280-2426-1-git-send-email-pawel.kulakowski@tieto.com
State Accepted
Headers show

Commit Message

Pawel Kulakowski March 21, 2014, 7:18 a.m. UTC
There was possibility that Current Channel in Beacon Information
Element was incorrectly set. This problem was easily observed when
primary and secondary channel were switched and then some of hostAP
settings (for example password) were changed using External Registrar.
This cause that hostapd_reload_config function overwrite channel
from config file.

This patch prevent this situation and does not allow to overwrite
channel and some other settings when config is reloaded.

Signed-off-by: Pawel Kulakowski <pawel.kulakowski@tieto.com>
---
 src/ap/hostapd.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Jouni Malinen March 21, 2014, 10:46 p.m. UTC | #1
On Fri, Mar 21, 2014 at 08:18:00AM +0100, Pawel Kulakowski wrote:
> There was possibility that Current Channel in Beacon Information
> Element was incorrectly set. This problem was easily observed when
> primary and secondary channel were switched and then some of hostAP
> settings (for example password) were changed using External Registrar.
> This cause that hostapd_reload_config function overwrite channel
> from config file.
> 
> This patch prevent this situation and does not allow to overwrite
> channel and some other settings when config is reloaded.

Thanks, applied.
diff mbox

Patch

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 4ed718c..3b3da2e 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -171,6 +171,14 @@  int hostapd_reload_config(struct hostapd_iface *iface)
 	for (j = 0; j < iface->num_bss; j++) {
 		hapd = iface->bss[j];
 		hapd->iconf = newconf;
+		hapd->iconf->channel = oldconf->channel;
+		hapd->iconf->ieee80211n = oldconf->ieee80211n;
+		hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
+		hapd->iconf->ht_capab = oldconf->ht_capab;
+		hapd->iconf->vht_capab = oldconf->vht_capab;
+		hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth;
+		hapd->iconf->vht_oper_centr_freq_seg0_idx = oldconf->vht_oper_centr_freq_seg0_idx;
+		hapd->iconf->vht_oper_centr_freq_seg1_idx = oldconf->vht_oper_centr_freq_seg1_idx;
 		hapd->conf = newconf->bss[j];
 		hostapd_reload_bss(hapd);
 	}