From 4f5a3b0c2bf04e37eb4eaac49412a04ada14bb51 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 25 Sep 2023 07:10:33 +0200 Subject: [PATCH 1/2] ucentral-schema: update to latest HEAD Fixes: WIFI-12956 Signed-off-by: John Crispin --- feeds/ipq807x_v5.4/hostapd/files/hostapd.sh | 3 +++ feeds/ucentral/ucentral-schema/Makefile | 4 ++-- feeds/wifi-ax/hostapd/files/hostapd.sh | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/feeds/ipq807x_v5.4/hostapd/files/hostapd.sh b/feeds/ipq807x_v5.4/hostapd/files/hostapd.sh index 6311846d1..e7fd78799 100644 --- a/feeds/ipq807x_v5.4/hostapd/files/hostapd.sh +++ b/feeds/ipq807x_v5.4/hostapd/files/hostapd.sh @@ -794,6 +794,9 @@ hostapd_set_bss_options() { [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N" set_default dynamic_vlan 0 + [ "$macfilter" = radius ] && { + append_radius_server + } vlan_possible=1 wps_possible=1 ;; diff --git a/feeds/ucentral/ucentral-schema/Makefile b/feeds/ucentral/ucentral-schema/Makefile index 3c471ad77..0a0b5aeb1 100644 --- a/feeds/ucentral/ucentral-schema/Makefile +++ b/feeds/ucentral/ucentral-schema/Makefile @@ -4,10 +4,10 @@ PKG_NAME:=ucentral-schema PKG_RELEASE:=1 PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git -PKG_MIRROR_HASH:=62571bb529e8b350bafdc63db3d7e02effa3edf5e5f19bfe8ced96c7cfb08b0e +PKG_MIRROR_HASH:=edb9bc0b8209226f585c724c88720eab2263c33eff6ebe2f2a5898896eb1fc11 PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2022-05-29 -PKG_SOURCE_VERSION:=e99eaf9bdbbe68639b4632d7fec171d89c379dc5 +PKG_SOURCE_VERSION:=e9529eab9cae27f170bdb440eb60d7a0a2588cea PKG_MAINTAINER:=John Crispin PKG_LICENSE:=BSD-3-Clause diff --git a/feeds/wifi-ax/hostapd/files/hostapd.sh b/feeds/wifi-ax/hostapd/files/hostapd.sh index 62c937ee5..d313ce0bf 100644 --- a/feeds/wifi-ax/hostapd/files/hostapd.sh +++ b/feeds/wifi-ax/hostapd/files/hostapd.sh @@ -774,7 +774,6 @@ hostapd_set_bss_options() { vlan_possible=1 [ "$macfilter" = radius ] && { append_radius_server - vlan_possible=1 } ;; psk|sae|psk-sae) @@ -794,6 +793,9 @@ hostapd_set_bss_options() { } [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N" + [ "$macfilter" = radius ] && { + append_radius_server + } set_default dynamic_vlan 0 vlan_possible=1 wps_possible=1 From d9f237b450f8f09265634080948c47b709fa7f76 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 25 Sep 2023 11:52:41 +0200 Subject: [PATCH 2/2] hostapd: update to latest hot reload Signed-off-by: John Crispin --- feeds/ipq807x_v5.4/hostapd/files/hostapd.uc | 16 ++++++---- feeds/ipq807x_v5.4/hostapd/files/wpad.init | 2 ++ ...hannel_list_update_timeout-in-hostap.patch | 28 ++++++++++++++++ .../hostapd/patches/600-ubus_support.patch | 4 +-- .../hostapd/patches/601-ucode_support.patch | 32 ++++++++++++------- .../hostapd/patches/999-ssi_signal.patch | 4 ++- feeds/ipq807x_v5.4/hostapd/src/src/ap/ubus.c | 4 ++- feeds/ipq807x_v5.4/hostapd/src/src/ap/ucode.c | 3 ++ feeds/wifi-ax/hostapd/files/hostapd.uc | 16 ++++++---- feeds/wifi-ax/hostapd/files/wpad.init | 2 ++ ...hannel_list_update_timeout-in-hostap.patch | 28 ++++++++++++++++ .../hostapd/patches/601-ucode_support.patch | 32 ++++++++++++------- .../hostapd/patches/999-ssi_signal.patch | 4 ++- feeds/wifi-ax/hostapd/src/src/ap/ubus.c | 4 ++- feeds/wifi-ax/hostapd/src/src/ap/ucode.c | 3 ++ 15 files changed, 140 insertions(+), 42 deletions(-) create mode 100644 feeds/ipq807x_v5.4/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch create mode 100644 feeds/wifi-ax/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch diff --git a/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc b/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc index ebf732bea..5cddb9c26 100644 --- a/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc +++ b/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc @@ -26,7 +26,6 @@ function iface_remove(cfg) if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname) return; - hostapd.remove_iface(cfg.bss[0].ifname); for (let bss in cfg.bss) wdev_remove(bss.ifname); } @@ -95,14 +94,14 @@ function iface_add(phy, config, phy_status) let config_inline = iface_gen_config(phy, config, !!phy_status); let bss = config.bss[0]; - let ret = hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`); + let ret = hostapd.add_iface(`bss_config=${phy}:${config_inline}`); if (ret < 0) return false; if (!phy_status) return true; - let iface = hostapd.interfaces[bss.ifname]; + let iface = hostapd.interfaces[phy]; if (!iface) return false; @@ -127,6 +126,7 @@ function iface_restart(phydev, config, old_config) { let phy = phydev.name; + hostapd.remove_iface(phy); iface_remove(old_config); iface_remove(config); @@ -267,13 +267,13 @@ function iface_reload_config(phydev, config, old_config) if (!old_config.bss || !old_config.bss[0]) return false; - let iface_name = old_config.bss[0].ifname; - let iface = hostapd.interfaces[iface_name]; + let iface = hostapd.interfaces[phy]; if (!iface) { hostapd.printf(`Could not find previous interface ${iface_name}`); return false; } + let iface_name = old_config.bss[0].ifname; let first_bss = hostapd.bss[iface_name]; if (!first_bss) { hostapd.printf(`Could not find bss of previous interface ${iface_name}`); @@ -512,8 +512,10 @@ function iface_set_config(phy, config) hostapd.data.config[phy] = config; - if (!config) + if (!config) { + hostapd.remove_iface(phy); return iface_remove(old_config); + } let phydev = phy_open(phy); if (!phydev) { @@ -667,7 +669,7 @@ let main_obj = { if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname) return 0; - let iface = hostapd.interfaces[config.bss[0].ifname]; + let iface = hostapd.interfaces[phy]; if (!iface) return 0; diff --git a/feeds/ipq807x_v5.4/hostapd/files/wpad.init b/feeds/ipq807x_v5.4/hostapd/files/wpad.init index 79c5bf107..65d46df98 100644 --- a/feeds/ipq807x_v5.4/hostapd/files/wpad.init +++ b/feeds/ipq807x_v5.4/hostapd/files/wpad.init @@ -13,6 +13,7 @@ start_service() { procd_open_instance hostapd procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global procd_set_param respawn 3600 1 0 + procd_set_param limits core="unlimited" [ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && { procd_add_jail hostapd procd_set_param capabilities /etc/capabilities/wpad.json @@ -29,6 +30,7 @@ start_service() { procd_open_instance supplicant procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global procd_set_param respawn 3600 1 0 + procd_set_param limits core="unlimited" [ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && { procd_add_jail wpa_supplicant procd_set_param capabilities /etc/capabilities/wpad.json diff --git a/feeds/ipq807x_v5.4/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch b/feeds/ipq807x_v5.4/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch new file mode 100644 index 000000000..d76c11d1d --- /dev/null +++ b/feeds/ipq807x_v5.4/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch @@ -0,0 +1,28 @@ +From: Felix Fietkau +Date: Wed, 20 Sep 2023 13:41:10 +0200 +Subject: [PATCH] hostapd: cancel channel_list_update_timeout in + hostapd_cleanup_iface_partial + +Fixes a crash when disabling an interface during channel list update + +Signed-off-by: Felix Fietkau +--- + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -501,6 +501,7 @@ static void sta_track_deinit(struct host + void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); ++ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); + #ifdef NEED_AP_MLME + hostapd_stop_setup_timers(iface); + #endif /* NEED_AP_MLME */ +@@ -529,7 +530,6 @@ void hostapd_cleanup_iface_partial(struc + static void hostapd_cleanup_iface(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); +- eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); + eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, + NULL); + diff --git a/feeds/ipq807x_v5.4/hostapd/patches/600-ubus_support.patch b/feeds/ipq807x_v5.4/hostapd/patches/600-ubus_support.patch index 245e9b8e4..ad48368a2 100644 --- a/feeds/ipq807x_v5.4/hostapd/patches/600-ubus_support.patch +++ b/feeds/ipq807x_v5.4/hostapd/patches/600-ubus_support.patch @@ -117,7 +117,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c goto fail; } + ubus_resp = hostapd_ubus_handle_event(hapd, &req); -+ if (0 && ubus_resp) { ++ if (ubus_resp) { + wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n", + MAC2STR(mgmt->sa)); + resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE; @@ -152,7 +152,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c #endif /* CONFIG_FILS */ + ubus_resp = hostapd_ubus_handle_event(hapd, &req); -+ if (0 && ubus_resp) { ++ if (ubus_resp) { + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n", + MAC2STR(mgmt->sa)); + resp = ubus_resp > 0 ? (u16) ubus_resp : WLAN_STATUS_UNSPECIFIED_FAILURE; diff --git a/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch b/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch index 52a762417..dc08e3dd7 100644 --- a/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch +++ b/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch @@ -107,14 +107,14 @@ hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); -@@ -530,6 +533,7 @@ void hostapd_cleanup_iface_partial(struc - static void hostapd_cleanup_iface(struct hostapd_iface *iface) +@@ -502,6 +505,7 @@ static void sta_track_deinit(struct host + void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); + hostapd_ucode_free_iface(iface); eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); - eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, - NULL); + #ifdef NEED_AP_MLME + hostapd_stop_setup_timers(iface); @@ -1104,7 +1108,7 @@ static int db_table_create_radius_attrib * initialized. Most of the modules that are initialized here will be * deinitialized in hostapd_cleanup(). @@ -159,6 +159,16 @@ hostapd_cleanup(hapd); hapd_iface->bss[hapd_iface->num_bss - 1] = NULL; hapd_iface->conf->num_bss--; +@@ -3137,7 +3142,8 @@ int hostapd_remove_iface(struct hapd_int + hapd_iface = interfaces->iface[i]; + if (hapd_iface == NULL) + return -1; +- if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { ++ if (!os_strcmp(hapd_iface->phy, buf) || ++ !os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { + wpa_printf(MSG_INFO, "Remove interface '%s'", buf); + hapd_iface->driver_ap_teardown = + !!(hapd_iface->drv_flags & --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -172,8 +172,20 @@ endif @@ -402,7 +412,7 @@ { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -1222,7 +1222,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1224,7 +1224,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", namebuf, ifname); @@ -411,7 +421,7 @@ wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface down", drv->first_bss->ifname); -@@ -1258,7 +1258,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1260,7 +1260,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", namebuf, ifname); @@ -420,7 +430,7 @@ wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface up", drv->first_bss->ifname); -@@ -7609,6 +7609,7 @@ static void *i802_init(struct hostapd_da +@@ -7614,6 +7614,7 @@ static void *i802_init(struct hostapd_da char master_ifname[IFNAMSIZ]; int ifindex, br_ifindex = 0; int br_added = 0; @@ -428,7 +438,7 @@ bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, params->global_priv, 1, -@@ -7668,21 +7669,17 @@ static void *i802_init(struct hostapd_da +@@ -7673,21 +7674,17 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -460,7 +470,7 @@ } if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { -@@ -8041,6 +8038,50 @@ static int wpa_driver_nl80211_if_remove( +@@ -8047,6 +8044,50 @@ static int wpa_driver_nl80211_if_remove( return 0; } @@ -511,7 +521,7 @@ static int cookie_handler(struct nl_msg *msg, void *arg) { -@@ -9385,6 +9426,37 @@ static int driver_nl80211_if_remove(void +@@ -9391,6 +9432,37 @@ static int driver_nl80211_if_remove(void } @@ -549,7 +559,7 @@ static int driver_nl80211_send_mlme(void *priv, const u8 *data, size_t data_len, int noack, unsigned int freq, -@@ -11967,6 +12039,8 @@ const struct wpa_driver_ops wpa_driver_n +@@ -11973,6 +12045,8 @@ const struct wpa_driver_ops wpa_driver_n .set_acl = wpa_driver_nl80211_set_acl, .if_add = wpa_driver_nl80211_if_add, .if_remove = driver_nl80211_if_remove, diff --git a/feeds/ipq807x_v5.4/hostapd/patches/999-ssi_signal.patch b/feeds/ipq807x_v5.4/hostapd/patches/999-ssi_signal.patch index cc7873284..a5309d2db 100644 --- a/feeds/ipq807x_v5.4/hostapd/patches/999-ssi_signal.patch +++ b/feeds/ipq807x_v5.4/hostapd/patches/999-ssi_signal.patch @@ -1,6 +1,6 @@ --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -57,6 +57,15 @@ +@@ -57,6 +57,17 @@ #include "gas_query_ap.h" @@ -8,6 +8,8 @@ +ewma(int new, int old) +{ + #define ALPHA 10 ++ if (!old) ++ return new; + if (new >= 0) + return old; + return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100; diff --git a/feeds/ipq807x_v5.4/hostapd/src/src/ap/ubus.c b/feeds/ipq807x_v5.4/hostapd/src/src/ap/ubus.c index 1ec7c846a..c214d62c9 100644 --- a/feeds/ipq807x_v5.4/hostapd/src/src/ap/ubus.c +++ b/feeds/ipq807x_v5.4/hostapd/src/src/ap/ubus.c @@ -153,7 +153,7 @@ hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time) } } - eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd); + eloop_register_timeout(time, 0, hostapd_bss_del_ban, ban, hapd); } static int @@ -305,6 +305,8 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); blobmsg_close_table(&b, r); + blobmsg_add_u32(&b, "retries", sta_driver_data.tx_retry_count); + blobmsg_add_u32(&b, "failed", sta_driver_data.tx_retry_failed); blobmsg_add_u32(&b, "signal", sta_driver_data.signal); r = blobmsg_open_table(&b, "mcs"); diff --git a/feeds/ipq807x_v5.4/hostapd/src/src/ap/ucode.c b/feeds/ipq807x_v5.4/hostapd/src/src/ap/ucode.c index 9ffdbd96a..46f5cb95b 100644 --- a/feeds/ipq807x_v5.4/hostapd/src/src/ap/ucode.c +++ b/feeds/ipq807x_v5.4/hostapd/src/src/ap/ucode.c @@ -471,6 +471,9 @@ 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; + switch (iface->state) { case HAPD_IFACE_ENABLED: case HAPD_IFACE_DISABLED: diff --git a/feeds/wifi-ax/hostapd/files/hostapd.uc b/feeds/wifi-ax/hostapd/files/hostapd.uc index ebf732bea..5cddb9c26 100644 --- a/feeds/wifi-ax/hostapd/files/hostapd.uc +++ b/feeds/wifi-ax/hostapd/files/hostapd.uc @@ -26,7 +26,6 @@ function iface_remove(cfg) if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname) return; - hostapd.remove_iface(cfg.bss[0].ifname); for (let bss in cfg.bss) wdev_remove(bss.ifname); } @@ -95,14 +94,14 @@ function iface_add(phy, config, phy_status) let config_inline = iface_gen_config(phy, config, !!phy_status); let bss = config.bss[0]; - let ret = hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`); + let ret = hostapd.add_iface(`bss_config=${phy}:${config_inline}`); if (ret < 0) return false; if (!phy_status) return true; - let iface = hostapd.interfaces[bss.ifname]; + let iface = hostapd.interfaces[phy]; if (!iface) return false; @@ -127,6 +126,7 @@ function iface_restart(phydev, config, old_config) { let phy = phydev.name; + hostapd.remove_iface(phy); iface_remove(old_config); iface_remove(config); @@ -267,13 +267,13 @@ function iface_reload_config(phydev, config, old_config) if (!old_config.bss || !old_config.bss[0]) return false; - let iface_name = old_config.bss[0].ifname; - let iface = hostapd.interfaces[iface_name]; + let iface = hostapd.interfaces[phy]; if (!iface) { hostapd.printf(`Could not find previous interface ${iface_name}`); return false; } + let iface_name = old_config.bss[0].ifname; let first_bss = hostapd.bss[iface_name]; if (!first_bss) { hostapd.printf(`Could not find bss of previous interface ${iface_name}`); @@ -512,8 +512,10 @@ function iface_set_config(phy, config) hostapd.data.config[phy] = config; - if (!config) + if (!config) { + hostapd.remove_iface(phy); return iface_remove(old_config); + } let phydev = phy_open(phy); if (!phydev) { @@ -667,7 +669,7 @@ let main_obj = { if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname) return 0; - let iface = hostapd.interfaces[config.bss[0].ifname]; + let iface = hostapd.interfaces[phy]; if (!iface) return 0; diff --git a/feeds/wifi-ax/hostapd/files/wpad.init b/feeds/wifi-ax/hostapd/files/wpad.init index 79c5bf107..65d46df98 100644 --- a/feeds/wifi-ax/hostapd/files/wpad.init +++ b/feeds/wifi-ax/hostapd/files/wpad.init @@ -13,6 +13,7 @@ start_service() { procd_open_instance hostapd procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global procd_set_param respawn 3600 1 0 + procd_set_param limits core="unlimited" [ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && { procd_add_jail hostapd procd_set_param capabilities /etc/capabilities/wpad.json @@ -29,6 +30,7 @@ start_service() { procd_open_instance supplicant procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global procd_set_param respawn 3600 1 0 + procd_set_param limits core="unlimited" [ -x /sbin/ujail -a -e /etc/capabilities/wpad.json ] && { procd_add_jail wpa_supplicant procd_set_param capabilities /etc/capabilities/wpad.json diff --git a/feeds/wifi-ax/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch b/feeds/wifi-ax/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch new file mode 100644 index 000000000..d76c11d1d --- /dev/null +++ b/feeds/wifi-ax/hostapd/patches/043-hostapd-cancel-channel_list_update_timeout-in-hostap.patch @@ -0,0 +1,28 @@ +From: Felix Fietkau +Date: Wed, 20 Sep 2023 13:41:10 +0200 +Subject: [PATCH] hostapd: cancel channel_list_update_timeout in + hostapd_cleanup_iface_partial + +Fixes a crash when disabling an interface during channel list update + +Signed-off-by: Felix Fietkau +--- + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -501,6 +501,7 @@ static void sta_track_deinit(struct host + void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); ++ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); + #ifdef NEED_AP_MLME + hostapd_stop_setup_timers(iface); + #endif /* NEED_AP_MLME */ +@@ -529,7 +530,6 @@ void hostapd_cleanup_iface_partial(struc + static void hostapd_cleanup_iface(struct hostapd_iface *iface) + { + wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); +- eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); + eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, + NULL); + diff --git a/feeds/wifi-ax/hostapd/patches/601-ucode_support.patch b/feeds/wifi-ax/hostapd/patches/601-ucode_support.patch index 52a762417..dc08e3dd7 100644 --- a/feeds/wifi-ax/hostapd/patches/601-ucode_support.patch +++ b/feeds/wifi-ax/hostapd/patches/601-ucode_support.patch @@ -107,14 +107,14 @@ hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); -@@ -530,6 +533,7 @@ void hostapd_cleanup_iface_partial(struc - static void hostapd_cleanup_iface(struct hostapd_iface *iface) +@@ -502,6 +505,7 @@ static void sta_track_deinit(struct host + void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); + hostapd_ucode_free_iface(iface); eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); - eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, - NULL); + #ifdef NEED_AP_MLME + hostapd_stop_setup_timers(iface); @@ -1104,7 +1108,7 @@ static int db_table_create_radius_attrib * initialized. Most of the modules that are initialized here will be * deinitialized in hostapd_cleanup(). @@ -159,6 +159,16 @@ hostapd_cleanup(hapd); hapd_iface->bss[hapd_iface->num_bss - 1] = NULL; hapd_iface->conf->num_bss--; +@@ -3137,7 +3142,8 @@ int hostapd_remove_iface(struct hapd_int + hapd_iface = interfaces->iface[i]; + if (hapd_iface == NULL) + return -1; +- if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { ++ if (!os_strcmp(hapd_iface->phy, buf) || ++ !os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { + wpa_printf(MSG_INFO, "Remove interface '%s'", buf); + hapd_iface->driver_ap_teardown = + !!(hapd_iface->drv_flags & --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -172,8 +172,20 @@ endif @@ -402,7 +412,7 @@ { --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c -@@ -1222,7 +1222,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1224,7 +1224,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", namebuf, ifname); @@ -411,7 +421,7 @@ wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface down", drv->first_bss->ifname); -@@ -1258,7 +1258,7 @@ static void wpa_driver_nl80211_event_rtm +@@ -1260,7 +1260,7 @@ static void wpa_driver_nl80211_event_rtm } wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", namebuf, ifname); @@ -420,7 +430,7 @@ wpa_printf(MSG_DEBUG, "nl80211: Not the main interface (%s) - do not indicate interface up", drv->first_bss->ifname); -@@ -7609,6 +7609,7 @@ static void *i802_init(struct hostapd_da +@@ -7614,6 +7614,7 @@ static void *i802_init(struct hostapd_da char master_ifname[IFNAMSIZ]; int ifindex, br_ifindex = 0; int br_added = 0; @@ -428,7 +438,7 @@ bss = wpa_driver_nl80211_drv_init(hapd, params->ifname, params->global_priv, 1, -@@ -7668,21 +7669,17 @@ static void *i802_init(struct hostapd_da +@@ -7673,21 +7674,17 @@ static void *i802_init(struct hostapd_da (params->num_bridge == 0 || !params->bridge[0])) add_ifidx(drv, br_ifindex, drv->ifindex); @@ -460,7 +470,7 @@ } if (drv->capa.flags2 & WPA_DRIVER_FLAGS2_CONTROL_PORT_RX) { -@@ -8041,6 +8038,50 @@ static int wpa_driver_nl80211_if_remove( +@@ -8047,6 +8044,50 @@ static int wpa_driver_nl80211_if_remove( return 0; } @@ -511,7 +521,7 @@ static int cookie_handler(struct nl_msg *msg, void *arg) { -@@ -9385,6 +9426,37 @@ static int driver_nl80211_if_remove(void +@@ -9391,6 +9432,37 @@ static int driver_nl80211_if_remove(void } @@ -549,7 +559,7 @@ static int driver_nl80211_send_mlme(void *priv, const u8 *data, size_t data_len, int noack, unsigned int freq, -@@ -11967,6 +12039,8 @@ const struct wpa_driver_ops wpa_driver_n +@@ -11973,6 +12045,8 @@ const struct wpa_driver_ops wpa_driver_n .set_acl = wpa_driver_nl80211_set_acl, .if_add = wpa_driver_nl80211_if_add, .if_remove = driver_nl80211_if_remove, diff --git a/feeds/wifi-ax/hostapd/patches/999-ssi_signal.patch b/feeds/wifi-ax/hostapd/patches/999-ssi_signal.patch index cc7873284..a5309d2db 100644 --- a/feeds/wifi-ax/hostapd/patches/999-ssi_signal.patch +++ b/feeds/wifi-ax/hostapd/patches/999-ssi_signal.patch @@ -1,6 +1,6 @@ --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c -@@ -57,6 +57,15 @@ +@@ -57,6 +57,17 @@ #include "gas_query_ap.h" @@ -8,6 +8,8 @@ +ewma(int new, int old) +{ + #define ALPHA 10 ++ if (!old) ++ return new; + if (new >= 0) + return old; + return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100; diff --git a/feeds/wifi-ax/hostapd/src/src/ap/ubus.c b/feeds/wifi-ax/hostapd/src/src/ap/ubus.c index c179b38e6..5f8bab526 100644 --- a/feeds/wifi-ax/hostapd/src/src/ap/ubus.c +++ b/feeds/wifi-ax/hostapd/src/src/ap/ubus.c @@ -153,7 +153,7 @@ hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time) } } - eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd); + eloop_register_timeout(time, 0, hostapd_bss_del_ban, ban, hapd); } static int @@ -305,6 +305,8 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_add_u32(&b, "rx", sta_driver_data.current_rx_rate * 100); blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100); blobmsg_close_table(&b, r); + blobmsg_add_u32(&b, "retries", sta_driver_data.tx_retry_count); + blobmsg_add_u32(&b, "failed", sta_driver_data.tx_retry_failed); blobmsg_add_u32(&b, "signal", sta_driver_data.signal); r = blobmsg_open_table(&b, "mcs"); diff --git a/feeds/wifi-ax/hostapd/src/src/ap/ucode.c b/feeds/wifi-ax/hostapd/src/src/ap/ucode.c index 9ffdbd96a..46f5cb95b 100644 --- a/feeds/wifi-ax/hostapd/src/src/ap/ucode.c +++ b/feeds/wifi-ax/hostapd/src/src/ap/ucode.c @@ -471,6 +471,9 @@ 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; + switch (iface->state) { case HAPD_IFACE_ENABLED: case HAPD_IFACE_DISABLED: