blob: 69d1a31008dab04e186777c7c30fd8846c8a2e8a [file] [log] [blame]
developer27057f82023-07-10 17:23:13 +08001From 62c4fa824adefc85ec7820b431f5d617aaf07bc7 Mon Sep 17 00:00:00 2001
developer70b87842023-05-29 14:07:44 +08002From: Michael Lee <michael-cy.lee@mediatek.com>
3Date: Wed, 3 May 2023 16:10:57 +0800
developer27057f82023-07-10 17:23:13 +08004Subject: [PATCH 30/32] hostapd: mtk: Fix unexpected AP beacon state transition
developer70b87842023-05-29 14:07:44 +08005
6When AP fails to set the beacon, it assigns bss->beacon_set to 0 no
7matter 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
10a new beacon under this case, the driver will return -EALREADY.
11This patch checks the error number after hostapd fails to set the
12beacon. 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
developer27057f82023-07-10 17:23:13 +080021index 0e7ee4306..ab121ca16 100644
developer70b87842023-05-29 14:07:44 +080022--- a/src/drivers/driver_nl80211.c
23+++ b/src/drivers/driver_nl80211.c
developer27057f82023-07-10 17:23:13 +080024@@ -5395,7 +5395,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
developer70b87842023-05-29 14:07:44 +080025 ret, strerror(-ret));
developerb48458e2023-05-30 11:31:57 +080026 if (!bss->flink->beacon_set)
developer70b87842023-05-29 14:07:44 +080027 ret = 0;
developerb48458e2023-05-30 11:31:57 +080028- bss->flink->beacon_set = 0;
developer70b87842023-05-29 14:07:44 +080029+ if (ret != -EBUSY)
developerb48458e2023-05-30 11:31:57 +080030+ bss->flink->beacon_set = 0;
developer70b87842023-05-29 14:07:44 +080031 } else {
developer27057f82023-07-10 17:23:13 +080032 link->beacon_set = 1;
developer70b87842023-05-29 14:07:44 +080033 nl80211_set_bss(bss, params->cts_protect, params->preamble,
34--
developer27057f82023-07-10 17:23:13 +0800352.39.2
developer70b87842023-05-29 14:07:44 +080036