From 09b9d732ec76a0cf0c80223f1c0b991139dd4e82 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 19 Sep 2023 11:02:54 +0200 Subject: [PATCH 1/6] hostapd: use phy name for hostapd interfaces instead of first-bss ifname Improves reliability in error handling Signed-off-by: Felix Fietkau (cherry picked from commit a511480368a03f754aa6ce7887633247a07ea166) --- .../network/services/hostapd/files/hostapd.uc | 16 +++++++++------- .../hostapd/patches/601-ucode_support.patch | 10 ++++++++++ .../hostapd/patches/991-Fix-OpenWrt-13156.patch | 4 ++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index ebf732bea5..5cddb9c268 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/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/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index c8bbfd43d8..858dc52a98 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -142,6 +142,16 @@ { if (!hapd) return; +@@ -3491,7 +3495,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 @@ -195,8 +195,20 @@ endif diff --git a/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch index 3f10fb1eef..097d62abc0 100644 --- a/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch +++ b/package/network/services/hostapd/patches/991-Fix-OpenWrt-13156.patch @@ -20,7 +20,7 @@ Signed-off-by: Stijn Tintel --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -3563,6 +3563,8 @@ int hostapd_remove_iface(struct hapd_int +@@ -3564,6 +3564,8 @@ int hostapd_remove_iface(struct hapd_int void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { @@ -29,7 +29,7 @@ Signed-off-by: Stijn Tintel if (hapd->tkip_countermeasures) { hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_MICHAEL_MIC_FAILURE); -@@ -3570,10 +3572,16 @@ void hostapd_new_assoc_sta(struct hostap +@@ -3571,10 +3573,16 @@ void hostapd_new_assoc_sta(struct hostap } #ifdef CONFIG_IEEE80211BE From 829196e1b16bf20062d1d839ad38042290bb016c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 19 Sep 2023 11:46:16 +0200 Subject: [PATCH 2/6] netifd: update to the latest version 7a58b995fdbe wireless: update prev_config on SET_DATA notify Signed-off-by: Felix Fietkau (cherry picked from commit f52e008d045302976d2ff40f35e91b84a5678d12) --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index bb88bf726d..e60e592098 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2023-09-15.1 -PKG_SOURCE_VERSION:=afcd3825dad9b6a6712fbf6ed8e4434819a34009 -PKG_MIRROR_HASH:=d389db5dec7140fc12f69e8d679b9242c72d27b35c789b12adc6ebdf16913a85 +PKG_SOURCE_DATE:=2023-09-19 +PKG_SOURCE_VERSION:=7a58b995fdbecd9beed57e4d66d42cb3cf66aee2 +PKG_MIRROR_HASH:=a460a3b912047f8802eb24bb737084a08dad65b2dd520e5f5e7459379d1fcf8c PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 83bf45ea5cacabc2ec7060be6ab5115b871a7c21 Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Sun, 20 Aug 2023 21:08:20 +0200 Subject: [PATCH 3/6] package: base-files: turn error into warning Some users have their routers configured to supply a DHCP range that includes the local interface address. That worked with dnsmasq because it automatically skips the local address. Re-enable those existing configurations for the release and hint at possible future problems. Signed-off-by: Leon M. Busch-George [ wrap commit description and remove unecessary text ] Signed-off-by: Christian Marangi --- package/base-files/files/bin/ipcalc.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/base-files/files/bin/ipcalc.sh b/package/base-files/files/bin/ipcalc.sh index 56854b4104..6e72617e1b 100755 --- a/package/base-files/files/bin/ipcalc.sh +++ b/package/base-files/files/bin/ipcalc.sh @@ -80,8 +80,7 @@ BEGIN { } if (ipaddr > start && ipaddr < end) { - print "ipaddr inside range" > "/dev/stderr" - exit(1) + print "warning: ipaddr inside range - this might not be supported in future releases of Openwrt" > "/dev/stderr" } print "START="int2ip(start) From 6019945e960d2e09ba71eaeb3e03686d871b53e4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 20 Sep 2023 13:43:14 +0200 Subject: [PATCH 4/6] hostapd: fix a crash when disabling an interface during channel list update Signed-off-by: Felix Fietkau (cherry picked from commit e9722aef9e84110331706f74f7de0942c8d657ed) --- ...hannel_list_update_timeout-in-hostap.patch | 28 +++++++++++++++++++ .../hostapd/patches/601-ucode_support.patch | 8 +++--- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch diff --git a/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch b/package/network/services/hostapd/patches/183-hostapd-cancel-channel_list_update_timeout-in-hostap.patch new file mode 100644 index 0000000000..fe81318385 --- /dev/null +++ b/package/network/services/hostapd/patches/183-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 +@@ -569,6 +569,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 */ +@@ -598,7 +599,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/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index 858dc52a98..285309c0ca 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -107,14 +107,14 @@ hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); -@@ -599,6 +602,7 @@ void hostapd_cleanup_iface_partial(struc - static void hostapd_cleanup_iface(struct hostapd_iface *iface) +@@ -570,6 +573,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); @@ -1189,6 +1193,7 @@ static int hostapd_start_beacon(struct h hapd->driver->set_operstate(hapd->drv_priv, 1); From eda1545e6ea64063d7ffa0a80067679e3bef105e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 20 Sep 2023 18:40:17 +0200 Subject: [PATCH 5/6] hostapd: add missing NULL pointer check in uc_hostapd_iface_stop Avoid crashing if the interface has already been removed Signed-off-by: Felix Fietkau (cherry picked from commit 4145ff4d8a29c1c7a1569bb06fa4d1fe9808c94f) --- package/network/services/hostapd/src/src/ap/ucode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index e79f2420c0..ac3222b03f 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/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: From 43e9cded0672a857ec7df278e1de04a5c085e599 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 20 Sep 2023 20:59:35 +0200 Subject: [PATCH 6/6] mpc85xx: correct WS-AP3715i eth LED assignment Ethernet LED assignments were incorrectly swapped. Fix the assignment logic so the correct LED is illuminated for the LAN LEDs. Signed-off-by: David Bauer (cherry picked from commit 80374177449ab7fadcf7c9cd9693cc0e92feba8d) --- target/linux/mpc85xx/base-files/etc/board.d/01_leds | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/mpc85xx/base-files/etc/board.d/01_leds b/target/linux/mpc85xx/base-files/etc/board.d/01_leds index d9b4d2d79d..7e1d379efe 100644 --- a/target/linux/mpc85xx/base-files/etc/board.d/01_leds +++ b/target/linux/mpc85xx/base-files/etc/board.d/01_leds @@ -8,7 +8,10 @@ boardname="${board##*,}" board_config_update case $board in -enterasys,ws-ap3715i|\ +enterasys,ws-ap3715i) + ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth0" + ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth1" + ;; extreme-networks,ws-ap3825i) ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth1" ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth0"