blob: 69d1a31008dab04e186777c7c30fd8846c8a2e8a [file] [log] [blame]
developer9a587882023-07-17 11:11:44 +08001From 62c4fa824adefc85ec7820b431f5d617aaf07bc7 Mon Sep 17 00:00:00 2001
developer805797f2023-06-08 11:36:33 +08002From: Michael Lee <michael-cy.lee@mediatek.com>
3Date: Wed, 3 May 2023 16:10:57 +0800
developer9a587882023-07-17 11:11:44 +08004Subject: [PATCH 30/32] hostapd: mtk: Fix unexpected AP beacon state transition
developer5e0a8d72023-05-12 18:58:17 +08005
developer805797f2023-06-08 11:36:33 +08006When AP fails to set the beacon, it assigns bss->beacon_set to 0 no
developer5e0a8d72023-05-12 18:58:17 +08007matter what the error number is.
8However, in the case that the error number is -EBUSY, the driver might
9not free the beacon and expect a later beacon re-setting. If hostapd set
developer805797f2023-06-08 11:36:33 +080010a new beacon under this case, the driver will return -EALREADY.
11This patch checks the error number after hostapd fails to set the
developer5e0a8d72023-05-12 18:58:17 +080012beacon. If the error number is -EBUSY, bss->beacon_set will not be
13assigned to 0.
14
15Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
16---
17 src/drivers/driver_nl80211.c | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
developer9a587882023-07-17 11:11:44 +080021index 0e7ee4306..ab121ca16 100644
developer5e0a8d72023-05-12 18:58:17 +080022--- a/src/drivers/driver_nl80211.c
23+++ b/src/drivers/driver_nl80211.c
developer9a587882023-07-17 11:11:44 +080024@@ -5395,7 +5395,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
developer5e0a8d72023-05-12 18:58:17 +080025 ret, strerror(-ret));
26 if (!bss->flink->beacon_set)
27 ret = 0;
28- bss->flink->beacon_set = 0;
29+ if (ret != -EBUSY)
30+ bss->flink->beacon_set = 0;
31 } else {
developer9a587882023-07-17 11:11:44 +080032 link->beacon_set = 1;
developer5e0a8d72023-05-12 18:58:17 +080033 nl80211_set_bss(bss, params->cts_protect, params->preamble,
34--
developer9a587882023-07-17 11:11:44 +0800352.39.2
developer5e0a8d72023-05-12 18:58:17 +080036