[PATCH] hostapd: Fix unexpected AP beacon state transition

Michael-CY Lee michael-cy.lee at mediatek.com
Wed May 3 20:29:36 PDT 2023


From: Michael Lee <michael-cy.lee at mediatek.com>

When AP fails to set the beacon, it assigns bss->beacon_set to 0 no
matter what the error number is.
However, in the case that the error number is -EBUSY, the driver might
not free the beacon and expect a later beacon re-setting. If hostapd set
a new beacon under this case, the driver will return -EALREADY.
This patch checks the error number after hostapd fails to set the
beacon. If the error number is -EBUSY, bss->beacon_set will not be
assigned to 0.

Signed-off-by: Michael Lee <michael-cy.lee at mediatek.com>
---
 src/drivers/driver_nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 945ce3e..89c7d20 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4912,7 +4912,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 			   ret, strerror(-ret));
 		if (!bss->beacon_set)
 			ret = 0;
-		bss->beacon_set = 0;
+		if (ret != -EBUSY)
+			bss->beacon_set = 0;
 	} else {
 		bss->beacon_set = 1;
 		nl80211_set_bss(bss, params->cts_protect, params->preamble,
-- 
2.25.1




More information about the Hostap mailing list