Patchwork hostapd: only update already-set beacons when processing OLBC

login
register
mail settings
Submitter Luciano Coelho
Date March 6, 2012, 1:06 p.m.
Message ID <1331039187-20484-1-git-send-email-coelho@ti.com>
Download mbox | patch
Permalink /patch/144938/
State Accepted
Commit 370b076197bccc4b6d6862b94861571dadc5c128
Headers show

Comments

Luciano Coelho - March 6, 2012, 1:06 p.m.
When hostapd is about to start an AP using HT40, it starts a scan to
check whether it is allowed or not.  If OLBC is detected before the
scan has completed, it sets the beacons prematurely.

To fix this, instead of setting all beacons when OLBC is detected,
only update the ones that have already been started.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 src/ap/ap_list.c |    4 ++--
 src/ap/beacon.c  |    9 +++++++++
 src/ap/beacon.h  |    1 +
 3 files changed, 12 insertions(+), 2 deletions(-)
Jouni Malinen - April 1, 2012, 3:13 p.m.
On Tue, Mar 06, 2012 at 03:06:27PM +0200, Luciano Coelho wrote:
> When hostapd is about to start an AP using HT40, it starts a scan to
> check whether it is allowed or not.  If OLBC is detected before the
> scan has completed, it sets the beacons prematurely.
> 
> To fix this, instead of setting all beacons when OLBC is detected,
> only update the ones that have already been started.

Thanks, applied.

Patch

diff --git a/src/ap/ap_list.c b/src/ap/ap_list.c
index 165cb16..933b158 100644
--- a/src/ap/ap_list.c
+++ b/src/ap/ap_list.c
@@ -318,7 +318,7 @@  void ap_list_process_beacon(struct hostapd_iface *iface,
 #endif /* CONFIG_IEEE80211N */
 
 	if (set_beacon)
-		ieee802_11_set_beacons(iface);
+		ieee802_11_update_beacons(iface);
 }
 
 
@@ -373,7 +373,7 @@  static void ap_list_timer(void *eloop_ctx, void *timeout_ctx)
 	}
 
 	if (set_beacon)
-		ieee802_11_set_beacons(iface);
+		ieee802_11_update_beacons(iface);
 }
 
 
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 4ea8684..7c77e4b 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -699,4 +699,13 @@  void ieee802_11_set_beacons(struct hostapd_iface *iface)
 		ieee802_11_set_beacon(iface->bss[i]);
 }
 
+/* only update beacons if started */
+void ieee802_11_update_beacons(struct hostapd_iface *iface)
+{
+	size_t i;
+	for (i = 0; i < iface->num_bss; i++)
+		if (iface->bss[i]->beacon_set_done)
+			ieee802_11_set_beacon(iface->bss[i]);
+}
+
 #endif /* CONFIG_NATIVE_WINDOWS */
diff --git a/src/ap/beacon.h b/src/ap/beacon.h
index a944f5f..0dd6021 100644
--- a/src/ap/beacon.h
+++ b/src/ap/beacon.h
@@ -22,5 +22,6 @@  void handle_probe_req(struct hostapd_data *hapd,
 		      const struct ieee80211_mgmt *mgmt, size_t len);
 void ieee802_11_set_beacon(struct hostapd_data *hapd);
 void ieee802_11_set_beacons(struct hostapd_iface *iface);
+void ieee802_11_update_beacons(struct hostapd_iface *iface);
 
 #endif /* BEACON_H */