developer | 70b8784 | 2023-05-29 14:07:44 +0800 | [diff] [blame] | 1 | From f5e235b80b57583caf590c3745022327493675a6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Wed, 3 May 2023 16:10:57 +0800 |
| 4 | Subject: [PATCH] hostapd: mtk: Fix unexpected AP beacon state transition |
| 5 | |
| 6 | When AP fails to set the beacon, it assigns bss->beacon_set to 0 no |
| 7 | matter what the error number is. |
| 8 | However, in the case that the error number is -EBUSY, the driver might |
| 9 | not free the beacon and expect a later beacon re-setting. If hostapd set |
| 10 | a new beacon under this case, the driver will return -EALREADY. |
| 11 | This patch checks the error number after hostapd fails to set the |
| 12 | beacon. If the error number is -EBUSY, bss->beacon_set will not be |
| 13 | assigned to 0. |
| 14 | |
| 15 | Signed-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 | |
| 20 | diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c |
| 21 | index 945ce3e..89c7d20 100644 |
| 22 | --- a/src/drivers/driver_nl80211.c |
| 23 | +++ b/src/drivers/driver_nl80211.c |
| 24 | @@ -4912,7 +4912,8 @@ static int wpa_driver_nl80211_set_ap(void *priv, |
| 25 | ret, strerror(-ret)); |
| 26 | if (!bss->beacon_set) |
| 27 | ret = 0; |
| 28 | - bss->beacon_set = 0; |
| 29 | + if (ret != -EBUSY) |
| 30 | + bss->beacon_set = 0; |
| 31 | } else { |
| 32 | bss->beacon_set = 1; |
| 33 | nl80211_set_bss(bss, params->cts_protect, params->preamble, |
| 34 | -- |
| 35 | 2.25.1 |
| 36 | |