blob: f9c4714f3fd90199103add970677cc2019c62fab [file] [log] [blame]
developer805797f2023-06-08 11:36:33 +08001From c4d3890bbf1bd8c8ac8bfaa56fd16e2391e05181 Mon Sep 17 00:00:00 2001
2From: Michael Lee <michael-cy.lee@mediatek.com>
3Date: Wed, 3 May 2023 16:10:57 +0800
4Subject: [PATCH] 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
developer805797f2023-06-08 11:36:33 +080021index 8400e57..5013207 100644
developer5e0a8d72023-05-12 18:58:17 +080022--- a/src/drivers/driver_nl80211.c
23+++ b/src/drivers/driver_nl80211.c
24@@ -5126,7 +5126,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
25 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 {
32 bss->flink->beacon_set = 1;
33 nl80211_set_bss(bss, params->cts_protect, params->preamble,
34--
developer805797f2023-06-08 11:36:33 +0800352.25.1
developer5e0a8d72023-05-12 18:58:17 +080036