developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 1 | From 62c4fa824adefc85ec7820b431f5d617aaf07bc7 Mon Sep 17 00:00:00 2001 |
developer | 805797f | 2023-06-08 11:36:33 +0800 | [diff] [blame] | 2 | From: Michael Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Wed, 3 May 2023 16:10:57 +0800 |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 4 | Subject: [PATCH 30/32] hostapd: mtk: Fix unexpected AP beacon state transition |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 5 | |
developer | 805797f | 2023-06-08 11:36:33 +0800 | [diff] [blame] | 6 | When AP fails to set the beacon, it assigns bss->beacon_set to 0 no |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 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 |
developer | 805797f | 2023-06-08 11:36:33 +0800 | [diff] [blame] | 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 |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 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 |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 21 | index 0e7ee4306..ab121ca16 100644 |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 22 | --- a/src/drivers/driver_nl80211.c |
| 23 | +++ b/src/drivers/driver_nl80211.c |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 24 | @@ -5395,7 +5395,8 @@ static int wpa_driver_nl80211_set_ap(void *priv, |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 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 { |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 32 | link->beacon_set = 1; |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 33 | nl80211_set_bss(bss, params->cts_protect, params->preamble, |
| 34 | -- |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 35 | 2.39.2 |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 36 | |