blob: f9c4714f3fd90199103add970677cc2019c62fab [file] [log] [blame]
developerb48458e2023-05-30 11:31:57 +08001From c4d3890bbf1bd8c8ac8bfaa56fd16e2391e05181 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
4Subject: [PATCH] hostapd: mtk: Fix unexpected AP beacon state transition
5
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
developerb48458e2023-05-30 11:31:57 +080021index 8400e57..5013207 100644
developer70b87842023-05-29 14:07:44 +080022--- a/src/drivers/driver_nl80211.c
23+++ b/src/drivers/driver_nl80211.c
developerb48458e2023-05-30 11:31:57 +080024@@ -5126,7 +5126,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 {
developerb48458e2023-05-30 11:31:57 +080032 bss->flink->beacon_set = 1;
developer70b87842023-05-29 14:07:44 +080033 nl80211_set_bss(bss, params->cts_protect, params->preamble,
34--
352.25.1
36