[PATCH] hostapd: Fix set beacon in multiple BSSID scenario

Marek Kwaczynski marek.kwaczynski
Thu Nov 21 04:19:09 PST 2013


Check if the bss interface has started before setting beacon. Lack of
this condition causes segmantation fault.
---

Step by step instruction:

1. Run hostapd using with 3 BSS ID
2. Connect STA to first BSS
3. Kill hostapd using ctrl+c shortcut.

Segmanation fault:
nl80211: Set beacon (beacon_set=0)
WPA_TRACE: eloop SIGSEGV - START
[1]: hostapd() [0x807f76f]
     eloop_sigsegv_handler() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/utils/eloop.c:89
[2]: [0xb7737400]
[3]: hostapd() [0x80aa814]
     wpa_driver_nl80211_set_ap() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/drivers/driver_nl80211.c:6607
[4]: hostapd(ieee802_11_set_beacon+0xc9) [0x807e9a9]
     ieee802_11_set_beacon() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/beacon.c:870
     ieee802_11_set_beacon() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/beacon.c:847
[5]: hostapd(ieee802_11_set_beacons+0x29) [0x807ea59]
     ieee802_11_set_beacons() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/beacon.c:881
[6]: hostapd(ap_free_sta+0x2a1) [0x8072901]
     ap_free_sta() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/sta_info.c:224
[7]: hostapd(hostapd_free_stas+0x6a) [0x8072d3a]
     hostapd_free_stas() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/sta_info.c:284
[8]: hostapd() [0x8063671]
     hostapd_bss_deinit() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/hostapd.c:1272
[9]: hostapd(hostapd_interface_deinit+0x6e) [0x806409e]
     hostapd_interface_deinit() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/hostapd.c:1289
[10]: hostapd(hostapd_interface_deinit_free+0x81) [0x80643a1]
     hostapd_interface_deinit_free() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/../src/ap/hostapd.c:1518
[11]: hostapd(main+0x1aa) [0x805af0a]
     main() home/xmarkwa/ath10k/wpa_supplicant/hostap/hostapd/main.c:715
WPA_TRACE: eloop SIGSEGV - END

 src/ap/beacon.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 298c0fa..0e0dae4 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -878,8 +878,10 @@ fail:
 void ieee802_11_set_beacons(struct hostapd_iface *iface)
 {
 	size_t i;
-	for (i = 0; i < iface->num_bss; i++)
-		ieee802_11_set_beacon(iface->bss[i]);
+	for (i = 0; i < iface->num_bss; i++) {
+		if (iface->bss[i]->started)
+			ieee802_11_set_beacon(iface->bss[i]);
+	}
 }
 
 
@@ -888,7 +890,7 @@ 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)
+		if (iface->bss[i]->beacon_set_done && iface->bss[i]->started)
 			ieee802_11_set_beacon(iface->bss[i]);
 }
 
-- 
1.7.9.5




More information about the Hostap mailing list