From d65354488d2ff9187907c92c7f30e3072441ed83 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 3 Sep 2023 09:51:08 +0200 Subject: [PATCH 1/9] hostapd: fix config change detection on boolean values Check for null instead of truish value Signed-off-by: Felix Fietkau --- package/network/services/hostapd/files/common.uc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/services/hostapd/files/common.uc b/package/network/services/hostapd/files/common.uc index 9ece3b1af2..74c07855c9 100644 --- a/package/network/services/hostapd/files/common.uc +++ b/package/network/services/hostapd/files/common.uc @@ -150,7 +150,7 @@ function is_equal(val1, val2) { if (!is_equal(val1[key], val2[key])) return false; for (let key in val2) - if (!val1[key]) + if (val1[key] == null) return false; return true; } else { From 4a0b1af905694b4e5206207672e67c364d3b47a1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 3 Sep 2023 09:51:28 +0200 Subject: [PATCH 2/9] hostapd: allow adding initial AP without breaking STA interface connection When switching from a STA-only configuration to AP+STA on the same phy, the STA was previously restarted in order to notify hostapd of the new frequency, which might not match the AP configuration. Fix the STA restart by querying the operating frequency from within hostapd when bringing up the AP. Signed-off-by: Felix Fietkau --- .../files/lib/netifd/wireless/mac80211.sh | 4 +- .../network/services/hostapd/files/hostapd.uc | 99 +++++++++++++------ .../services/hostapd/files/wpa_supplicant.uc | 41 ++++++++ .../services/hostapd/src/src/ap/ucode.c | 1 + 4 files changed, 112 insertions(+), 33 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index db1ba231f3..3b88af4679 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -889,7 +889,6 @@ wpa_supplicant_init_config() { wpa_supplicant_add_interface() { local ifname="$1" local mode="$2" - local hostapd_ctrl="$3" local prev _wpa_supplicant_common "$ifname" @@ -903,7 +902,6 @@ wpa_supplicant_add_interface() { json_add_string config "$_config" json_add_string macaddr "$macaddr" [ -n "$network_bridge" ] && json_add_string bridge "$network_bridge" - [ -n "$hostapd_ctrl" ] && json_add_string hostapd_ctrl "$hostapd_ctrl" [ -n "$wds" ] && json_add_boolean 4addr "$wds" json_add_boolean powersave "$powersave" [ "$mode" = "mesh" ] && mac80211_add_mesh_params @@ -978,7 +976,7 @@ mac80211_setup_supplicant() { wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan" fi - wpa_supplicant_add_interface "$ifname" "$mode" "$hostapd_ctrl" + wpa_supplicant_add_interface "$ifname" "$mode" return 0 } diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index f9f0c31bab..384c5c2eb0 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -31,7 +31,7 @@ function iface_remove(cfg) wdev_remove(bss.ifname); } -function iface_gen_config(phy, config) +function iface_gen_config(phy, config, start_disabled) { let str = `data: ${join("\n", config.radio.data)} @@ -45,12 +45,69 @@ channel=${config.radio.channel} str += ` ${type}=${bss.ifname} ${join("\n", bss.data)} +`; + if (start_disabled) + str += ` +start_disabled=1 `; } return str; } +function iface_freq_info(iface, config, params) +{ + let freq = params.frequency; + if (!freq) + return null; + + let sec_offset = params.sec_chan_offset; + if (sec_offset != -1 && sec_offset != 1) + sec_offset = 0; + + let width = 0; + for (let line in config.radio.data) { + if (!sec_offset && match(line, /^ht_capab=.*HT40/)) { + sec_offset = null; // auto-detect + continue; + } + + let val = match(line, /^(vht_oper_chwidth|he_oper_chwidth)=(\d+)/); + if (!val) + continue; + + val = int(val[2]); + if (val > width) + width = val; + } + + if (freq < 4000) + width = 0; + + return hostapd.freq_info(freq, sec_offset, width); +} + +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}`); + if (ret < 0) + return false; + + if (!phy_status) + return true; + + let iface = hostapd.interfaces[bss.ifname]; + if (!iface) + return false; + + let freq_info = iface_freq_info(iface, config, phy_status); + + return iface.start(freq_info) >= 0; +} + function iface_restart(phy, config, old_config) { iface_remove(old_config); @@ -65,11 +122,18 @@ function iface_restart(phy, config, old_config) let err = wdev_create(phy, bss.ifname, { mode: "ap" }); if (err) hostapd.printf(`Failed to create ${bss.ifname} on phy ${phy}: ${err}`); - let config_inline = iface_gen_config(phy, config); let ubus = hostapd.data.ubus; + let phy_status = ubus.call("wpa_supplicant", "phy_status", { phy: phy }); + if (phy_status && phy_status.state == "COMPLETED") { + if (iface_add(phy, config, phy_status)) + return; + + hostapd.printf(`Failed to bring up phy ${phy} ifname=${bss.ifname} with supplicant provided frequency`); + } + ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: true }); - if (hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`) < 0) + if (!iface_add(phy, config)) hostapd.printf(`hostapd.add_iface failed for phy ${phy} ifname=${bss.ifname}`); ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: false }); } @@ -295,7 +359,6 @@ function iface_load_config(filename) } - let main_obj = { reload: { args: { @@ -344,34 +407,10 @@ let main_obj = { return 0; } - let freq = req.args.frequency; - if (!freq) + if (!req.args.frequency) return libubus.STATUS_INVALID_ARGUMENT; - let sec_offset = req.args.sec_chan_offset; - if (sec_offset != -1 && sec_offset != 1) - sec_offset = 0; - - let width = 0; - for (let line in config.radio.data) { - if (!sec_offset && match(line, /^ht_capab=.*HT40/)) { - sec_offset = null; // auto-detect - continue; - } - - let val = match(line, /^(vht_oper_chwidth|he_oper_chwidth)=(\d+)/); - if (!val) - continue; - - val = int(val[2]); - if (val > width) - width = val; - } - - if (freq < 4000) - width = 0; - - let freq_info = hostapd.freq_info(freq, sec_offset, width); + let freq_info = iface_freq_info(iface, config, req.args); if (!freq_info) return libubus.STATUS_UNKNOWN_ERROR; diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc index 50da7f14ff..f8a3fcb525 100644 --- a/package/network/services/hostapd/files/wpa_supplicant.uc +++ b/package/network/services/hostapd/files/wpa_supplicant.uc @@ -43,6 +43,11 @@ function iface_cb(new_if, old_if) return; } + if (new_if && old_if) + wpas.printf(`Update configuration for interface ${old_if.config.iface}`); + else if (old_if) + wpas.printf(`Remove interface ${old_if.config.iface}`); + if (old_if) iface_stop(old_if); } @@ -106,6 +111,41 @@ let main_obj = { return 0; } }, + phy_status: { + args: { + phy: "" + }, + call: function(req) { + if (!req.args.phy) + return libubus.STATUS_INVALID_ARGUMENT; + + let phy = wpas.data.config[req.args.phy]; + if (!phy) + return libubus.STATUS_NOT_FOUND; + + for (let ifname in phy.data) { + try { + let iface = wpas.interfaces[ifname]; + if (!iface) + continue; + + let status = iface.status(); + if (!status) + continue; + + if (status.state == "INTERFACE_DISABLED") + continue; + + status.ifname = ifname; + return status; + } catch (e) { + continue; + } + } + + return libubus.STATUS_NOT_FOUND; + } + }, config_set: { args: { phy: "", @@ -116,6 +156,7 @@ let main_obj = { if (!req.args.phy) return libubus.STATUS_INVALID_ARGUMENT; + wpas.printf(`Set new config for phy ${req.args.phy}`); try { if (req.args.config) set_config(req.args.phy, req.args.config); diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index f0b4ce4eb8..0326f6fc82 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -362,6 +362,7 @@ out: int ret; hapd->started = 1; + hapd->conf->start_disabled = 0; hostapd_set_freq(hapd, conf->hw_mode, iface->freq, conf->channel, conf->enable_edmg, From e793b4bde535b86aab35512c8791c805444e5aff Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 2 Sep 2023 08:42:48 -0400 Subject: [PATCH 3/9] kernel: bump 5.15 to 5.15.130 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.130 No patches needed a rebased. Update to checksum only. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia --- include/kernel-5.15 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 94c4cb360e..74130b2830 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .129 -LINUX_KERNEL_HASH-5.15.129 = 750ec97ce4f1473e392b367a55eca4ea7a6b1e9e65ca2fb3bbca2eaa64802b66 +LINUX_VERSION-5.15 = .130 +LINUX_KERNEL_HASH-5.15.130 = ab464e4107329ff5262f1c585c40fc29dc68f17687a9a918f3e90faba5303d62 From b4db76a5e5c759621f8148987ceacd78f4c105b1 Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 2 Sep 2023 07:32:29 -0400 Subject: [PATCH 4/9] kernel: bump 6.1 to 6.1.51 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.51 No patches needed a rebased. Update to checksum only. Build system: x86/64 Build-tested: x86/64/AMD Cezanne Run-tested: x86/64/AMD Cezanne Signed-off-by: John Audia --- include/kernel-6.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kernel-6.1 b/include/kernel-6.1 index 79d9b49ad7..16e40238b5 100644 --- a/include/kernel-6.1 +++ b/include/kernel-6.1 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.1 = .50 -LINUX_KERNEL_HASH-6.1.50 = b27ac1443eea563bc546ee1f67d9802bc8d6c0f6f18707407fba01f9f78c488c +LINUX_VERSION-6.1 = .51 +LINUX_KERNEL_HASH-6.1.51 = 58b0446d8ea4bc0b26a35e2e3509bd53efcdeb295c9e4f48d33a23b1cdaa103b From 5c65224d8f5787f6bdfaec9547637f1f2f46354f Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 2 Sep 2023 23:06:20 +0900 Subject: [PATCH 5/9] mvebu: add reset delays of PHYs for Fortinet FortiGate 50E Add reset-(de)assert-us to ethernet PHYs on Fortinet FortiGate 50E to solve instability after HW resetting of PHYs. (ex.: restarting "network" service, etc...) Fixes: #13391 Fixes: 102dc5a62506 ("mvebu: add support for Fortinet FortiGate 50E") Signed-off-by: INAGAKI Hiroshi --- .../files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts index 61d2da1755..dba215de3e 100644 --- a/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-385-fortinet-fg-50e.dts @@ -297,6 +297,8 @@ interrupt-parent = <&gpio0>; interrupts = <20 IRQ_TYPE_LEVEL_LOW>; reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; /* * LINK/ACT (Green): LED[0], Active Low * SPEED 100M (Amber): LED[1], Active High @@ -313,6 +315,8 @@ interrupt-parent = <&gpio1>; interrupts = <9 IRQ_TYPE_LEVEL_LOW>; reset-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; /* * LINK/ACT (Green): LED[0], Active Low * SPEED 100M (Amber): LED[1], Active High From 0e13363de6879a1a8b7d4d2739c92122f2df693e Mon Sep 17 00:00:00 2001 From: Yuu Toriyama Date: Sat, 2 Sep 2023 16:21:09 +0900 Subject: [PATCH 6/9] wireless-regdb: update to 2023.09.01 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes: 9dc0800 wireless-regdb: Update regulatory rules for Philippines (PH) 111ba89 wireless-regdb: Update regulatory rules for Egypt (EG) from March 2022 guidelines ae1421f wireless-regdb: Update regulatory info for Türkiye (TR) 20e5b73 wireless-regdb: Update regulatory rules for Australia (AU) for June 2023 991b1ef wireless-regdb: update regulatory database based on preceding changes Signed-off-by: Yuu Toriyama --- package/firmware/wireless-regdb/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/wireless-regdb/Makefile b/package/firmware/wireless-regdb/Makefile index 9ce2a397ff..dfff35ff4d 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-regdb -PKG_VERSION:=2023.05.03 +PKG_VERSION:=2023.09.01 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/ -PKG_HASH:=f254d08ab3765aeae2b856222e11a95d44aef519a6663877c71ef68fae4c8c12 +PKG_HASH:=26d4c2a727cc59239b84735aad856b7c7d0b04e30aa5c235c4f7f47f5f053491 PKG_MAINTAINER:=Felix Fietkau From 6267961a4a53da6897d0445fdfa1fa7880aea6a7 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sat, 2 Sep 2023 10:12:40 +0300 Subject: [PATCH 7/9] tools/cmake: update to 3.27.4 Update cmake to 3.27.4 No patch refresh needed. Signed-off-by: Hannu Nyman --- tools/cmake/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 2a0d06d7a7..9ed7ccb5a5 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.27.1 +PKG_VERSION:=3.27.4 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=b1a6b0135fa11b94476e90f5b32c4c8fad480bf91cf22d0ded98ce22c5132004 +PKG_HASH:=0a905ca8635ca81aa152e123bdde7e54cbe764fdd9a70d62af44cad8b92967af HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From 838bb0c03f2c9953fa677779112e6f441fe740b9 Mon Sep 17 00:00:00 2001 From: Thomas Bong Date: Thu, 31 Aug 2023 07:39:24 +0200 Subject: [PATCH 8/9] ipq40xx: convert devolo Magic 2 WiFi next to DSA Renamed the interfaces to match the other devices. Name the interface connected to the builtin G.hn chip 'ghn'. This might toggle at runtime while the G.hn chip is in the bootloader. Reviewed-by: Robert Marko Signed-off-by: Thomas Bong --- .../ipq40xx/base-files/etc/board.d/02_network | 3 +++ .../dts/qcom-ipq4018-magic-2-wifi-next.dts | 23 +++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 77dc892d07..951e0ad044 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -69,6 +69,9 @@ ipq40xx_setup_interfaces() compex,wpj428) ucidef_set_interface_lan "lan1 lan2" ;; + devolo,magic-2-wifi-next) + ucidef_set_interface_lan "lan1 lan2 ghn" + ;; linksys,whw01) ucidef_set_interface_lan "eth1 eth2" ;; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-magic-2-wifi-next.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-magic-2-wifi-next.dts index 29d51aa9e1..1fbc02d62b 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-magic-2-wifi-next.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-magic-2-wifi-next.dts @@ -231,3 +231,26 @@ }; }; }; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport5 { + status = "okay"; + label = "lan1"; +}; + +&swport3 { + status = "okay"; + label = "lan2"; +}; + +&swport4 { + status = "okay"; + label = "ghn"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 56aad5062e..58836471f0 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -388,7 +388,7 @@ define Device/devolo_magic-2-wifi-next DEFAULT := n endef # Missing DSA Setup -#TARGET_DEVICES += devolo_magic-2-wifi-next +TARGET_DEVICES += devolo_magic-2-wifi-next define Device/dlink_dap-2610 $(call Device/FitImageLzma) From 8554a4a7e37998bd214666d2ab7e469ce7c8757e Mon Sep 17 00:00:00 2001 From: Thomas Bong Date: Thu, 31 Aug 2023 10:43:15 +0200 Subject: [PATCH 9/9] ipq40xx: compress kernel for Magic 2 WiFi next The bootcmd limits the kernel to 4 MiB which is exceeded when using Device/FitImage. Device/FitzImage reduces the size to around 3 MiB. Reviewed-by: Robert Marko Signed-off-by: Thomas Bong --- target/linux/ipq40xx/image/generic.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 58836471f0..15f48a67b2 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -371,7 +371,7 @@ endef TARGET_DEVICES += compex_wpj428 define Device/devolo_magic-2-wifi-next - $(call Device/FitImage) + $(call Device/FitzImage) DEVICE_VENDOR := devolo DEVICE_MODEL := Magic 2 WiFi next SOC := qcom-ipq4018 @@ -387,7 +387,6 @@ define Device/devolo_magic-2-wifi-next IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata DEFAULT := n endef -# Missing DSA Setup TARGET_DEVICES += devolo_magic-2-wifi-next define Device/dlink_dap-2610