aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2023-09-25 15:36:29 +0200
committerFelix Fietkau <nbd@nbd.name>2023-09-25 18:46:22 +0200
commitf1bb528ae7631c60b95499b7e8a1948c3e6a42f0 (patch)
tree450fba999cb542fa1e0a02cf74a7b9acdf995255 /package
parente26e088203303d79eb87056f8ca74b1a5f585206 (diff)
downloadupstream-f1bb528ae7631c60b95499b7e8a1948c3e6a42f0.tar.gz
upstream-f1bb528ae7631c60b95499b7e8a1948c3e6a42f0.tar.bz2
upstream-f1bb528ae7631c60b95499b7e8a1948c3e6a42f0.zip
hostapd: fix rare crash with AP+STA and ACS enabled
Ensure that the iface disable in uc_hostapd_iface_start also clears the ACS state. Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package')
-rw-r--r--package/network/services/hostapd/src/src/ap/ucode.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c
index ac3222b03f8..af97091be55 100644
--- a/package/network/services/hostapd/src/src/ap/ucode.c
+++ b/package/network/services/hostapd/src/src/ap/ucode.c
@@ -465,17 +465,10 @@ uc_hostapd_bss_ctrl(uc_vm_t *vm, size_t nargs)
return ucv_string_new_length(reply, reply_len);
}
-static uc_value_t *
-uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
+static void
+uc_hostapd_disable_iface(struct hostapd_iface *iface)
{
- struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
- int i;
-
- if (!iface)
- return NULL;
-
switch (iface->state) {
- case HAPD_IFACE_ENABLED:
case HAPD_IFACE_DISABLED:
break;
#ifdef CONFIG_ACS
@@ -488,9 +481,19 @@ uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
hostapd_disable_iface(iface);
break;
}
+}
+
+static uc_value_t *
+uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ int i;
+
+ if (!iface)
+ return NULL;
if (iface->state != HAPD_IFACE_ENABLED)
- hostapd_disable_iface(iface);
+ uc_hostapd_disable_iface(iface);
for (i = 0; i < iface->num_bss; i++) {
struct hostapd_data *hapd = iface->bss[i];
@@ -561,8 +564,6 @@ uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs)
out:
switch (iface->state) {
- case HAPD_IFACE_DISABLED:
- break;
case HAPD_IFACE_ENABLED:
if (!hostapd_is_dfs_required(iface) ||
hostapd_is_dfs_chan_available(iface))
@@ -570,7 +571,7 @@ out:
wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface");
/* fallthrough */
default:
- hostapd_disable_iface(iface);
+ uc_hostapd_disable_iface(iface);
break;
}