diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 76b0395f373..0c9e00d11fe 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -184,16 +184,73 @@ config KERNEL_KASAN_VMALLOC will have no effect. if KERNEL_KASAN - config KERNEL_KASAN_GENERIC - def_bool y +choice + prompt "KASAN mode" + depends on KERNEL_KASAN + default KERNEL_KASAN_GENERIC + help + KASAN has three modes: + + 1. Generic KASAN (supported by many architectures, enabled with + CONFIG_KASAN_GENERIC, similar to userspace ASan), + 2. Software Tag-Based KASAN (arm64 only, based on software memory + tagging, enabled with CONFIG_KASAN_SW_TAGS, similar to userspace + HWASan), and + 3. Hardware Tag-Based KASAN (arm64 only, based on hardware memory + tagging, enabled with CONFIG_KASAN_HW_TAGS). + +config KERNEL_KASAN_GENERIC + bool "Generic KASAN" + select KERNEL_SLUB_DEBUG + help + Enables Generic KASAN. + + Consumes about 1/8th of available memory at kernel start and adds an + overhead of ~50% for dynamic allocations. + The performance slowdown is ~x3. + +config KERNEL_KASAN_SW_TAGS + bool "Software Tag-Based KASAN" + depends on aarch64 + select KERNEL_SLUB_DEBUG + help + Enables Software Tag-Based KASAN. + + Supported only on arm64 CPUs and relies on Top Byte Ignore. + + Consumes about 1/16th of available memory at kernel start and + add an overhead of ~20% for dynamic allocations. + + May potentially introduce problems related to pointer casting and + comparison, as it embeds a tag into the top byte of each pointer. + +config KERNEL_KASAN_HW_TAGS + bool "Hardware Tag-Based KASAN" + depends on aarch64 + select KERNEL_SLUB_DEBUG + select KERNEL_ARM64_MTE + help + Enables Hardware Tag-Based KASAN. + + Supported only on arm64 CPUs starting from ARMv8.5 and relies on + Memory Tagging Extension and Top Byte Ignore. + + Consumes about 1/32nd of available memory. + + May potentially introduce problems related to pointer casting and + comparison, as it embeds a tag into the top byte of each pointer. + +endchoice + + config KERNEL_ARM64_MTE + def_bool n - config KERNEL_KASAN_SW_TAGS - def_bool n endif choice prompt "Instrumentation type" depends on KERNEL_KASAN + depends on !KERNEL_KASAN_HW_TAGS default KERNEL_KASAN_OUTLINE config KERNEL_KASAN_OUTLINE diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 43e03fac8d1..7687c40aa8c 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .125 -LINUX_KERNEL_HASH-5.15.125 = 150f3846b76cd23a6135f49cef71372bade5a06e851cb4f8558df8b862d8fec7 +LINUX_VERSION-5.15 = .126 +LINUX_KERNEL_HASH-5.15.126 = adf4aab9840f89ee151b837defbe16e9f388e8eef20df7ee94bf63be33b3ed6f diff --git a/include/kernel-6.1 b/include/kernel-6.1 index 95d4bb19272..8b6629001c6 100644 --- a/include/kernel-6.1 +++ b/include/kernel-6.1 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.1 = .44 -LINUX_KERNEL_HASH-6.1.44 = 2e51d41fe11d082ae167cee05772bb07ca7f19448d2b46772d8ca2db7673a1a5 +LINUX_VERSION-6.1 = .45 +LINUX_KERNEL_HASH-6.1.45 = bd2343396e7ddad8974f3689a5a067ec931f4ade793e72b1070a85cd19f1f192 diff --git a/package/boot/arm-trusted-firmware-tools/patches/002-darwin_compile.patch b/package/boot/arm-trusted-firmware-tools/patches/002-darwin_compile.patch new file mode 100644 index 00000000000..6bc8192f442 --- /dev/null +++ b/package/boot/arm-trusted-firmware-tools/patches/002-darwin_compile.patch @@ -0,0 +1,21 @@ +--- a/tools/fiptool/fiptool.c ++++ b/tools/fiptool/fiptool.c +@@ -3,7 +3,7 @@ + * + * SPDX-License-Identifier: BSD-3-Clause + */ +- ++#define _DARWIN_C_SOURCE + #ifndef _MSC_VER + #include + #endif +@@ -18,6 +18,9 @@ + #include + #include + #include ++#include ++ ++#define uuid_t fiptool_uuid_t + + #include "fiptool.h" + #include "tbbr_config.h" diff --git a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch index c11c42fd8f3..28aa0844ead 100644 --- a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch +++ b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch @@ -840,7 +840,7 @@ +boot_tftp_recovery=run boot_update_conf ; tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi +boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size -+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 ++mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 +part_default=production +part_recovery=recovery +reset_factory=eraseenv && reset @@ -931,8 +931,8 @@ +boot_write_fip=mtd erase fip && mtd write fip $loadaddr +boot_write_preloader=mtd erase bl2 && mtd write bl2 $loadaddr +reset_factory=mtd erase u-boot-env -+nor_read_production=mtd read fit $loadaddr 0x0 0x1000 && imsz $loadaddr image_size && mtd read fit $loadaddr 0x0 $image_size -+nor_read_recovery=mtd read recovery $loadaddr 0x0 0x1000 && imsz $loadaddr image_size && mtd read recovery $loadaddr 0x0 $image_size ++nor_read_production=mtd read fit $loadaddr 0x0 0x20000 && imsz $loadaddr image_size && mtd read fit $loadaddr 0x0 $image_size ++nor_read_recovery=mtd read recovery $loadaddr 0x0 0x20000 && imsz $loadaddr image_size && mtd read recovery $loadaddr 0x0 $image_size +nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x10000 ; setexpr tmp1 0x$image_size % 0x10000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb $image_eb * 0x10000 +nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase fit && mtd write fit $loadaddr 0x0 $image_eb +nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0x900000 && mtd erase recovery 0x0 0x$image_eb && mtd write recovery $loadaddr 0x0 $image_eb @@ -1067,7 +1067,7 @@ +boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf +boot_update_conf=if nand info ; then setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nand ; else setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nor ; fi +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size -+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 ++mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 +part_default=production +part_recovery=recovery +reset_factory=eraseenv && reset diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index cb0c93281d4..7cadf6ff32b 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -294,6 +294,12 @@ define U-Boot/bananapi_m2_plus_h3 BUILD_DEVICES:=sinovoip_bananapi-m2-plus endef +define U-Boot/Sinovoip_BPI_M3 + BUILD_SUBTARGET:=cortexa7 + NAME:=Bananapi M3 + BUILD_DEVICES:=sinovoip_bananapi-m3 +endef + define U-Boot/sopine_baseboard BUILD_SUBTARGET:=cortexa53 NAME:=Sopine Baseboard @@ -378,6 +384,7 @@ UBOOT_TARGETS := \ orangepi_pc2 \ pangolin \ pine64_plus \ + Sinovoip_BPI_M3 \ sopine_baseboard \ orangepi_zero_plus \ libretech_all_h3_cc_h5 diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index 4c234ddc846..5102bf81eae 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=intel-microcode -PKG_VERSION:=20230512 +PKG_VERSION:=20230808 PKG_RELEASE:=1 PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/non-free-firmware/i/intel-microcode/ -PKG_HASH:=e6717a42d7b6e92280565fbb180cd0d11bc5d14874ef06ff1bed2b7a11d17c67 +PKG_HASH:=29e77c275b3f60a691832c0844f70effbd94a4594d04af21e0c2e6e0c1ac1894 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 PKG_BUILD_DEPENDS:=iucode-tool/host diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index 680f8fb104c..ef6cd075de4 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware -PKG_VERSION:=20230625 +PKG_VERSION:=20230804 PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=87597111c0d4b71b31e53cb85a92c386921b84c825a402db8c82e0e86015500d +PKG_HASH:=88d46c543847ee3b03404d4941d91c92974690ee1f6fdcbee9cef3e5f97db688 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 81c08b00bbc..39683376b59 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -491,8 +491,6 @@ $base_cfg EOF json_select .. - radio_md5sum=$(md5sum $hostapd_conf_file | cut -d" " -f1) - echo "radio_config_id=${radio_md5sum}" >> $hostapd_conf_file } mac80211_hostapd_setup_bss() { diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 130ed01fdc2..cd1a1b23873 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwlwifi -PKG_RELEASE=1 +PKG_RELEASE=2 PKG_LICENSE:=ISC PKG_LICENSE_FILES:= diff --git a/package/kernel/mwlwifi/patches/006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch b/package/kernel/mwlwifi/patches/006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch new file mode 100644 index 00000000000..c81561a149d --- /dev/null +++ b/package/kernel/mwlwifi/patches/006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch @@ -0,0 +1,53 @@ +From ad911365cac3723d1c00d048905a5e22ff4a10f3 Mon Sep 17 00:00:00 2001 +From: Stefan Kalscheuer +Date: Sun, 18 Jun 2023 17:53:27 +0200 +Subject: [PATCH 1/2] remove uaccess and get_fs calls from PCIe for Kenel >= + 5.18 + +Remove the calls to deprecated get_fs and force_uaccess_* API for modern +kernels. + +The get_fs functionality and the transitional force_uaccess_* calls have +been removed Kernel 5.18 [1] while read and write operations have been +refactored, so the code can work on kernel- and userspace data without +the need to shifting the boundary using set_fs(). + +[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=967747bbc084b93b54e66f9047d342232314cd25 + +Signed-off-by: Stefan Kalscheuer +--- + hif/pcie/pcie.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/hif/pcie/pcie.c b/hif/pcie/pcie.c +index 24453b6..bee1cc5 100644 +--- a/hif/pcie/pcie.c ++++ b/hif/pcie/pcie.c +@@ -1294,7 +1294,9 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv, + const char filename[] = "/tmp/BF_MIMO_Ctrl_Field_Output.txt"; + char str_buf[256]; + char *buf = &str_buf[0]; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + mm_segment_t oldfs; ++#endif + + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) + oldfs = get_fs(); +@@ -1302,7 +1304,7 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv, + #elif LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) + oldfs = get_fs(); + set_fs(KERNEL_DS); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); + #endif + +@@ -1326,7 +1328,7 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv, + + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) + set_fs(oldfs); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); + #endif + } diff --git a/package/kernel/mwlwifi/patches/007-replace-usage-of-the-deprecated-pci-dma-compat.h-API.patch b/package/kernel/mwlwifi/patches/007-replace-usage-of-the-deprecated-pci-dma-compat.h-API.patch new file mode 100644 index 00000000000..1faff18c840 --- /dev/null +++ b/package/kernel/mwlwifi/patches/007-replace-usage-of-the-deprecated-pci-dma-compat.h-API.patch @@ -0,0 +1,275 @@ +From 61c75dce424c180b633c64613a1948df5a41cf1e Mon Sep 17 00:00:00 2001 +From: Stefan Kalscheuer +Date: Sun, 18 Jun 2023 17:59:07 +0200 +Subject: [PATCH 2/2] replace usage of the deprecated "pci-dma-compat.h" API + +The pci-dma-compat API has been legacy for quite a while and was removed +with 5.18 [1]. Migrate all calls, so the module can be compiled against +modern kernel versions. + +Replace some compat calls: +* pci_set_dma_mask with dma_set_mask +* pci_(un)map_single with dma_(un)map_single +* pci_dma_mapping_error with dma_mapping_error +* PCI_DMA_{FROM,TO}DEVICE with DMA_{FOM,TO}_DEVICE + +[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7968778914e53788a01c2dee2692cab157de9ac0 + +Signed-off-by: Stefan Kalscheuer +--- + hif/pcie/pcie.c | 2 +- + hif/pcie/rx.c | 20 ++++++++++---------- + hif/pcie/rx_ndp.c | 20 ++++++++++---------- + hif/pcie/tx.c | 22 +++++++++++----------- + hif/pcie/tx_ndp.c | 14 +++++++------- + 5 files changed, 39 insertions(+), 39 deletions(-) + +diff --git a/hif/pcie/pcie.c b/hif/pcie/pcie.c +index bee1cc5..d85c29e 100644 +--- a/hif/pcie/pcie.c ++++ b/hif/pcie/pcie.c +@@ -1556,7 +1556,7 @@ static int pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) + return rc; + } + +- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); ++ rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (rc) { + pr_err("%s: 32-bit PCI DMA not supported\n", + PCIE_DRV_NAME); +diff --git a/hif/pcie/rx.c b/hif/pcie/rx.c +index 91eb984..2857c0f 100644 +--- a/hif/pcie/rx.c ++++ b/hif/pcie/rx.c +@@ -107,11 +107,11 @@ static int pcie_rx_ring_init(struct mwl_priv *priv) + desc->prx_ring[i].rssi = 0x00; + desc->prx_ring[i].pkt_len = + cpu_to_le16(SYSADPT_MAX_AGGR_SIZE); +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + rx_hndl->psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); + return -ENOMEM; +@@ -153,11 +153,11 @@ static void pcie_rx_ring_cleanup(struct mwl_priv *priv) + if (!rx_hndl->psk_buff) + continue; + +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu + (rx_hndl->pdesc->pphys_buff_data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + + dev_kfree_skb_any(rx_hndl->psk_buff); + +@@ -335,11 +335,11 @@ static inline int pcie_rx_refill(struct mwl_priv *priv, + rx_hndl->pdesc->rssi = 0x00; + rx_hndl->pdesc->pkt_len = cpu_to_le16(desc->rx_buf_size); + +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + rx_hndl->psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(rx_hndl->psk_buff); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -413,10 +413,10 @@ void pcie_rx_recv(unsigned long data) + prx_skb = curr_hndl->psk_buff; + if (!prx_skb) + goto out; +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(curr_hndl->pdesc->pphys_buff_data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + pkt_len = le16_to_cpu(curr_hndl->pdesc->pkt_len); + + if (skb_tailroom(prx_skb) < pkt_len) { +diff --git a/hif/pcie/rx_ndp.c b/hif/pcie/rx_ndp.c +index 228075d..106d559 100644 +--- a/hif/pcie/rx_ndp.c ++++ b/hif/pcie/rx_ndp.c +@@ -86,11 +86,11 @@ static int pcie_rx_ring_init_ndp(struct mwl_priv *priv) + } + skb_reserve(psk_buff, MIN_BYTES_RX_HEADROOM); + +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); + return -ENOMEM; +@@ -120,11 +120,11 @@ static void pcie_rx_ring_cleanup_ndp(struct mwl_priv *priv) + if (desc->prx_ring) { + for (i = 0; i < MAX_NUM_RX_DESC; i++) { + if (desc->rx_vbuflist[i]) { +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu( + desc->prx_ring[i].data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + desc->rx_vbuflist[i] = NULL; + } + } +@@ -400,11 +400,11 @@ static inline int pcie_rx_refill_ndp(struct mwl_priv *priv, u32 buf_idx) + return -ENOMEM; + skb_reserve(psk_buff, MIN_BYTES_RX_HEADROOM); + +- dma = pci_map_single(pcie_priv->pdev, ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, + psk_buff->data, + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ DMA_FROM_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + wiphy_err(priv->hw->wiphy, + "refill: failed to map pci memory!\n"); + return -ENOMEM; +@@ -509,10 +509,10 @@ recheck: + break; + } + +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(prx_desc->data), + desc->rx_buf_size, +- PCI_DMA_FROMDEVICE); ++ DMA_FROM_DEVICE); + + bad_mic = false; + ctrl = le32_to_cpu(prx_ring_done->ctrl); +diff --git a/hif/pcie/tx.c b/hif/pcie/tx.c +index 62a34a8..8f3c828 100644 +--- a/hif/pcie/tx.c ++++ b/hif/pcie/tx.c +@@ -243,11 +243,11 @@ static void pcie_tx_ring_cleanup(struct mwl_priv *priv) + desc->tx_hndl[i].psk_buff->data, + le32_to_cpu( + desc->ptx_ring[i].pkt_ptr)); +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu( + desc->ptx_ring[i].pkt_ptr), + desc->tx_hndl[i].psk_buff->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + dev_kfree_skb_any(desc->tx_hndl[i].psk_buff); + desc->ptx_ring[i].status = + cpu_to_le32(EAGLE_TXD_STATUS_IDLE); +@@ -305,10 +305,10 @@ static void pcie_txbd_ring_delete(struct mwl_priv *priv) + skb = pcie_priv->tx_buf_list[num]; + tx_desc = (struct pcie_tx_desc *)skb->data; + +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(tx_desc->pkt_ptr), + skb->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + dev_kfree_skb_any(skb); + } + pcie_priv->tx_buf_list[num] = NULL; +@@ -453,9 +453,9 @@ static inline void pcie_tx_skb(struct mwl_priv *priv, int desc_num, + tx_desc->type = tx_ctrl->type; + tx_desc->xmit_control = tx_ctrl->xmit_control; + tx_desc->sap_pkt_info = 0; +- dma = pci_map_single(pcie_priv->pdev, tx_skb->data, +- tx_skb->len, PCI_DMA_TODEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, tx_skb->data, ++ tx_skb->len, DMA_TO_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(tx_skb); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -676,10 +676,10 @@ static void pcie_pfu_tx_done(struct mwl_priv *priv) + pfu_dma = (struct pcie_pfu_dma_data *)done_skb->data; + tx_desc = &pfu_dma->tx_desc; + dma_data = &pfu_dma->dma_data; +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(data_buf->paddr), + le16_to_cpu(data_buf->len), +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + tx_desc->pkt_ptr = 0; + tx_desc->pkt_len = 0; + tx_desc->status = cpu_to_le32(EAGLE_TXD_STATUS_IDLE); +@@ -768,10 +768,10 @@ static void pcie_non_pfu_tx_done(struct mwl_priv *priv) + (tx_desc->status & cpu_to_le32(EAGLE_TXD_STATUS_OK)) && + (!(tx_desc->status & + cpu_to_le32(EAGLE_TXD_STATUS_FW_OWNED)))) { +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + le32_to_cpu(tx_desc->pkt_ptr), + le16_to_cpu(tx_desc->pkt_len), +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + done_skb = tx_hndl->psk_buff; + rate = le32_to_cpu(tx_desc->rate_info); + tx_desc->pkt_ptr = 0; +diff --git a/hif/pcie/tx_ndp.c b/hif/pcie/tx_ndp.c +index 6758cde..f4256c2 100644 +--- a/hif/pcie/tx_ndp.c ++++ b/hif/pcie/tx_ndp.c +@@ -131,10 +131,10 @@ static void pcie_tx_ring_cleanup_ndp(struct mwl_priv *priv) + for (i = 0; i < MAX_TX_RING_SEND_SIZE; i++) { + tx_skb = desc->tx_vbuflist[i]; + if (tx_skb) { +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + desc->pphys_tx_buflist[i], + tx_skb->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + dev_kfree_skb_any(tx_skb); + desc->pphys_tx_buflist[i] = 0; + desc->tx_vbuflist[i] = NULL; +@@ -266,9 +266,9 @@ static inline int pcie_tx_skb_ndp(struct mwl_priv *priv, + (TXRING_CTRL_TAG_MGMT << TXRING_CTRL_TAG_SHIFT)); + } + +- dma = pci_map_single(pcie_priv->pdev, tx_skb->data, +- tx_skb->len, PCI_DMA_TODEVICE); +- if (pci_dma_mapping_error(pcie_priv->pdev, dma)) { ++ dma = dma_map_single(&(pcie_priv->pdev)->dev, tx_skb->data, ++ tx_skb->len, DMA_TO_DEVICE); ++ if (dma_mapping_error(&(pcie_priv->pdev)->dev, dma)) { + dev_kfree_skb_any(tx_skb); + wiphy_err(priv->hw->wiphy, + "failed to map pci memory!\n"); +@@ -450,10 +450,10 @@ void pcie_tx_done_ndp(struct ieee80211_hw *hw) + "buffer is NULL for tx done ring\n"); + break; + } +- pci_unmap_single(pcie_priv->pdev, ++ dma_unmap_single(&(pcie_priv->pdev)->dev, + desc->pphys_tx_buflist[index], + skb->len, +- PCI_DMA_TODEVICE); ++ DMA_TO_DEVICE); + desc->pphys_tx_buflist[index] = 0; + desc->tx_vbuflist[index] = NULL; + + diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index a6a7ac39e91..4c3cb965c55 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=2.28.3 +PKG_VERSION:=2.28.4 PKG_RELEASE:=1 PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=bdf7c5bbdc338da3edad89b2885d4f8668f9a6fffeba6ec17a60333e36dade6f +PKG_HASH:=578c4dcd15bbff3f5cd56aa07cd4f850fc733634e3d5947be4f7157d5bfd81ac PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=gpl-2.0.txt diff --git a/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch b/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch index c9802eac191..02632cdb4ba 100644 --- a/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch +++ b/package/libs/mbedtls/patches/100-x509-crt-verify-SAN-iPAddress.patch @@ -33,7 +33,7 @@ Signed-off-by: Glenn Strauss #include #else #include -@@ -2995,6 +2999,61 @@ find_parent: +@@ -3001,6 +3005,61 @@ find_parent: } } @@ -95,7 +95,7 @@ Signed-off-by: Glenn Strauss /* * Check for CN match */ -@@ -3015,24 +3074,51 @@ static int x509_crt_check_cn(const mbedt +@@ -3021,24 +3080,51 @@ static int x509_crt_check_cn(const mbedt return -1; } @@ -158,7 +158,7 @@ Signed-off-by: Glenn Strauss } /* -@@ -3043,31 +3129,23 @@ static void x509_crt_verify_name(const m +@@ -3049,31 +3135,23 @@ static void x509_crt_verify_name(const m uint32_t *flags) { const mbedtls_x509_name *name; diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index f147c42ad8c..178dd20fcd1 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=1.2 +PKG_RELEASE:=2 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 49db03ed462..65ae662c4d7 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -1159,9 +1159,6 @@ hostapd_set_bss_options() { append bss_conf "$val" "$N" done - bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)" - append bss_conf "config_id=$bss_md5sum" "$N" - append "$var" "$bss_conf" "$N" return 0 } diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index b52732adcb7..f9f0c31babc 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -66,10 +66,12 @@ function iface_restart(phy, config, old_config) if (err) hostapd.printf(`Failed to create ${bss.ifname} on phy ${phy}: ${err}`); let config_inline = iface_gen_config(phy, config); - if (hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`) < 0) { + + let ubus = hostapd.data.ubus; + ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: true }); + if (hostapd.add_iface(`bss_config=${bss.ifname}:${config_inline}`) < 0) hostapd.printf(`hostapd.add_iface failed for phy ${phy} ifname=${bss.ifname}`); - return; - } + ubus.call("wpa_supplicant", "phy_set_state", { phy: phy, stop: false }); } function array_to_obj(arr, key, start) @@ -123,30 +125,37 @@ function iface_reload_config(phy, config, old_config) if (config.bss[0].ifname != old_config.bss[0].ifname) return false; - let iface = hostapd.interfaces[config.bss[0].ifname]; + let iface_name = config.bss[0].ifname; + let iface = hostapd.interfaces[iface_name]; if (!iface) return false; + let first_bss = hostapd.bss[iface_name]; + if (!first_bss) + return false; + let config_inline = iface_gen_config(phy, config); - bss_reload_psk(iface.bss[0], config.bss[0], old_config.bss[0]); + bss_reload_psk(first_bss, config.bss[0], old_config.bss[0]); if (!is_equal(config.bss[0], old_config.bss[0])) { if (phy_is_fullmac(phy)) return false; + if (config.bss[0].bssid != old_config.bss[0].bssid) + return false; + hostapd.printf(`Reload config for bss '${config.bss[0].ifname}' on phy '${phy}'`); - if (iface.bss[0].set_config(config_inline, 0) < 0) { + if (first_bss.set_config(config_inline, 0) < 0) { hostapd.printf(`Failed to set config`); return false; } } - let bss_list = array_to_obj(iface.bss, "name", 1); let new_cfg = array_to_obj(config.bss, "ifname", 1); let old_cfg = array_to_obj(old_config.bss, "ifname", 1); for (let name in old_cfg) { - let bss = bss_list[name]; + let bss = hostapd.bss[name]; if (!bss) { hostapd.printf(`bss '${name}' not found`); return false; @@ -267,6 +276,9 @@ function iface_load_config(filename) if (!val[0]) continue; + if (val[0] == "bssid") + bss.bssid = val[1]; + if (val[0] == "bss") { bss = config_add_bss(config, val[1]); continue; @@ -305,6 +317,78 @@ let main_obj = { return 0; } }, + apsta_state: { + args: { + phy: "", + up: true, + frequency: 0, + sec_chan_offset: 0, + csa: true, + csa_count: 0, + }, + call: function(req) { + if (req.args.up == null || !req.args.phy) + return libubus.STATUS_INVALID_ARGUMENT; + + let phy = req.args.phy; + let config = hostapd.data.config[phy]; + if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname) + return 0; + + let iface = hostapd.interfaces[config.bss[0].ifname]; + if (!iface) + return 0; + + if (!req.args.up) { + iface.stop(); + return 0; + } + + let freq = req.args.frequency; + if (!freq) + 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); + if (!freq_info) + return libubus.STATUS_UNKNOWN_ERROR; + + let ret; + if (req.args.csa) { + freq_info.csa_count = req.args.csa_count ?? 10; + ret = iface.switch_channel(freq_info); + } else { + iface.stop(); + ret = iface.start(freq_info); + } + if (!ret) + return libubus.STATUS_UNKNOWN_ERROR; + + return 0; + } + }, config_set: { args: { phy: "", diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc index 22cb130e73a..e3a3afcff21 100644 --- a/package/network/services/hostapd/files/wpa_supplicant.uc +++ b/package/network/services/hostapd/files/wpa_supplicant.uc @@ -5,11 +5,16 @@ import { wdev_create, wdev_remove, is_equal, vlist_new } from "common"; let ubus = libubus.connect(); wpas.data.config = {}; +wpas.data.iface_phy = {}; function iface_stop(iface) { let ifname = iface.config.iface; + if (!iface.running) + return; + + delete wpas.data.iface_phy[ifname]; wpas.remove_iface(ifname); wdev_remove(ifname); iface.running = false; @@ -22,6 +27,7 @@ function iface_start(phy, iface) let ifname = iface.config.iface; + wpas.data.iface_phy[ifname] = phy; wdev_remove(ifname); let ret = wdev_create(phy, ifname, iface.config); if (ret) @@ -37,7 +43,7 @@ function iface_cb(new_if, old_if) return; } - if (old_if && old_if.running) + if (old_if) iface_stop(old_if); } @@ -73,6 +79,33 @@ function start_pending(phy_name) } let main_obj = { + phy_set_state: { + args: { + phy: "", + stop: true, + }, + call: function(req) { + if (!req.args.phy || req.args.stop == null) + return libubus.STATUS_INVALID_ARGUMENT; + + let phy = wpas.data.config[req.args.phy]; + if (!phy) + return libubus.STATUS_NOT_FOUND; + + try { + if (req.args.stop) { + for (let ifname in phy.data) + iface_stop(phy.data[ifname]); + } else { + start_pending(req.args.phy); + } + } catch (e) { + wpas.printf(`Error chaging state: ${e}\n${e.stacktrace[0].context}`); + return libubus.STATUS_INVALID_ARGUMENT; + } + return 0; + } + }, config_set: { args: { phy: "", @@ -146,6 +179,46 @@ function iface_event(type, name, data) { ubus.call("service", "event", { type: `wpa_supplicant.${name}.${type}`, data: {} }); } +function iface_hostapd_notify(phy, ifname, iface, state) +{ + let ubus = wpas.data.ubus; + let status = iface.status(); + let msg = { phy: phy }; + + switch (state) { + case "DISCONNECTED": + case "AUTHENTICATING": + msg.up = false; + break; + case "INTERFACE_DISABLED": + case "INACTIVE": + msg.up = true; + break; + case "COMPLETED": + msg.up = true; + msg.frequency = status.frequency; + msg.sec_chan_offset = status.sec_chan_offset; + break; + default: + return; + } + + ubus.call("hostapd", "apsta_state", msg); +} + +function iface_channel_switch(phy, ifname, iface, info) +{ + let msg = { + phy: phy, + up: true, + csa: true, + csa_count: info.csa_count ? info.csa_count - 1 : 0, + frequency: info.frequency, + sec_chan_offset: info.sec_chan_offset, + }; + ubus.call("hostapd", "apsta_state", msg); +} + return { shutdown: function() { for (let phy in wpas.data.config) @@ -157,5 +230,24 @@ return { }, iface_remove: function(name, obj) { iface_event("remove", name); + }, + state: function(ifname, iface, state) { + let phy = wpas.data.iface_phy[ifname]; + if (!phy) { + wpas.printf(`no PHY for ifname ${ifname}`); + return; + } + + iface_hostapd_notify(phy, ifname, iface, state); + }, + event: function(ifname, iface, ev, info) { + let phy = wpas.data.iface_phy[ifname]; + if (!phy) { + wpas.printf(`no PHY for ifname ${ifname}`); + return; + } + + if (ev == "CH_SWITCH_STARTED") + iface_channel_switch(phy, ifname, iface, info); } }; diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch deleted file mode 100644 index ae6cd81ea4d..00000000000 --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -143,6 +143,29 @@ static void hostapd_reload_bss(struct ho - #endif /* CONFIG_NO_RADIUS */ - - ssid = &hapd->conf->ssid; -+ -+ hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq, -+ hapd->iconf->channel, -+ hapd->iconf->enable_edmg, -+ hapd->iconf->edmg_channel, -+ hapd->iconf->ieee80211n, -+ hapd->iconf->ieee80211ac, -+ hapd->iconf->ieee80211ax, -+ hapd->iconf->ieee80211be, -+ hapd->iconf->secondary_channel, -+ hostapd_get_oper_chwidth(hapd->iconf), -+ hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf), -+ hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf)); -+ -+ if (hapd->iface->current_mode) { -+ if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) { -+ wpa_printf(MSG_ERROR, "Failed to prepare rates table."); -+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, -+ HOSTAPD_LEVEL_WARNING, -+ "Failed to prepare rates table."); -+ } -+ } -+ - if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next && - ssid->wpa_passphrase_set && ssid->wpa_passphrase) { - /* -@@ -251,6 +274,7 @@ int hostapd_reload_config(struct hostapd - struct hostapd_data *hapd = iface->bss[0]; - struct hostapd_config *newconf, *oldconf; - size_t j; -+ int i; - - if (iface->config_fname == NULL) { - /* Only in-memory config in use - assume it has been updated */ -@@ -301,6 +325,17 @@ int hostapd_reload_config(struct hostapd - } - iface->conf = newconf; - -+ for (i = 0; i < iface->num_hw_features; i++) { -+ struct hostapd_hw_modes *mode = &iface->hw_features[i]; -+ if (mode->mode == iface->conf->hw_mode) { -+ iface->current_mode = mode; -+ break; -+ } -+ } -+ -+ if (iface->conf->channel) -+ iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel); -+ - for (j = 0; j < iface->num_bss; j++) { - hapd = iface->bss[j]; - if (!hapd->conf->config_id || !newconf->bss[j]->config_id || -@@ -308,21 +343,6 @@ int hostapd_reload_config(struct hostapd - newconf->bss[j]->config_id) != 0) - hostapd_clear_old_bss(hapd); - hapd->iconf = newconf; -- hapd->iconf->channel = oldconf->channel; -- hapd->iconf->acs = oldconf->acs; -- hapd->iconf->secondary_channel = oldconf->secondary_channel; -- hapd->iconf->ieee80211n = oldconf->ieee80211n; -- hapd->iconf->ieee80211ac = oldconf->ieee80211ac; -- hapd->iconf->ht_capab = oldconf->ht_capab; -- hapd->iconf->vht_capab = oldconf->vht_capab; -- hostapd_set_oper_chwidth(hapd->iconf, -- hostapd_get_oper_chwidth(oldconf)); -- hostapd_set_oper_centr_freq_seg0_idx( -- hapd->iconf, -- hostapd_get_oper_centr_freq_seg0_idx(oldconf)); -- hostapd_set_oper_centr_freq_seg1_idx( -- hapd->iconf, -- hostapd_get_oper_centr_freq_seg1_idx(oldconf)); - hapd->conf = newconf->bss[j]; - hostapd_reload_bss(hapd); - } diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch deleted file mode 100644 index 4d85ea11f90..00000000000 --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -68,6 +68,7 @@ - #include "fst/fst_ctrl_iface.h" - #include "config_file.h" - #include "ctrl_iface.h" -+#include "config_file.h" - - - #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256 -@@ -83,6 +84,7 @@ static void hostapd_ctrl_iface_send(stru - enum wpa_msg_type type, - const char *buf, size_t len); - -+static char *reload_opts = NULL; - - static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd, - struct sockaddr_storage *from, -@@ -134,6 +136,61 @@ static int hostapd_ctrl_iface_new_sta(st - return 0; - } - -+static char *get_option(char *opt, char *str) -+{ -+ int len = strlen(str); -+ -+ if (!strncmp(opt, str, len)) -+ return opt + len; -+ else -+ return NULL; -+} -+ -+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname) -+{ -+ struct hostapd_config *conf; -+ char *opt, *val; -+ -+ conf = hostapd_config_read(fname); -+ if (!conf) -+ return NULL; -+ -+ for (opt = strtok(reload_opts, " "); -+ opt; -+ opt = strtok(NULL, " ")) { -+ -+ if ((val = get_option(opt, "channel="))) -+ conf->channel = atoi(val); -+ else if ((val = get_option(opt, "ht_capab="))) -+ conf->ht_capab = atoi(val); -+ else if ((val = get_option(opt, "ht_capab_mask="))) -+ conf->ht_capab &= atoi(val); -+ else if ((val = get_option(opt, "sec_chan="))) -+ conf->secondary_channel = atoi(val); -+ else if ((val = get_option(opt, "hw_mode="))) -+ conf->hw_mode = atoi(val); -+ else if ((val = get_option(opt, "ieee80211n="))) -+ conf->ieee80211n = atoi(val); -+ else -+ break; -+ } -+ -+ return conf; -+} -+ -+static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt) -+{ -+ struct hostapd_config * (*config_read_cb)(const char *config_fname); -+ struct hostapd_iface *iface = hapd->iface; -+ -+ config_read_cb = iface->interfaces->config_read_cb; -+ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; -+ reload_opts = txt; -+ -+ hostapd_reload_config(iface); -+ -+ iface->interfaces->config_read_cb = config_read_cb; -+} - - #ifdef NEED_AP_MLME - static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd, -@@ -3564,6 +3621,8 @@ static int hostapd_ctrl_iface_receive_pr - } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { - reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply, - reply_size); -+ } else if (os_strncmp(buf, "UPDATE ", 7) == 0) { -+ hostapd_ctrl_iface_update(hapd, buf + 7); - } else if (os_strcmp(buf, "ERP_FLUSH") == 0) { - ieee802_1x_erp_flush(hapd); - #ifdef RADIUS_SERVER ---- a/src/ap/ctrl_iface_ap.c -+++ b/src/ap/ctrl_iface_ap.c -@@ -1023,7 +1023,13 @@ int hostapd_parse_csa_settings(const cha - - int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd) - { -- return hostapd_drv_stop_ap(hapd); -+ struct hostapd_iface *iface = hapd->iface; -+ int i; -+ -+ for (i = 0; i < iface->num_bss; i++) -+ hostapd_drv_stop_ap(iface->bss[i]); -+ -+ return 0; - } - - diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch deleted file mode 100644 index 3baad2a52e5..00000000000 --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch +++ /dev/null @@ -1,392 +0,0 @@ ---- a/wpa_supplicant/Makefile -+++ b/wpa_supplicant/Makefile -@@ -126,6 +126,8 @@ OBJS_c += ../src/utils/common.o - OBJS_c += ../src/common/cli.o - OBJS += wmm_ac.o - -+OBJS += ../src/common/wpa_ctrl.o -+ - ifndef CONFIG_OS - ifdef CONFIG_NATIVE_WINDOWS - CONFIG_OS=win32 ---- a/wpa_supplicant/bss.c -+++ b/wpa_supplicant/bss.c -@@ -11,6 +11,7 @@ - #include "utils/common.h" - #include "utils/eloop.h" - #include "common/ieee802_11_defs.h" -+#include "common/ieee802_11_common.h" - #include "drivers/driver.h" - #include "eap_peer/eap.h" - #include "wpa_supplicant_i.h" -@@ -283,6 +284,10 @@ void calculate_update_time(const struct - static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, - struct os_reltime *fetch_time) - { -+ struct ieee80211_ht_capabilities *capab; -+ struct ieee80211_ht_operation *oper; -+ struct ieee802_11_elems elems; -+ - dst->flags = src->flags; - os_memcpy(dst->bssid, src->bssid, ETH_ALEN); - dst->freq = src->freq; -@@ -296,6 +301,15 @@ static void wpa_bss_copy_res(struct wpa_ - dst->est_throughput = src->est_throughput; - dst->snr = src->snr; - -+ memset(&elems, 0, sizeof(elems)); -+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0); -+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities; -+ oper = (struct ieee80211_ht_operation *) elems.ht_operation; -+ if (capab) -+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info); -+ if (oper) -+ dst->ht_param = oper->ht_param; -+ - calculate_update_time(fetch_time, src->age, &dst->last_update); - } - ---- a/wpa_supplicant/bss.h -+++ b/wpa_supplicant/bss.h -@@ -94,6 +94,10 @@ struct wpa_bss { - u8 ssid[SSID_MAX_LEN]; - /** Length of SSID */ - size_t ssid_len; -+ /** HT capabilities */ -+ u16 ht_capab; -+ /* Five octets of HT Operation Information */ -+ u8 ht_param; - /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */ - int freq; - /** Beacon interval in TUs (host byte order) */ ---- a/wpa_supplicant/main.c -+++ b/wpa_supplicant/main.c -@@ -35,7 +35,7 @@ static void usage(void) - "vW] [-P] " - "[-g] \\\n" - " [-G] \\\n" -- " -i -c [-C] [-D] " -+ " -i -c [-C] [-D] [-H] " - "[-p] \\\n" - " [-b] [-e]" - #ifdef CONFIG_DEBUG_FILE -@@ -75,6 +75,7 @@ static void usage(void) - " -g = global ctrl_interface\n" - " -G = global ctrl_interface group\n" - " -h = show this help text\n" -+ " -H = connect to a hostapd instance to manage state changes\n" - " -i = interface name\n" - " -I = additional configuration file\n" - " -K = include keys (passwords, etc.) in debug output\n" -@@ -202,7 +203,7 @@ int main(int argc, char *argv[]) - - for (;;) { - c = getopt(argc, argv, -- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW"); -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW"); - if (c < 0) - break; - switch (c) { -@@ -249,6 +250,9 @@ int main(int argc, char *argv[]) - usage(); - exitcode = 0; - goto out; -+ case 'H': -+ iface->hostapd_ctrl = optarg; -+ break; - case 'i': - iface->ifname = optarg; - break; ---- a/wpa_supplicant/wpa_supplicant.c -+++ b/wpa_supplicant/wpa_supplicant.c -@@ -131,6 +131,54 @@ static void wpas_update_fils_connect_par - static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s); - #endif /* CONFIG_OWE */ - -+static int hostapd_stop(struct wpa_supplicant *wpa_s) -+{ -+ const char *cmd = "STOP_AP"; -+ char buf[256]; -+ size_t len = sizeof(buf); -+ -+ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) { -+ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n"); -+ return -1; -+ } -+ return 0; -+} -+ -+static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) -+{ -+ char *cmd = NULL; -+ char buf[256]; -+ size_t len = sizeof(buf); -+ enum hostapd_hw_mode hw_mode; -+ u8 channel; -+ int sec_chan = 0; -+ int ret; -+ -+ if (!bss) -+ return -1; -+ -+ if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) { -+ int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK; -+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) -+ sec_chan = 1; -+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) -+ sec_chan = -1; -+ } -+ -+ hw_mode = ieee80211_freq_to_chan(bss->freq, &channel); -+ if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d", -+ channel, sec_chan, hw_mode) < 0) -+ return -1; -+ -+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); -+ free(cmd); -+ -+ if (ret < 0) { -+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); -+ return -1; -+ } -+ return 0; -+} - - #ifdef CONFIG_WEP - /* Configure default/group WEP keys for static WEP */ -@@ -1026,6 +1074,8 @@ void wpa_supplicant_set_state(struct wpa - - sme_sched_obss_scan(wpa_s, 1); - -+ if (wpa_s->hostapd) -+ hostapd_reload(wpa_s, wpa_s->current_bss); - #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL) - if (!fils_hlp_sent && ssid && ssid->eap.erp) - update_fils_connect_params = true; -@@ -1036,6 +1086,8 @@ void wpa_supplicant_set_state(struct wpa - #endif /* CONFIG_OWE */ - } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || - state == WPA_ASSOCIATED) { -+ if (wpa_s->hostapd) -+ hostapd_stop(wpa_s); - wpa_s->new_connection = 1; - wpa_drv_set_operstate(wpa_s, 0); - #ifndef IEEE8021X_EAPOL -@@ -2537,6 +2589,8 @@ void wpa_supplicant_associate(struct wpa - return; - } - wpa_s->current_bss = bss; -+ if (wpa_s->hostapd) -+ hostapd_reload(wpa_s, wpa_s->current_bss); - #else /* CONFIG_MESH */ - wpa_msg(wpa_s, MSG_ERROR, - "mesh mode support not included in the build"); -@@ -7037,6 +7091,16 @@ static int wpa_supplicant_init_iface(str - sizeof(wpa_s->bridge_ifname)); - } - -+ if (iface->hostapd_ctrl) { -+ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl); -+ if (!wpa_s->hostapd) { -+ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n"); -+ return -1; -+ } -+ if (hostapd_stop(wpa_s) < 0) -+ return -1; -+ } -+ - /* RSNA Supplicant Key Management - INITIALIZE */ - eapol_sm_notify_portEnabled(wpa_s->eapol, false); - eapol_sm_notify_portValid(wpa_s->eapol, false); -@@ -7379,6 +7443,11 @@ static void wpa_supplicant_deinit_iface( - if (terminate) - wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING); - -+ if (wpa_s->hostapd) { -+ wpa_ctrl_close(wpa_s->hostapd); -+ wpa_s->hostapd = NULL; -+ } -+ - wpa_supplicant_ctrl_iface_deinit(wpa_s, wpa_s->ctrl_iface); - wpa_s->ctrl_iface = NULL; - ---- a/wpa_supplicant/wpa_supplicant_i.h -+++ b/wpa_supplicant/wpa_supplicant_i.h -@@ -106,6 +106,11 @@ struct wpa_interface { - const char *ifname; - - /** -+ * hostapd_ctrl - path to hostapd control socket for notification -+ */ -+ const char *hostapd_ctrl; -+ -+ /** - * bridge_ifname - Optional bridge interface name - * - * If the driver interface (ifname) is included in a Linux bridge -@@ -665,6 +670,8 @@ struct wpa_supplicant { - #endif /* CONFIG_CTRL_IFACE_BINDER */ - char bridge_ifname[16]; - -+ struct wpa_ctrl *hostapd; -+ - char *confname; - char *confanother; - ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -2751,6 +2751,12 @@ static int hostapd_ctrl_iface_chan_switc - return 0; - } - -+ if (os_strstr(pos, " auto-ht")) { -+ settings.freq_params.ht_enabled = iface->conf->ieee80211n; -+ settings.freq_params.vht_enabled = iface->conf->ieee80211ac; -+ settings.freq_params.he_enabled = iface->conf->ieee80211ax; -+ } -+ - for (i = 0; i < iface->num_bss; i++) { - - /* Save CHAN_SWITCH VHT, HE, and EHT config */ ---- a/src/ap/beacon.c -+++ b/src/ap/beacon.c -@@ -2108,11 +2108,6 @@ static int __ieee802_11_set_beacon(struc - return -1; - } - -- if (hapd->csa_in_progress) { -- wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period"); -- return -1; -- } -- - hapd->beacon_set_done = 1; - - if (ieee802_11_build_ap_params(hapd, ¶ms) < 0) ---- a/wpa_supplicant/events.c -+++ b/wpa_supplicant/events.c -@@ -5345,6 +5345,60 @@ static void wpas_link_reconfig(struct wp - } - - -+static void -+supplicant_ch_switch_started(struct wpa_supplicant *wpa_s, -+ union wpa_event_data *data) -+{ -+ char buf[256]; -+ size_t len = sizeof(buf); -+ char *cmd = NULL; -+ int width = 20; -+ int ret; -+ -+ if (!wpa_s->hostapd) -+ return; -+ -+ wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_CHANNEL_SWITCH -+ "count=%d freq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d", -+ data->ch_switch.count, -+ data->ch_switch.freq, -+ data->ch_switch.ht_enabled, -+ data->ch_switch.ch_offset, -+ channel_width_to_string(data->ch_switch.ch_width), -+ data->ch_switch.cf1, -+ data->ch_switch.cf2); -+ -+ switch (data->ch_switch.ch_width) { -+ case CHAN_WIDTH_20_NOHT: -+ case CHAN_WIDTH_20: -+ width = 20; -+ break; -+ case CHAN_WIDTH_40: -+ width = 40; -+ break; -+ case CHAN_WIDTH_80: -+ width = 80; -+ break; -+ case CHAN_WIDTH_160: -+ case CHAN_WIDTH_80P80: -+ width = 160; -+ break; -+ } -+ -+ asprintf(&cmd, "CHAN_SWITCH %d %d sec_channel_offset=%d center_freq1=%d center_freq2=%d, bandwidth=%d auto-ht\n", -+ data->ch_switch.count - 1, -+ data->ch_switch.freq, -+ data->ch_switch.ch_offset, -+ data->ch_switch.cf1, -+ data->ch_switch.cf2, -+ width); -+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL); -+ free(cmd); -+ -+ if (ret < 0) -+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n"); -+} -+ - void supplicant_event(void *ctx, enum wpa_event_type event, - union wpa_event_data *data) - { -@@ -5697,8 +5751,10 @@ void supplicant_event(void *ctx, enum wp - channel_width_to_string(data->ch_switch.ch_width), - data->ch_switch.cf1, - data->ch_switch.cf2); -- if (event == EVENT_CH_SWITCH_STARTED) -+ if (event == EVENT_CH_SWITCH_STARTED) { -+ supplicant_ch_switch_started(wpa_s, data); - break; -+ } - - wpa_s->assoc_freq = data->ch_switch.freq; - wpa_s->current_ssid->frequency = data->ch_switch.freq; ---- a/src/drivers/driver.h -+++ b/src/drivers/driver.h -@@ -6421,6 +6421,7 @@ union wpa_event_data { - - /** - * struct ch_switch -+ * @count: Count until channel switch activates - * @freq: Frequency of new channel in MHz - * @ht_enabled: Whether this is an HT channel - * @ch_offset: Secondary channel offset -@@ -6431,6 +6432,7 @@ union wpa_event_data { - * @punct_bitmap: Puncturing bitmap - */ - struct ch_switch { -+ int count; - int freq; - int ht_enabled; - int ch_offset; ---- a/src/drivers/driver_nl80211_event.c -+++ b/src/drivers/driver_nl80211_event.c -@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct - struct nlattr *bw, struct nlattr *cf1, - struct nlattr *cf2, - struct nlattr *punct_bitmap, -+ struct nlattr *count, - int finished) - { - struct i802_bss *bss; -@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct - data.ch_switch.cf1 = nla_get_u32(cf1); - if (cf2) - data.ch_switch.cf2 = nla_get_u32(cf2); -+ if (count) -+ data.ch_switch.count = nla_get_u32(count); - - if (finished) - bss->flink->freq = data.ch_switch.freq; -@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct - tb[NL80211_ATTR_CENTER_FREQ1], - tb[NL80211_ATTR_CENTER_FREQ2], - tb[NL80211_ATTR_PUNCT_BITMAP], -+ tb[NL80211_ATTR_CH_SWITCH_COUNT], - 0); - break; - case NL80211_CMD_CH_SWITCH_NOTIFY: -@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct - tb[NL80211_ATTR_CENTER_FREQ1], - tb[NL80211_ATTR_CENTER_FREQ2], - tb[NL80211_ATTR_PUNCT_BITMAP], -+ NULL, - 1); - break; - case NL80211_CMD_DISCONNECT: diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch index 456599db092..54a736fe915 100644 --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch @@ -12,7 +12,7 @@ else --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -3377,6 +3377,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3314,6 +3314,7 @@ static int hostapd_ctrl_iface_receive_pr reply_size); } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) { reply_len = hostapd_drv_status(hapd, reply, reply_size); @@ -20,7 +20,7 @@ } else if (os_strcmp(buf, "MIB") == 0) { reply_len = ieee802_11_get_mib(hapd, reply, reply_size); if (reply_len >= 0) { -@@ -3418,6 +3419,7 @@ static int hostapd_ctrl_iface_receive_pr +@@ -3355,6 +3356,7 @@ static int hostapd_ctrl_iface_receive_pr } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) { reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply, reply_size); @@ -30,7 +30,7 @@ reply_len = -1; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -985,6 +985,9 @@ ifdef CONFIG_FILS +@@ -983,6 +983,9 @@ ifdef CONFIG_FILS OBJS += ../src/ap/fils_hlp.o endif ifdef CONFIG_CTRL_IFACE diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch index 786b83d3151..3b28b6e7524 100644 --- a/package/network/services/hostapd/patches/420-indicate-features.patch +++ b/package/network/services/hostapd/patches/420-indicate-features.patch @@ -37,16 +37,16 @@ #include "crypto/crypto.h" #include "fst/fst.h" #include "wpa_supplicant_i.h" -@@ -203,7 +204,7 @@ int main(int argc, char *argv[]) +@@ -202,7 +203,7 @@ int main(int argc, char *argv[]) for (;;) { c = getopt(argc, argv, -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW"); -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W"); +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW"); ++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W"); if (c < 0) break; switch (c) { -@@ -306,8 +307,12 @@ int main(int argc, char *argv[]) +@@ -302,8 +303,12 @@ int main(int argc, char *argv[]) break; #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ case 'v': diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch deleted file mode 100644 index 45886896ee9..00000000000 --- a/package/network/services/hostapd/patches/450-scan_wait.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -39,6 +39,8 @@ struct hapd_global { - }; - - static struct hapd_global global; -+static int daemonize = 0; -+static char *pid_file = NULL; - - - #ifndef CONFIG_NO_HOSTAPD_LOGGER -@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx, - } - #endif /* CONFIG_NO_HOSTAPD_LOGGER */ - -+static void hostapd_setup_complete_cb(void *ctx) -+{ -+ if (daemonize && os_daemonize(pid_file)) { -+ perror("daemon"); -+ return; -+ } -+ daemonize = 0; -+} - - /** - * hostapd_driver_init - Preparate driver interface -@@ -217,6 +227,8 @@ static int hostapd_driver_init(struct ho - } - #endif /* CONFIG_IEEE80211BE */ - -+ hapd->setup_complete_cb = hostapd_setup_complete_cb; -+ - /* Initialize the driver interface */ - if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5])) - b = NULL; -@@ -497,8 +509,6 @@ static void hostapd_global_deinit(const - #endif /* CONFIG_NATIVE_WINDOWS */ - - eap_server_unregister_methods(); -- -- os_daemonize_terminate(pid_file); - } - - -@@ -524,18 +534,6 @@ static int hostapd_global_run(struct hap - } - #endif /* EAP_SERVER_TNC */ - -- if (daemonize) { -- if (os_daemonize(pid_file)) { -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno)); -- return -1; -- } -- if (eloop_sock_requeue()) { -- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s", -- strerror(errno)); -- return -1; -- } -- } -- - eloop_run(); - - return 0; -@@ -739,8 +737,7 @@ int main(int argc, char *argv[]) - struct hapd_interfaces interfaces; - int ret = 1; - size_t i, j; -- int c, debug = 0, daemonize = 0; -- char *pid_file = NULL; -+ int c, debug = 0; - const char *log_file = NULL; - const char *entropy_file = NULL; - char **bss_config = NULL, **tmp_bss; diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index 4c728681393..e50c609d976 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -174,7 +174,7 @@ Signed-hostap: Antonio Quartulli * macsec_policy - Determines the policy for MACsec secure session --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -4203,6 +4203,12 @@ static void wpas_start_assoc_cb(struct w +@@ -4149,6 +4149,12 @@ static void wpas_start_assoc_cb(struct w params.beacon_int = ssid->beacon_int; else params.beacon_int = wpa_s->conf->beacon_int; diff --git a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch index c7e8cf25ce8..4d7d85f4ab8 100644 --- a/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch +++ b/package/network/services/hostapd/patches/464-fix-mesh-obss-check.patch @@ -1,6 +1,6 @@ --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -3094,6 +3094,10 @@ void ibss_mesh_setup_freq(struct wpa_sup +@@ -3040,6 +3040,10 @@ void ibss_mesh_setup_freq(struct wpa_sup freq->freq = ssid->frequency; diff --git a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch index 046da42ab8b..67312c5004a 100644 --- a/package/network/services/hostapd/patches/500-lto-jobserver-support.patch +++ b/package/network/services/hostapd/patches/500-lto-jobserver-support.patch @@ -20,7 +20,7 @@ NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -2039,31 +2039,31 @@ wpa_supplicant_multi.a: .config $(BCHECK +@@ -2037,31 +2037,31 @@ wpa_supplicant_multi.a: .config $(BCHECK @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index f420c18644e..5b2745a3bee 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -41,7 +41,7 @@ struct hostapd_iface * hostapd_alloc_iface(void); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -455,6 +455,7 @@ void hostapd_free_hapd_data(struct hosta +@@ -435,6 +435,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -49,7 +49,7 @@ accounting_deinit(hapd); hostapd_deinit_wpa(hapd); vlan_deinit(hapd); -@@ -1207,6 +1208,8 @@ static int hostapd_start_beacon(struct h +@@ -1187,6 +1188,8 @@ static int hostapd_start_beacon(struct h if (hapd->driver && hapd->driver->set_operstate) hapd->driver->set_operstate(hapd->drv_priv, 1); @@ -58,7 +58,7 @@ return 0; } -@@ -2295,6 +2298,7 @@ static int hostapd_setup_interface_compl +@@ -2275,6 +2278,7 @@ static int hostapd_setup_interface_compl if (err) goto fail; @@ -66,7 +66,7 @@ wpa_printf(MSG_DEBUG, "Completing interface initialization"); if (iface->freq) { #ifdef NEED_AP_MLME -@@ -2514,6 +2518,7 @@ dfs_offload: +@@ -2494,6 +2498,7 @@ dfs_offload: fail: wpa_printf(MSG_ERROR, "Interface initialization failed"); @@ -74,7 +74,7 @@ if (iface->is_no_ir) { hostapd_set_state(iface, HAPD_IFACE_NO_IR); -@@ -3004,6 +3009,7 @@ void hostapd_interface_deinit_free(struc +@@ -2984,6 +2989,7 @@ void hostapd_interface_deinit_free(struc (unsigned int) iface->conf->num_bss); driver = iface->bss[0]->driver; drv_priv = iface->bss[0]->drv_priv; @@ -322,7 +322,7 @@ --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -194,6 +194,13 @@ ifdef CONFIG_EAPOL_TEST +@@ -192,6 +192,13 @@ ifdef CONFIG_EAPOL_TEST CFLAGS += -Werror -DEAPOL_TEST endif @@ -336,7 +336,7 @@ ifdef CONFIG_CODE_COVERAGE CFLAGS += -O0 -fprofile-arcs -ftest-coverage LIBS += -lgcov -@@ -989,6 +996,9 @@ ifdef CONFIG_CTRL_IFACE_MIB +@@ -987,6 +994,9 @@ ifdef CONFIG_CTRL_IFACE_MIB CFLAGS += -DCONFIG_CTRL_IFACE_MIB endif OBJS += ../src/ap/ctrl_iface_ap.o @@ -348,7 +348,7 @@ CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7635,6 +7635,8 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -7566,6 +7566,8 @@ struct wpa_supplicant * wpa_supplicant_a } #endif /* CONFIG_P2P */ @@ -357,7 +357,7 @@ return wpa_s; } -@@ -7661,6 +7663,8 @@ int wpa_supplicant_remove_iface(struct w +@@ -7592,6 +7594,8 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -366,7 +366,7 @@ /* Remove interface from the global list of interfaces */ prev = global->ifaces; if (prev == wpa_s) { -@@ -8007,8 +8011,12 @@ int wpa_supplicant_run(struct wpa_global +@@ -7938,8 +7942,12 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -389,7 +389,7 @@ extern const char *const wpa_supplicant_version; extern const char *const wpa_supplicant_license; -@@ -324,6 +325,8 @@ struct wpa_global { +@@ -319,6 +320,8 @@ struct wpa_global { #endif /* CONFIG_WIFI_DISPLAY */ struct psk_list_entry *add_psk; /* From group formation */ @@ -398,7 +398,7 @@ }; -@@ -655,6 +658,7 @@ struct wpa_supplicant { +@@ -650,6 +653,7 @@ struct wpa_supplicant { unsigned char own_addr[ETH_ALEN]; unsigned char perm_addr[ETH_ALEN]; char ifname[100]; @@ -427,16 +427,16 @@ --- a/wpa_supplicant/main.c +++ b/wpa_supplicant/main.c -@@ -204,7 +204,7 @@ int main(int argc, char *argv[]) +@@ -203,7 +203,7 @@ int main(int argc, char *argv[]) for (;;) { c = getopt(argc, argv, -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W"); -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:nNo:O:p:P:qsTtuv::W"); +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W"); ++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:nNo:O:p:P:qsTtuv::W"); if (c < 0) break; switch (c) { -@@ -272,6 +272,9 @@ int main(int argc, char *argv[]) +@@ -268,6 +268,9 @@ int main(int argc, char *argv[]) params.conf_p2p_dev = optarg; break; #endif /* CONFIG_P2P */ diff --git a/package/network/services/hostapd/patches/601-ucode_support.patch b/package/network/services/hostapd/patches/601-ucode_support.patch index ff1a9ddc0d3..e0bbf1337da 100644 --- a/package/network/services/hostapd/patches/601-ucode_support.patch +++ b/package/network/services/hostapd/patches/601-ucode_support.patch @@ -26,7 +26,7 @@ ifdef CONFIG_CODE_COVERAGE --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -991,6 +991,7 @@ int main(int argc, char *argv[]) +@@ -994,6 +994,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); @@ -34,7 +34,7 @@ if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); -@@ -1000,6 +1001,7 @@ int main(int argc, char *argv[]) +@@ -1003,6 +1004,7 @@ int main(int argc, char *argv[]) ret = 0; out: @@ -79,18 +79,27 @@ void *owner; char *config_fname; struct hostapd_config *conf; +@@ -706,6 +713,8 @@ struct hostapd_iface * hostapd_init(stru + struct hostapd_iface * + hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, + const char *config_fname, int debug); ++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon); ++void hostapd_bss_deinit(struct hostapd_data *hapd); + void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + int reassoc); + void hostapd_interface_deinit_free(struct hostapd_iface *iface); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -276,6 +276,8 @@ int hostapd_reload_config(struct hostapd +@@ -252,6 +252,8 @@ int hostapd_reload_config(struct hostapd + struct hostapd_config *newconf, *oldconf; size_t j; - int i; -+ hostapd_ucode_reload_bss(hapd, reconf); ++ hostapd_ucode_reload_bss(hapd); + if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ hostapd_clear_old(iface); -@@ -455,6 +457,7 @@ void hostapd_free_hapd_data(struct hosta +@@ -435,6 +437,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); @@ -98,7 +107,7 @@ hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); -@@ -619,6 +622,7 @@ void hostapd_cleanup_iface_partial(struc +@@ -599,6 +602,7 @@ void hostapd_cleanup_iface_partial(struc static void hostapd_cleanup_iface(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); @@ -106,7 +115,7 @@ eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, NULL); -@@ -1209,6 +1213,7 @@ static int hostapd_start_beacon(struct h +@@ -1189,6 +1193,7 @@ static int hostapd_start_beacon(struct h hapd->driver->set_operstate(hapd->drv_priv, 1); hostapd_ubus_add_bss(hapd); @@ -114,9 +123,28 @@ return 0; } +@@ -1211,8 +1216,7 @@ static int hostapd_start_beacon(struct h + * initialized. Most of the modules that are initialized here will be + * deinitialized in hostapd_cleanup(). + */ +-static int hostapd_setup_bss(struct hostapd_data *hapd, int first, +- bool start_beacon) ++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon) + { + struct hostapd_bss_config *conf = hapd->conf; + u8 ssid[SSID_MAX_LEN + 1]; +@@ -2698,7 +2702,7 @@ hostapd_alloc_bss_data(struct hostapd_if + } + + +-static void hostapd_bss_deinit(struct hostapd_data *hapd) ++void hostapd_bss_deinit(struct hostapd_data *hapd) + { + if (!hapd) + return; --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile -@@ -197,8 +197,20 @@ endif +@@ -195,8 +195,20 @@ endif ifdef CONFIG_UBUS CFLAGS += -DUBUS_SUPPORT OBJS += ubus.o @@ -138,7 +166,7 @@ endif ifdef CONFIG_CODE_COVERAGE -@@ -999,6 +1011,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o +@@ -997,6 +1009,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o ifdef CONFIG_UBUS OBJS += ../src/ap/ubus.o endif @@ -150,7 +178,15 @@ CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c -@@ -7636,6 +7636,7 @@ struct wpa_supplicant * wpa_supplicant_a +@@ -1044,6 +1044,7 @@ void wpa_supplicant_set_state(struct wpa + sme_sched_obss_scan(wpa_s, 0); + } + wpa_s->wpa_state = state; ++ wpas_ucode_update_state(wpa_s); + + #ifdef CONFIG_BGSCAN + if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid) +@@ -7567,6 +7568,7 @@ struct wpa_supplicant * wpa_supplicant_a #endif /* CONFIG_P2P */ wpas_ubus_add_bss(wpa_s); @@ -158,7 +194,7 @@ return wpa_s; } -@@ -7663,6 +7664,7 @@ int wpa_supplicant_remove_iface(struct w +@@ -7594,6 +7596,7 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ @@ -166,7 +202,7 @@ wpas_ubus_free_bss(wpa_s); /* Remove interface from the global list of interfaces */ -@@ -7973,6 +7975,7 @@ struct wpa_global * wpa_supplicant_init( +@@ -7904,6 +7907,7 @@ struct wpa_global * wpa_supplicant_init( eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0, wpas_periodic, global, NULL); @@ -174,7 +210,7 @@ return global; } -@@ -8011,12 +8014,8 @@ int wpa_supplicant_run(struct wpa_global +@@ -7942,12 +7946,8 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); @@ -187,7 +223,7 @@ return 0; } -@@ -8049,6 +8048,8 @@ void wpa_supplicant_deinit(struct wpa_gl +@@ -7980,6 +7980,8 @@ void wpa_supplicant_deinit(struct wpa_gl wpas_notify_supplicant_deinitialized(global); @@ -206,7 +242,7 @@ extern const char *const wpa_supplicant_version; extern const char *const wpa_supplicant_license; -@@ -659,6 +660,7 @@ struct wpa_supplicant { +@@ -654,6 +655,7 @@ struct wpa_supplicant { unsigned char perm_addr[ETH_ALEN]; char ifname[100]; struct wpas_ubus_bss ubus; @@ -216,7 +252,7 @@ #endif /* CONFIG_MATCH_IFACE */ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c -@@ -4921,6 +4921,7 @@ try_again: +@@ -4856,6 +4856,7 @@ try_again: return -1; } @@ -224,7 +260,7 @@ wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); return 0; -@@ -5022,6 +5023,7 @@ fail: +@@ -4957,6 +4958,7 @@ fail: os_free(fname); interface->global_ctrl_sock = s; @@ -232,3 +268,66 @@ eloop_register_read_sock(s, hostapd_global_ctrl_iface_receive, interface, NULL); +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -6426,6 +6426,7 @@ union wpa_event_data { + + /** + * struct ch_switch ++ * @count: Count until channel switch activates + * @freq: Frequency of new channel in MHz + * @ht_enabled: Whether this is an HT channel + * @ch_offset: Secondary channel offset +@@ -6436,6 +6437,7 @@ union wpa_event_data { + * @punct_bitmap: Puncturing bitmap + */ + struct ch_switch { ++ int count; + int freq; + int ht_enabled; + int ch_offset; +--- a/src/drivers/driver_nl80211_event.c ++++ b/src/drivers/driver_nl80211_event.c +@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct + struct nlattr *bw, struct nlattr *cf1, + struct nlattr *cf2, + struct nlattr *punct_bitmap, ++ struct nlattr *count, + int finished) + { + struct i802_bss *bss; +@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct + data.ch_switch.cf1 = nla_get_u32(cf1); + if (cf2) + data.ch_switch.cf2 = nla_get_u32(cf2); ++ if (count) ++ data.ch_switch.count = nla_get_u32(count); + + if (finished) + bss->flink->freq = data.ch_switch.freq; +@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct + tb[NL80211_ATTR_CENTER_FREQ1], + tb[NL80211_ATTR_CENTER_FREQ2], + tb[NL80211_ATTR_PUNCT_BITMAP], ++ tb[NL80211_ATTR_CH_SWITCH_COUNT], + 0); + break; + case NL80211_CMD_CH_SWITCH_NOTIFY: +@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct + tb[NL80211_ATTR_CENTER_FREQ1], + tb[NL80211_ATTR_CENTER_FREQ2], + tb[NL80211_ATTR_PUNCT_BITMAP], ++ NULL, + 1); + break; + case NL80211_CMD_DISCONNECT: +--- a/wpa_supplicant/events.c ++++ b/wpa_supplicant/events.c +@@ -5381,6 +5381,7 @@ void supplicant_event(void *ctx, enum wp + event_to_string(event), event); + #endif /* CONFIG_NO_STDOUT_DEBUG */ + ++ wpas_ucode_event(wpa_s, event, data); + switch (event) { + case EVENT_AUTH: + #ifdef CONFIG_FST diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch deleted file mode 100644 index c0e7e4d16e3..00000000000 --- a/package/network/services/hostapd/patches/700-wifi-reload.patch +++ /dev/null @@ -1,232 +0,0 @@ ---- a/hostapd/config_file.c -+++ b/hostapd/config_file.c -@@ -2420,6 +2420,8 @@ static int hostapd_config_fill(struct ho - bss->isolate = atoi(pos); - } else if (os_strcmp(buf, "ap_max_inactivity") == 0) { - bss->ap_max_inactivity = atoi(pos); -+ } else if (os_strcmp(buf, "config_id") == 0) { -+ bss->config_id = os_strdup(pos); - } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) { - bss->skip_inactivity_poll = atoi(pos); - } else if (os_strcmp(buf, "config_id") == 0) { -@@ -3130,6 +3132,8 @@ static int hostapd_config_fill(struct ho - } - } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) { - conf->acs_exclude_dfs = atoi(pos); -+ } else if (os_strcmp(buf, "radio_config_id") == 0) { -+ conf->config_id = os_strdup(pos); - } else if (os_strcmp(buf, "op_class") == 0) { - conf->op_class = atoi(pos); - } else if (os_strcmp(buf, "channel") == 0) { ---- a/src/ap/ap_config.c -+++ b/src/ap/ap_config.c -@@ -998,6 +998,7 @@ void hostapd_config_free(struct hostapd_ - - for (i = 0; i < conf->num_bss; i++) - hostapd_config_free_bss(conf->bss[i]); -+ os_free(conf->config_id); - os_free(conf->bss); - os_free(conf->supported_rates); - os_free(conf->basic_rates); ---- a/src/ap/ap_config.h -+++ b/src/ap/ap_config.h -@@ -998,6 +998,7 @@ struct eht_phy_capabilities_info { - struct hostapd_config { - struct hostapd_bss_config **bss, *last_bss; - size_t num_bss; -+ char *config_id; - - u16 beacon_int; - int rts_threshold; ---- a/src/ap/hostapd.c -+++ b/src/ap/hostapd.c -@@ -127,7 +127,7 @@ void hostapd_reconfig_encryption(struct - } - - --static void hostapd_reload_bss(struct hostapd_data *hapd) -+void hostapd_reload_bss(struct hostapd_data *hapd) - { - struct hostapd_ssid *ssid; - -@@ -255,6 +255,10 @@ static int hostapd_iface_conf_changed(st - { - size_t i; - -+ if (newconf->config_id != oldconf->config_id) -+ if (strcmp(newconf->config_id, oldconf->config_id)) -+ return 1; -+ - if (newconf->num_bss != oldconf->num_bss) - return 1; - -@@ -268,7 +272,7 @@ static int hostapd_iface_conf_changed(st - } - - --int hostapd_reload_config(struct hostapd_iface *iface) -+int hostapd_reload_config(struct hostapd_iface *iface, int reconf) - { - struct hapd_interfaces *interfaces = iface->interfaces; - struct hostapd_data *hapd = iface->bss[0]; -@@ -298,6 +302,9 @@ int hostapd_reload_config(struct hostapd - char *fname; - int res; - -+ if (reconf) -+ return -1; -+ - hostapd_clear_old(iface); - - wpa_printf(MSG_DEBUG, -@@ -324,6 +331,24 @@ int hostapd_reload_config(struct hostapd - wpa_printf(MSG_ERROR, - "Failed to enable interface on config reload"); - return res; -+ } else { -+ for (j = 0; j < iface->num_bss; j++) { -+ hapd = iface->bss[j]; -+ if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) { -+ hostapd_flush_old_stations(iface->bss[j], -+ WLAN_REASON_PREV_AUTH_NOT_VALID); -+#ifdef CONFIG_WEP -+ hostapd_broadcast_wep_clear(iface->bss[j]); -+#endif -+ -+#ifndef CONFIG_NO_RADIUS -+ /* TODO: update dynamic data based on changed configuration -+ * items (e.g., open/close sockets, etc.) */ -+ radius_client_flush(iface->bss[j]->radius, 0); -+#endif /* CONFIG_NO_RADIUS */ -+ wpa_printf(MSG_INFO, "bss %zu changed", j); -+ } -+ } - } - iface->conf = newconf; - -@@ -340,6 +365,12 @@ int hostapd_reload_config(struct hostapd - - for (j = 0; j < iface->num_bss; j++) { - hapd = iface->bss[j]; -+ if (hapd->config_id) { -+ os_free(hapd->config_id); -+ hapd->config_id = NULL; -+ } -+ if (newconf->bss[j]->config_id) -+ hapd->config_id = strdup(newconf->bss[j]->config_id); - if (!hapd->conf->config_id || !newconf->bss[j]->config_id || - os_strcmp(hapd->conf->config_id, - newconf->bss[j]->config_id) != 0) -@@ -1236,8 +1267,7 @@ static int hostapd_start_beacon(struct h - * initialized. Most of the modules that are initialized here will be - * deinitialized in hostapd_cleanup(). - */ --static int hostapd_setup_bss(struct hostapd_data *hapd, int first, -- bool start_beacon) -+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon) - { - struct hostapd_bss_config *conf = hapd->conf; - u8 ssid[SSID_MAX_LEN + 1]; -@@ -2705,6 +2735,10 @@ hostapd_alloc_bss_data(struct hostapd_if - hapd->iconf = conf; - hapd->conf = bss; - hapd->iface = hapd_iface; -+ if (bss && bss->config_id) -+ hapd->config_id = strdup(bss->config_id); -+ else -+ hapd->config_id = NULL; - if (conf) - hapd->driver = conf->driver; - hapd->ctrl_sock = -1; -@@ -2723,7 +2757,7 @@ hostapd_alloc_bss_data(struct hostapd_if - } - - --static void hostapd_bss_deinit(struct hostapd_data *hapd) -+void hostapd_bss_deinit(struct hostapd_data *hapd) - { - if (!hapd) - return; ---- a/src/ap/hostapd.h -+++ b/src/ap/hostapd.h -@@ -48,7 +48,7 @@ struct mesh_conf; - struct hostapd_iface; - - struct hapd_interfaces { -- int (*reload_config)(struct hostapd_iface *iface); -+ int (*reload_config)(struct hostapd_iface *iface, int reconf); - struct hostapd_config * (*config_read_cb)(const char *config_fname); - int (*ctrl_iface_init)(struct hostapd_data *hapd); - void (*ctrl_iface_deinit)(struct hostapd_data *hapd); -@@ -192,6 +192,7 @@ struct hostapd_data { - struct hostapd_bss_config *conf; - struct hostapd_ubus_bss ubus; - struct hostapd_ucode_bss ucode; -+ char *config_id; - int interface_added; /* virtual interface added for this BSS */ - unsigned int started:1; - unsigned int disabled:1; -@@ -696,7 +697,9 @@ struct hostapd_iface { - int hostapd_for_each_interface(struct hapd_interfaces *interfaces, - int (*cb)(struct hostapd_iface *iface, - void *ctx), void *ctx); --int hostapd_reload_config(struct hostapd_iface *iface); -+int hostapd_reload_config(struct hostapd_iface *iface, int reconf); -+void hostapd_reload_bss(struct hostapd_data *hapd); -+void hostapd_bss_deinit(struct hostapd_data *hapd); - void hostapd_reconfig_encryption(struct hostapd_data *hapd); - struct hostapd_data * - hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface, -@@ -713,6 +716,7 @@ struct hostapd_iface * hostapd_init(stru - struct hostapd_iface * - hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, - const char *config_fname, int debug); -+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon); - void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, - int reassoc); - void hostapd_interface_deinit_free(struct hostapd_iface *iface); ---- a/src/drivers/driver_nl80211.c -+++ b/src/drivers/driver_nl80211.c -@@ -5322,6 +5322,9 @@ static int wpa_driver_nl80211_set_ap(voi - if (ret) { - wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", - ret, strerror(-ret)); -+ if (!bss->flink->beacon_set) -+ ret = 0; -+ bss->flink->beacon_set = 0; - } else { - link->beacon_set = 1; - nl80211_set_bss(bss, params->cts_protect, params->preamble, ---- a/hostapd/ctrl_iface.c -+++ b/hostapd/ctrl_iface.c -@@ -187,7 +187,7 @@ static int hostapd_ctrl_iface_update(str - iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read; - reload_opts = txt; - -- hostapd_reload_config(iface); -+ hostapd_reload_config(iface, 0); - - iface->interfaces->config_read_cb = config_read_cb; - } ---- a/hostapd/main.c -+++ b/hostapd/main.c -@@ -410,7 +410,7 @@ static void handle_term(int sig, void *s - - static int handle_reload_iface(struct hostapd_iface *iface, void *ctx) - { -- if (hostapd_reload_config(iface) < 0) { -+ if (hostapd_reload_config(iface, 0) < 0) { - wpa_printf(MSG_WARNING, "Failed to read new configuration " - "file - continuing with old."); - } ---- a/src/ap/wps_hostapd.c -+++ b/src/ap/wps_hostapd.c -@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo - - wpa_printf(MSG_DEBUG, "WPS: Reload configuration data"); - if (iface->interfaces == NULL || -- iface->interfaces->reload_config(iface) < 0) { -+ iface->interfaces->reload_config(iface, 1) < 0) { - wpa_printf(MSG_WARNING, "WPS: Failed to reload the updated " - "configuration"); - } diff --git a/package/network/services/hostapd/patches/701-reload_config_inline.patch b/package/network/services/hostapd/patches/701-reload_config_inline.patch index 071281eb5c4..44c8892bae9 100644 --- a/package/network/services/hostapd/patches/701-reload_config_inline.patch +++ b/package/network/services/hostapd/patches/701-reload_config_inline.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -4814,7 +4814,12 @@ struct hostapd_config * hostapd_config_r +@@ -4810,7 +4810,12 @@ struct hostapd_config * hostapd_config_r int errors = 0; size_t i; diff --git a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch index 61f33acb6e8..63d1b8a3b83 100644 --- a/package/network/services/hostapd/patches/710-vlan_no_bridge.patch +++ b/package/network/services/hostapd/patches/710-vlan_no_bridge.patch @@ -30,7 +30,7 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3355,6 +3355,8 @@ static int hostapd_config_fill(struct ho +@@ -3351,6 +3351,8 @@ static int hostapd_config_fill(struct ho #ifndef CONFIG_NO_VLAN } else if (os_strcmp(buf, "dynamic_vlan") == 0) { bss->ssid.dynamic_vlan = atoi(pos); diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch index 5f40aabb5eb..1aa4456a5f4 100644 --- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch +++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2850,6 +2850,14 @@ static int hostapd_config_fill(struct ho +@@ -2848,6 +2848,14 @@ static int hostapd_config_fill(struct ho line, bss->max_num_sta, MAX_STA_COUNT); return 1; } @@ -17,7 +17,7 @@ } else if (os_strcmp(buf, "extended_key_id") == 0) { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h -@@ -744,6 +744,7 @@ void hostapd_cleanup_cs_params(struct ho +@@ -742,6 +742,7 @@ void hostapd_cleanup_cs_params(struct ho void hostapd_periodic_iface(struct hostapd_iface *iface); int hostapd_owe_trans_get_info(struct hostapd_data *hapd); void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx); @@ -27,10 +27,10 @@ void hostapd_cleanup_cca_params(struct hostapd_data *hapd); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -272,6 +272,30 @@ static int hostapd_iface_conf_changed(st +@@ -244,6 +244,29 @@ static int hostapd_iface_conf_changed(st + return 0; } - +static inline int hostapd_iface_num_sta(struct hostapd_iface *iface) +{ + int num_sta = 0; @@ -54,10 +54,9 @@ + + return 0; +} -+ - int hostapd_reload_config(struct hostapd_iface *iface, int reconf) + + int hostapd_reload_config(struct hostapd_iface *iface) { - struct hapd_interfaces *interfaces = iface->interfaces; --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1252,7 +1252,7 @@ void handle_probe_req(struct hostapd_dat @@ -71,7 +70,7 @@ " since no room for additional STA", --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h -@@ -1037,6 +1037,8 @@ struct hostapd_config { +@@ -1036,6 +1036,8 @@ struct hostapd_config { unsigned int track_sta_max_num; unsigned int track_sta_max_age; diff --git a/package/network/services/hostapd/patches/730-ft_iface.patch b/package/network/services/hostapd/patches/730-ft_iface.patch index 563fe5b5fbb..0795ed15a14 100644 --- a/package/network/services/hostapd/patches/730-ft_iface.patch +++ b/package/network/services/hostapd/patches/730-ft_iface.patch @@ -1,6 +1,6 @@ --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -3009,6 +3009,8 @@ static int hostapd_config_fill(struct ho +@@ -3007,6 +3007,8 @@ static int hostapd_config_fill(struct ho wpa_printf(MSG_INFO, "Line %d: Obsolete peerkey parameter ignored", line); #ifdef CONFIG_IEEE80211R_AP diff --git a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch index 3e282b47a32..97c32df7044 100644 --- a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch +++ b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch @@ -18,7 +18,7 @@ #ifdef CONFIG_HS20 static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf, -@@ -4066,10 +4066,10 @@ static int hostapd_config_fill(struct ho +@@ -4062,10 +4062,10 @@ static int hostapd_config_fill(struct ho bss->gas_frag_limit = val; } else if (os_strcmp(buf, "gas_comeback_delay") == 0) { bss->gas_comeback_delay = atoi(pos); @@ -32,7 +32,7 @@ os_free(bss->dump_msk_file); --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1538,6 +1538,7 @@ int hostapd_setup_bss(struct hostapd_dat +@@ -1486,6 +1486,7 @@ int hostapd_setup_bss(struct hostapd_dat wpa_printf(MSG_ERROR, "GAS server initialization failed"); return -1; } @@ -40,7 +40,7 @@ if (conf->qos_map_set_len && hostapd_drv_set_qos_map(hapd, conf->qos_map_set, -@@ -1545,7 +1546,6 @@ int hostapd_setup_bss(struct hostapd_dat +@@ -1493,7 +1494,6 @@ int hostapd_setup_bss(struct hostapd_dat wpa_printf(MSG_ERROR, "Failed to initialize QoS Map"); return -1; } diff --git a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch index 946b4533bf2..2c705a68cf0 100644 --- a/package/network/services/hostapd/patches/760-dynamic_own_ip.patch +++ b/package/network/services/hostapd/patches/760-dynamic_own_ip.patch @@ -98,7 +98,7 @@ hapd->conf->own_ip_addr.af == AF_INET && --- a/hostapd/config_file.c +++ b/hostapd/config_file.c -@@ -2690,6 +2690,8 @@ static int hostapd_config_fill(struct ho +@@ -2688,6 +2688,8 @@ static int hostapd_config_fill(struct ho } else if (os_strcmp(buf, "iapp_interface") == 0) { wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used"); #endif /* CONFIG_IAPP */ diff --git a/package/network/services/hostapd/patches/761-shared_das_port.patch b/package/network/services/hostapd/patches/761-shared_das_port.patch index d60764ac593..cbb2a1be3c4 100644 --- a/package/network/services/hostapd/patches/761-shared_das_port.patch +++ b/package/network/services/hostapd/patches/761-shared_das_port.patch @@ -10,7 +10,7 @@ unsigned int time_window; --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -1475,6 +1475,7 @@ int hostapd_setup_bss(struct hostapd_dat +@@ -1423,6 +1423,7 @@ int hostapd_setup_bss(struct hostapd_dat os_memset(&das_conf, 0, sizeof(das_conf)); das_conf.port = conf->radius_das_port; diff --git a/package/network/services/hostapd/patches/770-radius_server.patch b/package/network/services/hostapd/patches/770-radius_server.patch index 6fca86d8814..e4690c76b8b 100644 --- a/package/network/services/hostapd/patches/770-radius_server.patch +++ b/package/network/services/hostapd/patches/770-radius_server.patch @@ -13,15 +13,15 @@ OBJS += ../src/ap/drv_callbacks.o --- a/hostapd/main.c +++ b/hostapd/main.c -@@ -42,6 +42,7 @@ static struct hapd_global global; - static int daemonize = 0; - static char *pid_file = NULL; +@@ -40,6 +40,7 @@ struct hapd_global { + + static struct hapd_global global; +extern int radius_main(int argc, char **argv); #ifndef CONFIG_NO_HOSTAPD_LOGGER static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module, -@@ -755,6 +756,11 @@ int main(int argc, char *argv[]) +@@ -758,6 +759,11 @@ int main(int argc, char *argv[]) if (os_program_init()) return -1; diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index a609eb1ef2a..6ff2257c329 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -163,7 +163,7 @@ hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj, { struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); - return hostapd_reload_config(hapd->iface, 1); + return hostapd_reload_config(hapd->iface); } diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c index 137cb81ab43..053171b1429 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.c +++ b/package/network/services/hostapd/src/src/ap/ucode.c @@ -4,6 +4,8 @@ #include "utils/common.h" #include "utils/ucode.h" #include "hostapd.h" +#include "beacon.h" +#include "hw_features.h" #include "ap_drv_ops.h" #include @@ -21,7 +23,7 @@ hostapd_ucode_bss_get_uval(struct hostapd_data *hapd) return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx); val = uc_resource_new(bss_type, hapd); - wpa_ucode_registry_add(bss_registry, val, &hapd->ucode.idx); + hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val); return val; } @@ -35,46 +37,46 @@ hostapd_ucode_iface_get_uval(struct hostapd_iface *hapd) return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx); val = uc_resource_new(iface_type, hapd); - wpa_ucode_registry_add(iface_registry, val, &hapd->ucode.idx); + hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val); return val; } static void -hostapd_ucode_update_bss_list(struct hostapd_iface *iface) +hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss) { - uc_value_t *ifval, *list; + uc_value_t *list; int i; list = ucv_array_new(vm); for (i = 0; i < iface->num_bss; i++) { struct hostapd_data *hapd = iface->bss[i]; uc_value_t *val = hostapd_ucode_bss_get_uval(hapd); - uc_value_t *proto = ucv_prototype_get(val); - ucv_object_add(proto, "name", ucv_get(ucv_string_new(hapd->conf->iface))); - ucv_object_add(proto, "index", ucv_int64_new(i)); - ucv_array_set(list, i, ucv_get(val)); + ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface))); + ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); } - - ifval = hostapd_ucode_iface_get_uval(iface); - ucv_object_add(ucv_prototype_get(ifval), "bss", ucv_get(list)); + ucv_object_add(if_bss, iface->phy, ucv_get(list)); } static void hostapd_ucode_update_interfaces(void) { uc_value_t *ifs = ucv_object_new(vm); + uc_value_t *if_bss = ucv_array_new(vm); + uc_value_t *bss = ucv_object_new(vm); int i; for (i = 0; i < interfaces->count; i++) { struct hostapd_iface *iface = interfaces->iface[i]; ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface))); - hostapd_ucode_update_bss_list(iface); + hostapd_ucode_update_bss_list(iface, if_bss, bss); } ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); + ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss)); + ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss)); ucv_gc(vm); } @@ -197,7 +199,7 @@ uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs) hostapd_config_free_bss(hapd->conf); os_free(hapd); - hostapd_ucode_update_bss_list(iface); + hostapd_ucode_update_interfaces(); ucv_gc(vm); return NULL; @@ -250,7 +252,7 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs) iface->conf->bss[iface->conf->num_bss] = bss; conf->bss[idx] = NULL; ret = hostapd_ucode_bss_get_uval(hapd); - hostapd_ucode_update_bss_list(iface); + hostapd_ucode_update_interfaces(); goto out; deinit_ctrl: @@ -289,12 +291,159 @@ 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) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + int i; + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + + hostapd_drv_stop_ap(hapd); + hapd->started = 0; + } +} + +static uc_value_t * +uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + uint64_t intval; + int i; + + if (!iface) + return NULL; + + if (!info) + goto out; + + if (ucv_type(info) != UC_OBJECT) + return NULL; + + conf = iface->conf; + if ((intval = ucv_int64_get(ucv_object_get(info, "op_class", NULL))) && !errno) + conf->op_class = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "hw_mode", NULL))) && !errno) + conf->hw_mode = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "channel", NULL))) && !errno) + conf->channel = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno) + conf->secondary_channel = intval; +#ifdef CONFIG_IEEE80211AC + if ((intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL))) && !errno) { + conf->vht_oper_centr_freq_seg0_idx = intval; +#ifdef CONFIG_IEEE80211AX + conf->he_oper_centr_freq_seg0_idx = intval; +#endif +#ifdef CONFIG_IEEE80211BE + conf->eht_oper_centr_freq_seg0_idx = intval; +#endif + } + if ((intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL))) && !errno) { + conf->vht_oper_centr_freq_seg1_idx = intval; +#ifdef CONFIG_IEEE80211AX + conf->he_oper_centr_freq_seg1_idx = intval; +#endif +#ifdef CONFIG_IEEE80211BE + conf->eht_oper_centr_freq_seg1_idx = intval; +#endif + } + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (!errno) { + conf->vht_oper_chwidth = intval; +#ifdef CONFIG_IEEE80211AX + conf->he_oper_chwidth = intval; +#endif +#ifdef CONFIG_IEEE80211BE + conf->eht_oper_chwidth = intval; +#endif + } +#endif + +out: + if (conf->channel) + iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel); + + for (i = 0; i < iface->num_bss; i++) { + struct hostapd_data *hapd = iface->bss[i]; + int ret; + + hapd->started = 1; + hostapd_set_freq(hapd, conf->hw_mode, iface->freq, + conf->channel, + conf->enable_edmg, + conf->edmg_channel, + conf->ieee80211n, + conf->ieee80211ac, + conf->ieee80211ax, + conf->ieee80211be, + conf->secondary_channel, + hostapd_get_oper_chwidth(conf), + hostapd_get_oper_centr_freq_seg0_idx(conf), + hostapd_get_oper_centr_freq_seg1_idx(conf)); + + ieee802_11_set_beacon(hapd); + } + + return ucv_boolean_new(true); +} + +static uc_value_t * +uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs) +{ + struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface"); + uc_value_t *info = uc_fn_arg(0); + struct hostapd_config *conf; + struct csa_settings csa = {}; + uint64_t intval; + int i, ret = 0; + + if (!iface || ucv_type(info) != UC_OBJECT) + return NULL; + + conf = iface->conf; + if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno) + csa.cs_count = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno) + csa.freq_params.sec_channel_offset = intval; + + csa.freq_params.ht_enabled = conf->ieee80211n; + csa.freq_params.vht_enabled = conf->ieee80211ac; + csa.freq_params.he_enabled = conf->ieee80211ax; +#ifdef CONFIG_IEEE80211BE + csa.freq_params.eht_enabled = conf->ieee80211be; +#endif + intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL)); + if (errno) + intval = hostapd_get_oper_chwidth(conf); + if (intval) + csa.freq_params.bandwidth = 40 << intval; + else + csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20; + + if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno) + csa.freq_params.freq = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno) + csa.freq_params.center_freq1 = intval; + if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno) + csa.freq_params.center_freq2 = intval; + + for (i = 0; i < iface->num_bss; i++) + ret = hostapd_switch_channel(iface->bss[i], &csa); + + return ucv_boolean_new(!ret); +} + int hostapd_ucode_init(struct hapd_interfaces *ifaces) { static const uc_function_list_t global_fns[] = { { "printf", uc_wpa_printf }, { "getpid", uc_wpa_getpid }, { "sha1", uc_wpa_sha1 }, + { "freq_info", uc_wpa_freq_info }, { "add_iface", uc_hostapd_add_iface }, { "remove_iface", uc_hostapd_remove_iface }, }; @@ -304,7 +453,10 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces) { "delete", uc_hostapd_bss_delete }, }; static const uc_function_list_t iface_fns[] = { - { "add_bss", uc_hostapd_iface_add_bss } + { "add_bss", uc_hostapd_iface_add_bss }, + { "stop", uc_hostapd_iface_stop }, + { "start", uc_hostapd_iface_start }, + { "switch_channel", uc_hostapd_iface_switch_channel }, }; uc_value_t *data, *proto; @@ -360,7 +512,7 @@ void hostapd_ucode_add_bss(struct hostapd_data *hapd) ucv_gc(vm); } -void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf) +void hostapd_ucode_reload_bss(struct hostapd_data *hapd) { uc_value_t *val; @@ -370,8 +522,7 @@ void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf) val = hostapd_ucode_bss_get_uval(hapd); uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface))); uc_value_push(ucv_get(val)); - uc_value_push(ucv_int64_new(reconf)); - ucv_put(wpa_ucode_call(3)); + ucv_put(wpa_ucode_call(2)); ucv_gc(vm); } diff --git a/package/network/services/hostapd/src/src/ap/ucode.h b/package/network/services/hostapd/src/src/ap/ucode.h index dbc49e6eac6..d00b787169d 100644 --- a/package/network/services/hostapd/src/src/ap/ucode.h +++ b/package/network/services/hostapd/src/src/ap/ucode.h @@ -25,7 +25,7 @@ void hostapd_ucode_free(void); void hostapd_ucode_free_iface(struct hostapd_iface *iface); void hostapd_ucode_add_bss(struct hostapd_data *hapd); void hostapd_ucode_free_bss(struct hostapd_data *hapd); -void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf); +void hostapd_ucode_reload_bss(struct hostapd_data *hapd); #else @@ -39,7 +39,7 @@ static inline void hostapd_ucode_free(void) static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface) { } -static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf) +static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd) { } static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd) diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c index fabf58a5e8b..44169f0bf0a 100644 --- a/package/network/services/hostapd/src/src/utils/ucode.c +++ b/package/network/services/hostapd/src/src/utils/ucode.c @@ -3,6 +3,7 @@ #include "utils/eloop.h" #include "crypto/crypto.h" #include "crypto/sha1.h" +#include "common/ieee802_11_common.h" #include #include @@ -45,6 +46,97 @@ uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs) return NULL; } +uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *freq = uc_fn_arg(0); + uc_value_t *sec = uc_fn_arg(1); + int width = ucv_uint64_get(uc_fn_arg(2)); + int freq_val, center_idx, center_ofs; + enum oper_chan_width chanwidth; + enum hostapd_hw_mode hw_mode; + u8 op_class, channel, tmp_channel; + const char *modestr; + int sec_channel = 0; + uc_value_t *ret; + + if (ucv_type(freq) != UC_INTEGER) + return NULL; + + freq_val = ucv_int64_get(freq); + if (ucv_type(sec) == UC_INTEGER) + sec_channel = ucv_int64_get(sec); + else if (sec) + return NULL; + else if (freq_val > 4000) + sec_channel = (freq_val / 20) & 1 ? 1 : -1; + else + sec_channel = freq_val < 2442 ? 1 : -1; + + if (sec_channel != -1 && sec_channel != 1 && sec_channel != 0) + return NULL; + + switch (width) { + case 0: + chanwidth = CONF_OPER_CHWIDTH_USE_HT; + break; + case 1: + chanwidth = CONF_OPER_CHWIDTH_80MHZ; + break; + case 2: + chanwidth = CONF_OPER_CHWIDTH_160MHZ; + break; + default: + return NULL; + } + + hw_mode = ieee80211_freq_to_channel_ext(freq_val, sec_channel, + chanwidth, &op_class, &channel); + switch (hw_mode) { + case HOSTAPD_MODE_IEEE80211B: + modestr = "b"; + break; + case HOSTAPD_MODE_IEEE80211G: + modestr = "g"; + break; + case HOSTAPD_MODE_IEEE80211A: + modestr = "a"; + break; + case HOSTAPD_MODE_IEEE80211AD: + modestr = "ad"; + break; + default: + return NULL; + } + + ret = ucv_object_new(vm); + ucv_object_add(ret, "op_class", ucv_int64_new(op_class)); + ucv_object_add(ret, "channel", ucv_int64_new(channel)); + ucv_object_add(ret, "hw_mode", ucv_int64_new(hw_mode)); + ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr))); + ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel)); + ucv_object_add(ret, "frequency", ucv_int64_new(freq_val)); + + if (!sec_channel) + return ret; + + if (freq_val >= 5900) + center_ofs = 0; + else if (freq_val >= 5745) + center_ofs = 20; + else + center_ofs = 35; + tmp_channel = channel - center_ofs; + tmp_channel &= ~((8 << width) - 1); + center_idx = tmp_channel + center_ofs + (4 << width) - 1; + + ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(center_idx)); + center_idx = (center_idx - channel) * 5 + freq_val; + ucv_object_add(ret, "center_freq1", ucv_int64_new(center_idx)); + +out: + return ret; +} + uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs) { return ucv_int64_new(getpid()); @@ -179,7 +271,7 @@ uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_t return global; } -void wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val, int *idx) +int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val) { uc_value_t *data; int i = 0; @@ -189,10 +281,7 @@ void wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val, int *idx) ucv_array_set(reg, i, ucv_get(val)); - data = ucv_object_new(&vm); - ucv_object_add(ucv_prototype_get(val), "data", ucv_get(data)); - - *idx = i + 1; + return i + 1; } uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx) diff --git a/package/network/services/hostapd/src/src/utils/ucode.h b/package/network/services/hostapd/src/src/utils/ucode.h index 4caf8ada5a1..2c1886976ee 100644 --- a/package/network/services/hostapd/src/src/utils/ucode.h +++ b/package/network/services/hostapd/src/src/utils/ucode.h @@ -17,12 +17,13 @@ void wpa_ucode_free_vm(void); uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_type); -void wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val, int *idx); +int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val); uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx); uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx); uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs); uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs); uc_value_t *uc_wpa_sha1(uc_vm_t *vm, size_t nargs); +uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs); #endif diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c index 660357a43d9..d0a78d16253 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -1,8 +1,10 @@ #include "utils/includes.h" #include "utils/common.h" #include "utils/ucode.h" +#include "drivers/driver.h" #include "wpa_supplicant_i.h" #include "wps_supplicant.h" +#include "bss.h" #include "ucode.h" static struct wpa_global *wpa_global; @@ -19,7 +21,7 @@ wpas_ucode_iface_get_uval(struct wpa_supplicant *wpa_s) return wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx); val = uc_resource_new(iface_type, wpa_s); - wpa_ucode_registry_add(iface_registry, val, &wpa_s->ucode.idx); + wpa_s->ucode.idx = wpa_ucode_registry_add(iface_registry, val); return val; } @@ -63,12 +65,65 @@ void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s) if (wpa_ucode_call_prepare("iface_remove")) return; - uc_value_push(ucv_string_new(wpa_s->ifname)); + uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); uc_value_push(ucv_get(val)); ucv_put(wpa_ucode_call(2)); ucv_gc(vm); } +void wpas_ucode_update_state(struct wpa_supplicant *wpa_s) +{ + const char *state; + uc_value_t *val; + + val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx); + if (!val) + return; + + if (wpa_ucode_call_prepare("state")) + return; + + state = wpa_supplicant_state_txt(wpa_s->wpa_state); + uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_get(val)); + uc_value_push(ucv_get(ucv_string_new(state))); + ucv_put(wpa_ucode_call(3)); + ucv_gc(vm); +} + +void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data) +{ + const char *state; + uc_value_t *val; + + if (event != EVENT_CH_SWITCH_STARTED) + return; + + val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx); + if (!val) + return; + + if (wpa_ucode_call_prepare("event")) + return; + + uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname))); + uc_value_push(ucv_get(val)); + uc_value_push(ucv_get(ucv_string_new(event_to_string(event)))); + val = ucv_object_new(vm); + uc_value_push(ucv_get(val)); + + if (event == EVENT_CH_SWITCH_STARTED) { + ucv_object_add(val, "csa_count", ucv_int64_new(data->ch_switch.count)); + ucv_object_add(val, "frequency", ucv_int64_new(data->ch_switch.freq)); + ucv_object_add(val, "sec_chan_offset", ucv_int64_new(data->ch_switch.ch_offset)); + ucv_object_add(val, "center_freq1", ucv_int64_new(data->ch_switch.cf1)); + ucv_object_add(val, "center_freq2", ucv_int64_new(data->ch_switch.cf2)); + } + + ucv_put(wpa_ucode_call(4)); + ucv_gc(vm); +} + static const char *obj_stringval(uc_value_t *obj, const char *name) { uc_value_t *val = ucv_object_get(obj, name, NULL); @@ -84,7 +139,6 @@ uc_wpas_add_iface(uc_vm_t *vm, size_t nargs) uc_value_t *bridge = ucv_object_get(info, "bridge", NULL); uc_value_t *config = ucv_object_get(info, "config", NULL); uc_value_t *ctrl = ucv_object_get(info, "ctrl", NULL); - uc_value_t *hapd_ctrl = ucv_object_get(info, "hostapd_ctrl", NULL); struct wpa_interface iface; int ret = -1; @@ -97,7 +151,6 @@ uc_wpas_add_iface(uc_vm_t *vm, size_t nargs) .bridge_ifname = ucv_string_get(bridge), .confname = ucv_string_get(config), .ctrl_interface = ucv_string_get(ctrl), - .hostapd_ctrl = ucv_string_get(hapd_ctrl), }; if (!iface.ifname || !iface.confname) @@ -135,6 +188,45 @@ out: return ucv_int64_new(ret); } +static uc_value_t * +uc_wpas_iface_status(uc_vm_t *vm, size_t nargs) +{ + struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface"); + struct wpa_bss *bss; + uc_value_t *ret, *val; + + if (!wpa_s) + return NULL; + + ret = ucv_object_new(vm); + + val = ucv_string_new(wpa_supplicant_state_txt(wpa_s->wpa_state)); + ucv_object_add(ret, "state", ucv_get(val)); + + bss = wpa_s->current_bss; + if (bss) { + int sec_chan = 0; + const u8 *ie; + + ie = wpa_bss_get_ie(bss, WLAN_EID_HT_OPERATION); + if (ie && ie[1] >= 2) { + const struct ieee80211_ht_operation *ht_oper; + + ht_oper = (const void *) (ie + 2); + if (ht_oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) + sec_chan = 1; + else if (ht_oper->ht_param & + HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) + sec_chan = -1; + } + + ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(sec_chan)); + ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq)); + } + + return ret; +} + int wpas_ucode_init(struct wpa_global *gl) { static const uc_function_list_t global_fns[] = { @@ -144,6 +236,7 @@ int wpas_ucode_init(struct wpa_global *gl) { "remove_iface", uc_wpas_remove_iface }, }; static const uc_function_list_t iface_fns[] = { + { "status", uc_wpas_iface_status }, }; uc_value_t *data, *proto; @@ -151,10 +244,10 @@ int wpas_ucode_init(struct wpa_global *gl) vm = wpa_ucode_create_vm(); global_type = uc_type_declare(vm, "wpas.global", global_fns, NULL); - iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL); + iface_type = uc_type_declare(vm, "wpas.iface", iface_fns, NULL); iface_registry = ucv_array_new(vm); - uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry); + uc_vm_registry_set(vm, "wpas.iface_registry", iface_registry); global = wpa_ucode_global_init("wpas", global_type); diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.h b/package/network/services/hostapd/src/wpa_supplicant/ucode.h index fcd231357b3..a429a0ed87b 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.h +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.h @@ -4,6 +4,7 @@ #include "utils/ucode.h" struct wpa_global; +union wpa_event_data; struct wpa_supplicant; struct wpas_ucode_bss { @@ -17,6 +18,8 @@ int wpas_ucode_init(struct wpa_global *gl); void wpas_ucode_free(void); void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s); void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s); +void wpas_ucode_update_state(struct wpa_supplicant *wpa_s); +void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data); #else static inline int wpas_ucode_init(struct wpa_global *gl) { @@ -33,6 +36,14 @@ static inline void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s) { } +static inline void wpas_ucode_update_state(struct wpa_supplicant *wpa_s) +{ +} + +static inline void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data) +{ +} + #endif #endif diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 5a951ac2495..82c4dc601a2 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2022-06-15 -PKG_SOURCE_VERSION:=9913aa61de739e3efe067a2d186021c20bcd65e2 -PKG_MIRROR_HASH:=f6702e68d7c60388c11f40ca5ca8e932d0bf423325db5bee2c79404782bbcb52 +PKG_SOURCE_DATE:=2023-06-05 +PKG_SOURCE_VERSION:=f787c97b34894a38b15599886cacbca01271684f +PKG_MIRROR_HASH:=f4e898eb9207f069652f1767835f6aa9f015df2282d51e50ab57a0c3736f36e3 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 30152607613..ffbbce577c8 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE=2023-03-05 -PKG_SOURCE_VERSION:=04d0c46cfe30f557da0c603516636830cab4a08a -PKG_MIRROR_HASH:=5402091db0645d19a60c3ec51850062138af8fb9eda6764091819637d84f1036 +PKG_SOURCE_DATE=2023-08-10 +PKG_SOURCE_VERSION:=5781664d5087ccc4b5ab58505883231212dbedbc +PKG_MIRROR_HASH:=2d60a8543fa00cfc75df6417354b004abf58f672c91bf0a3bffe3ea1dbf84a4b PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk index 7a349337d8a..2bd5748e90e 100644 --- a/target/linux/armsr/modules.mk +++ b/target/linux/armsr/modules.mk @@ -151,17 +151,6 @@ endef $(eval $(call KernelPackage,marvell-mdio)) -define KernelPackage/phy-marvell-10g - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell Alaska 10G PHY driver - DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy - KCONFIG:=CONFIG_MARVELL_10G_PHY - FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko - AUTOLOAD=$(call AutoLoad,35,marvell10g) -endef - -$(eval $(call KernelPackage,phy-marvell-10g)) - define KernelPackage/mvneta SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Marvell Armada 370/38x/XP/37xx network driver diff --git a/target/linux/bcm27xx/patches-6.1/950-0045-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch b/target/linux/bcm27xx/patches-6.1/950-0045-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch index 8bcbb0db27a..9d4b5571e2c 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0045-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0045-drm-atomic-helpers-remove-legacy_cursor_update-hacks.patch @@ -88,7 +88,7 @@ Signed-off-by: Maxime Ripard commit->event = kzalloc(sizeof(*commit->event), --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c -@@ -7765,6 +7765,19 @@ static int intel_atomic_commit(struct dr +@@ -7743,6 +7743,19 @@ static int intel_atomic_commit(struct dr state->base.legacy_cursor_update = false; } diff --git a/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index af1c9bcefd5..ba09c562aeb 100644 --- a/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-5.15/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1538,10 +1538,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1542,10 +1542,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index e78b4a47d70..b5baa8717e4 100644 --- a/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-5.15/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1552,6 +1552,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1556,6 +1556,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/bcm4908/patches-6.1/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch b/target/linux/bcm4908/patches-6.1/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch index 26c2f109426..954b28b63b5 100644 --- a/target/linux/bcm4908/patches-6.1/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch +++ b/target/linux/bcm4908/patches-6.1/700-net-dsa-bcm_sf2-enable-GPHY-for-switch-probing.patch @@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1512,10 +1512,14 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1516,10 +1516,14 @@ static int bcm_sf2_sw_probe(struct platf rev = reg_readl(priv, REG_PHY_REVISION); priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK; diff --git a/target/linux/bcm4908/patches-6.1/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch b/target/linux/bcm4908/patches-6.1/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch index 302c9337424..24e6234600b 100644 --- a/target/linux/bcm4908/patches-6.1/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch +++ b/target/linux/bcm4908/patches-6.1/701-net-dsa-bcm_sf2-keep-GPHY-enabled-on-the-BCM4908.patch @@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c -@@ -1526,6 +1526,12 @@ static int bcm_sf2_sw_probe(struct platf +@@ -1530,6 +1530,12 @@ static int bcm_sf2_sw_probe(struct platf priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff, priv->irq0, priv->irq1); diff --git a/target/linux/gemini/config-6.1 b/target/linux/gemini/config-6.1 index a4f2cba8512..09b7b97d165 100644 --- a/target/linux/gemini/config-6.1 +++ b/target/linux/gemini/config-6.1 @@ -271,6 +271,10 @@ CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y +CONFIG_NET_DSA_REALTEK=y +# CONFIG_NET_DSA_REALTEK_MDIO is not set +# CONFIG_NET_DSA_REALTEK_RTL8365MB is not set +CONFIG_NET_DSA_REALTEK_RTL8366RB=y CONFIG_NET_DSA_REALTEK_SMI=y CONFIG_NET_DSA_TAG_RTL4_A=y CONFIG_NET_NS=y diff --git a/target/linux/generic/backport-5.15/890-v6.1-mtd-spinand-winbond-fix-flash-detection.patch b/target/linux/generic/backport-5.15/890-v6.2-mtd-spinand-winbond-fix-flash-detection.patch similarity index 100% rename from target/linux/generic/backport-5.15/890-v6.1-mtd-spinand-winbond-fix-flash-detection.patch rename to target/linux/generic/backport-5.15/890-v6.2-mtd-spinand-winbond-fix-flash-detection.patch diff --git a/target/linux/generic/backport-5.15/891-v6.1-mtd-spinand-winbond-add-W25N02KV.patch b/target/linux/generic/backport-5.15/891-v6.2-mtd-spinand-winbond-add-W25N02KV.patch similarity index 100% rename from target/linux/generic/backport-5.15/891-v6.1-mtd-spinand-winbond-add-W25N02KV.patch rename to target/linux/generic/backport-5.15/891-v6.2-mtd-spinand-winbond-add-W25N02KV.patch diff --git a/target/linux/generic/backport-5.15/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch b/target/linux/generic/backport-5.15/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch new file mode 100644 index 00000000000..2f408f5a300 --- /dev/null +++ b/target/linux/generic/backport-5.15/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch @@ -0,0 +1,49 @@ +From f5a05060670a4d8d6523afc7963eb559c2e3615f Mon Sep 17 00:00:00 2001 +From: Olivier Maignial +Date: Fri, 23 Jun 2023 17:33:37 +0200 +Subject: [PATCH] mtd: spinand: winbond: Fix ecc_get_status + +Reading ECC status is failing. + +w25n02kv_ecc_get_status() is using on-stack buffer for +SPINAND_GET_FEATURE_OP() output. It is not suitable for +DMA needs of spi-mem. + +Fix this by using the spi-mem operations dedicated buffer +spinand->scratchbuf. + +See +spinand->scratchbuf: +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mtd/spinand.h?h=v6.3#n418 +spi_mem_check_op(): +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-mem.c?h=v6.3#n199 + +Fixes: 6154c7a58348 ("mtd: spinand: winbond: add Winbond W25N02KV flash support") +Cc: stable@vger.kernel.org +Signed-off-by: Olivier Maignial +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/DB4P250MB1032EDB9E36B764A33769039FE23A@DB4P250MB1032.EURP250.PROD.OUTLOOK.COM +--- + drivers/mtd/nand/spi/winbond.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -108,7 +108,7 @@ static int w25n02kv_ecc_get_status(struc + { + struct nand_device *nand = spinand_to_nand(spinand); + u8 mbf = 0; +- struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, &mbf); ++ struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf); + + switch (status & STATUS_ECC_MASK) { + case STATUS_ECC_NO_BITFLIPS: +@@ -126,7 +126,7 @@ static int w25n02kv_ecc_get_status(struc + if (spi_mem_exec_op(spinand->spimem, &op)) + return nanddev_get_ecc_conf(nand)->strength; + +- mbf >>= 4; ++ mbf = *(spinand->scratchbuf) >> 4; + + if (WARN_ON(mbf > nanddev_get_ecc_conf(nand)->strength || !mbf)) + return nanddev_get_ecc_conf(nand)->strength; diff --git a/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch b/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch index 7a4d175128d..87e7c49a766 100644 --- a/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch +++ b/target/linux/generic/backport-6.1/020-v6.3-06-BACKPORT-mm-multi-gen-LRU-per-node-lru_gen_folio-lis.patch @@ -325,7 +325,7 @@ Signed-off-by: T.J. Mercier mctz = soft_limit_tree.rb_tree_per_node[nid]; if (!mctz) return; -@@ -3522,6 +3532,9 @@ unsigned long mem_cgroup_soft_limit_recl +@@ -3523,6 +3533,9 @@ unsigned long mem_cgroup_soft_limit_recl struct mem_cgroup_tree_per_node *mctz; unsigned long excess; @@ -335,7 +335,7 @@ Signed-off-by: T.J. Mercier if (order > 0) return 0; -@@ -5382,6 +5395,7 @@ static int mem_cgroup_css_online(struct +@@ -5383,6 +5396,7 @@ static int mem_cgroup_css_online(struct if (unlikely(mem_cgroup_is_root(memcg))) queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ); @@ -343,7 +343,7 @@ Signed-off-by: T.J. Mercier return 0; offline_kmem: memcg_offline_kmem(memcg); -@@ -5413,6 +5427,7 @@ static void mem_cgroup_css_offline(struc +@@ -5414,6 +5428,7 @@ static void mem_cgroup_css_offline(struc memcg_offline_kmem(memcg); reparent_shrinker_deferred(memcg); wb_memcg_offline(memcg); @@ -351,7 +351,7 @@ Signed-off-by: T.J. Mercier drain_all_stock(memcg); -@@ -5424,6 +5439,7 @@ static void mem_cgroup_css_released(stru +@@ -5425,6 +5440,7 @@ static void mem_cgroup_css_released(stru struct mem_cgroup *memcg = mem_cgroup_from_css(css); invalidate_reclaim_iterators(memcg); diff --git a/target/linux/generic/backport-6.1/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch b/target/linux/generic/backport-6.1/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch new file mode 100644 index 00000000000..2f408f5a300 --- /dev/null +++ b/target/linux/generic/backport-6.1/892-v6.5-mtd-spinand-winbond-Fix-ecc_get_status.patch @@ -0,0 +1,49 @@ +From f5a05060670a4d8d6523afc7963eb559c2e3615f Mon Sep 17 00:00:00 2001 +From: Olivier Maignial +Date: Fri, 23 Jun 2023 17:33:37 +0200 +Subject: [PATCH] mtd: spinand: winbond: Fix ecc_get_status + +Reading ECC status is failing. + +w25n02kv_ecc_get_status() is using on-stack buffer for +SPINAND_GET_FEATURE_OP() output. It is not suitable for +DMA needs of spi-mem. + +Fix this by using the spi-mem operations dedicated buffer +spinand->scratchbuf. + +See +spinand->scratchbuf: +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mtd/spinand.h?h=v6.3#n418 +spi_mem_check_op(): +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-mem.c?h=v6.3#n199 + +Fixes: 6154c7a58348 ("mtd: spinand: winbond: add Winbond W25N02KV flash support") +Cc: stable@vger.kernel.org +Signed-off-by: Olivier Maignial +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/DB4P250MB1032EDB9E36B764A33769039FE23A@DB4P250MB1032.EURP250.PROD.OUTLOOK.COM +--- + drivers/mtd/nand/spi/winbond.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/nand/spi/winbond.c ++++ b/drivers/mtd/nand/spi/winbond.c +@@ -108,7 +108,7 @@ static int w25n02kv_ecc_get_status(struc + { + struct nand_device *nand = spinand_to_nand(spinand); + u8 mbf = 0; +- struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, &mbf); ++ struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf); + + switch (status & STATUS_ECC_MASK) { + case STATUS_ECC_NO_BITFLIPS: +@@ -126,7 +126,7 @@ static int w25n02kv_ecc_get_status(struc + if (spi_mem_exec_op(spinand->spimem, &op)) + return nanddev_get_ecc_conf(nand)->strength; + +- mbf >>= 4; ++ mbf = *(spinand->scratchbuf) >> 4; + + if (WARN_ON(mbf > nanddev_get_ecc_conf(nand)->strength || !mbf)) + return nanddev_get_ecc_conf(nand)->strength; diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index d7e4742d633..de619f60b68 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -330,6 +330,10 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 # CONFIG_ARM64_ERRATUM_1530923 is not set # CONFIG_ARM64_ERRATUM_1542419 is not set # CONFIG_ARM64_ERRATUM_1742098 is not set +# CONFIG_ARM64_ERRATUM_2253138 is not set +# CONFIG_ARM64_ERRATUM_2224489 is not set +# CONFIG_ARM64_ERRATUM_2054223 is not set +# CONFIG_ARM64_ERRATUM_2067961 is not set # CONFIG_ARM64_ERRATUM_2441007 is not set # CONFIG_ARM64_ERRATUM_2441009 is not set # CONFIG_ARM64_ERRATUM_819472 is not set diff --git a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch index 1f3802aa5b3..5c1ce01a2ce 100644 --- a/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.15/901-debloat_sock_diag.patch @@ -77,7 +77,7 @@ Signed-off-by: Felix Fietkau INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *, u32)); INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *, -@@ -1983,9 +1997,11 @@ static void __sk_free(struct sock *sk) +@@ -1986,9 +2000,11 @@ static void __sk_free(struct sock *sk) if (likely(sk->sk_net_refcnt)) sock_inuse_add(sock_net(sk), -1); diff --git a/target/linux/generic/hack-5.15/902-debloat_proc.patch b/target/linux/generic/hack-5.15/902-debloat_proc.patch index b1c1c8171c1..8039d4161a2 100644 --- a/target/linux/generic/hack-5.15/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.15/902-debloat_proc.patch @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3877,6 +3877,8 @@ static __net_initdata struct pernet_oper +@@ -3880,6 +3880,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { diff --git a/target/linux/generic/hack-6.1/901-debloat_sock_diag.patch b/target/linux/generic/hack-6.1/901-debloat_sock_diag.patch index b93fe2b725d..6cd30813a5d 100644 --- a/target/linux/generic/hack-6.1/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-6.1/901-debloat_sock_diag.patch @@ -79,7 +79,7 @@ Signed-off-by: Felix Fietkau INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *, u32)); INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *, -@@ -2168,9 +2182,11 @@ static void __sk_free(struct sock *sk) +@@ -2175,9 +2189,11 @@ static void __sk_free(struct sock *sk) if (likely(sk->sk_net_refcnt)) sock_inuse_add(sock_net(sk), -1); diff --git a/target/linux/generic/hack-6.1/902-debloat_proc.patch b/target/linux/generic/hack-6.1/902-debloat_proc.patch index b035f04ba23..1b7b72f44df 100644 --- a/target/linux/generic/hack-6.1/902-debloat_proc.patch +++ b/target/linux/generic/hack-6.1/902-debloat_proc.patch @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -4093,6 +4093,8 @@ static __net_initdata struct pernet_oper +@@ -4100,6 +4100,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { diff --git a/target/linux/generic/pending-6.1/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-6.1/530-jffs2_make_lzma_available.patch index b6b75d4ac51..f17216c52b9 100644 --- a/target/linux/generic/pending-6.1/530-jffs2_make_lzma_available.patch +++ b/target/linux/generic/pending-6.1/530-jffs2_make_lzma_available.patch @@ -1102,7 +1102,7 @@ Signed-off-by: Alexandros C. Couloumbis # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.) --- a/lib/Makefile +++ b/lib/Makefile -@@ -134,6 +134,16 @@ CFLAGS_kobject.o += -DDEBUG +@@ -140,6 +140,16 @@ CFLAGS_kobject.o += -DDEBUG CFLAGS_kobject_uevent.o += -DDEBUG endif @@ -1119,7 +1119,7 @@ Signed-off-by: Alexandros C. Couloumbis obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) -@@ -194,6 +204,8 @@ obj-$(CONFIG_ZSTD_COMPRESS) += zstd/ +@@ -200,6 +210,8 @@ obj-$(CONFIG_ZSTD_COMPRESS) += zstd/ obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd/ obj-$(CONFIG_XZ_DEC) += xz/ obj-$(CONFIG_RAID6_PQ) += raid6/ diff --git a/target/linux/generic/pending-6.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-6.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index e5103570f1f..a3cfad2206e 100644 --- a/target/linux/generic/pending-6.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-6.1/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -157,7 +157,7 @@ Signed-off-by: Jonas Gorski case RTN_THROW: case RTN_UNREACHABLE: default: -@@ -4539,6 +4558,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -4540,6 +4559,17 @@ static int ip6_pkt_prohibit_out(struct n return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); } @@ -175,7 +175,7 @@ Signed-off-by: Jonas Gorski /* * Allocate a dst for local (unicast / anycast) address. */ -@@ -5032,7 +5062,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -5033,7 +5063,8 @@ static int rtm_to_fib6_config(struct sk_ if (rtm->rtm_type == RTN_UNREACHABLE || rtm->rtm_type == RTN_BLACKHOLE || rtm->rtm_type == RTN_PROHIBIT || @@ -185,7 +185,7 @@ Signed-off-by: Jonas Gorski cfg->fc_flags |= RTF_REJECT; if (rtm->rtm_type == RTN_LOCAL) -@@ -6286,6 +6317,8 @@ static int ip6_route_dev_notify(struct n +@@ -6287,6 +6318,8 @@ static int ip6_route_dev_notify(struct n #ifdef CONFIG_IPV6_MULTIPLE_TABLES net->ipv6.ip6_prohibit_entry->dst.dev = dev; net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev); @@ -194,7 +194,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_blk_hole_entry->dst.dev = dev; net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); #endif -@@ -6297,6 +6330,7 @@ static int ip6_route_dev_notify(struct n +@@ -6298,6 +6331,7 @@ static int ip6_route_dev_notify(struct n in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev); #ifdef CONFIG_IPV6_MULTIPLE_TABLES in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev); @@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev); #endif } -@@ -6488,6 +6522,8 @@ static int __net_init ip6_route_net_init +@@ -6489,6 +6523,8 @@ static int __net_init ip6_route_net_init #ifdef CONFIG_IPV6_MULTIPLE_TABLES net->ipv6.fib6_has_custom_rules = false; @@ -211,7 +211,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, sizeof(*net->ipv6.ip6_prohibit_entry), GFP_KERNEL); -@@ -6498,11 +6534,21 @@ static int __net_init ip6_route_net_init +@@ -6499,11 +6535,21 @@ static int __net_init ip6_route_net_init ip6_template_metrics, true); INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->rt6i_uncached); @@ -234,7 +234,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops; dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst, ip6_template_metrics, true); -@@ -6529,6 +6575,8 @@ out: +@@ -6530,6 +6576,8 @@ out: return ret; #ifdef CONFIG_IPV6_MULTIPLE_TABLES @@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski out_ip6_prohibit_entry: kfree(net->ipv6.ip6_prohibit_entry); out_ip6_null_entry: -@@ -6548,6 +6596,7 @@ static void __net_exit ip6_route_net_exi +@@ -6549,6 +6597,7 @@ static void __net_exit ip6_route_net_exi kfree(net->ipv6.ip6_null_entry); #ifdef CONFIG_IPV6_MULTIPLE_TABLES kfree(net->ipv6.ip6_prohibit_entry); @@ -251,7 +251,7 @@ Signed-off-by: Jonas Gorski kfree(net->ipv6.ip6_blk_hole_entry); #endif dst_entries_destroy(&net->ipv6.ip6_dst_ops); -@@ -6631,6 +6680,9 @@ void __init ip6_route_init_special_entri +@@ -6632,6 +6681,9 @@ void __init ip6_route_init_special_entri init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c index 77e25383b6e..bce8d563756 100644 --- a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7988-infracfg.c @@ -190,6 +190,13 @@ static const struct mtk_gate_regs infra3_cg_regs = { #define GATE_INFRA3(_id, _name, _parent, _shift) \ GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_CRITICAL(_id, _name, _parent, _regs, _shift) { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = _regs, .shift = _shift, \ + .flags = CLK_IS_CRITICAL, \ + .ops = &mtk_clk_gate_ops_setclr, \ + } + static const struct mtk_gate infra_clks[] = { /* INFRA0 */ GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P0, @@ -271,7 +278,7 @@ static const struct mtk_gate infra_clks[] = { "sysaxi_sel", 17), GATE_INFRA2(CLK_INFRA_66M_FLASHIF_AXI, "infra_hf_66m_flashif_axi", "sysaxi_sel", 18), - GATE_INFRA2(CLK_INFRA_RTC, "infra_f_frtc", "top_rtc_32k", 19), + GATE_CRITICAL(CLK_INFRA_RTC, "infra_f_frtc", "top_rtc_32k", &infra2_cg_regs, 19), GATE_INFRA2(CLK_INFRA_26M_ADC_BCK, "infra_f_26m_adc_bck", "csw_infra_f26m_sel", 20), GATE_INFRA2(CLK_INFRA_RC_ADC, "infra_f_frc_adc", "infra_f_26m_adc_bck", diff --git a/target/linux/mediatek/files-6.1/drivers/clk/mediatek/clk-mt7988-infracfg.c b/target/linux/mediatek/files-6.1/drivers/clk/mediatek/clk-mt7988-infracfg.c index 111b516ae56..a5d21d756d5 100644 --- a/target/linux/mediatek/files-6.1/drivers/clk/mediatek/clk-mt7988-infracfg.c +++ b/target/linux/mediatek/files-6.1/drivers/clk/mediatek/clk-mt7988-infracfg.c @@ -190,6 +190,13 @@ static const struct mtk_gate_regs infra3_cg_regs = { #define GATE_INFRA3(_id, _name, _parent, _shift) \ GATE_INFRA3_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_CRITICAL(_id, _name, _parent, _regs, _shift) { \ + .id = _id, .name = _name, .parent_name = _parent, \ + .regs = _regs, .shift = _shift, \ + .flags = CLK_IS_CRITICAL, \ + .ops = &mtk_clk_gate_ops_setclr, \ + } + static const struct mtk_gate infra_clks[] = { /* INFRA0 */ GATE_INFRA0(CLK_INFRA_PCIE_PERI_26M_CK_P0, @@ -271,7 +278,7 @@ static const struct mtk_gate infra_clks[] = { "sysaxi_sel", 17), GATE_INFRA2(CLK_INFRA_66M_FLASHIF_AXI, "infra_hf_66m_flashif_axi", "sysaxi_sel", 18), - GATE_INFRA2(CLK_INFRA_RTC, "infra_f_frtc", "top_rtc_32k", 19), + GATE_CRITICAL(CLK_INFRA_RTC, "infra_f_frtc", "top_rtc_32k", &infra2_cg_regs, 19), GATE_INFRA2(CLK_INFRA_26M_ADC_BCK, "infra_f_26m_adc_bck", "csw_infra_f26m_sel", 20), GATE_INFRA2(CLK_INFRA_RC_ADC, "infra_f_frc_adc", "infra_f_26m_adc_bck", diff --git a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch index a22a1124e9d..5ded06ff63f 100644 --- a/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-5.15/901-arm-add-cmdline-override.patch @@ -37,7 +37,7 @@ * managed to set the command line, unless CONFIG_CMDLINE_FORCE --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig -@@ -1983,6 +1983,14 @@ config CMDLINE_FORCE +@@ -2057,6 +2057,14 @@ config CMDLINE_FORCE endchoice diff --git a/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch b/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch new file mode 100644 index 00000000000..7221e04de1d --- /dev/null +++ b/target/linux/mvebu/patches-5.15/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch @@ -0,0 +1,22 @@ +From: Tomasz Maciej Nowak +Date: Fri, 7 Jul 2023 19:06:05 +0200 +Subject: [PATCH] arm64: dts: marvell: enable heartbeat LED by default + +Some boards could be placed in an enclosure, so enable LED18 by default, +since that'll be the only visible indicator that the board is operating. + +Signed-off-by: Tomasz Maciej Nowak +--- + arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts ++++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts +@@ -25,6 +25,7 @@ + function = LED_FUNCTION_HEARTBEAT; + color = ; + linux,default-trigger = "heartbeat"; ++ default-state = "on"; + }; + }; + }; diff --git a/target/linux/mvebu/patches-6.1/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch b/target/linux/mvebu/patches-6.1/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch new file mode 100644 index 00000000000..7221e04de1d --- /dev/null +++ b/target/linux/mvebu/patches-6.1/314-arm64-dts-marvell-enable-heartbeat-LED-by-default.patch @@ -0,0 +1,22 @@ +From: Tomasz Maciej Nowak +Date: Fri, 7 Jul 2023 19:06:05 +0200 +Subject: [PATCH] arm64: dts: marvell: enable heartbeat LED by default + +Some boards could be placed in an enclosure, so enable LED18 by default, +since that'll be the only visible indicator that the board is operating. + +Signed-off-by: Tomasz Maciej Nowak +--- + arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts ++++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin-singleshot.dts +@@ -25,6 +25,7 @@ + function = LED_FUNCTION_HEARTBEAT; + color = ; + linux,default-trigger = "heartbeat"; ++ default-state = "on"; + }; + }; + }; diff --git a/target/linux/qualcommax/config-6.1 b/target/linux/qualcommax/config-6.1 index ec44e936b44..6d5157afeb7 100644 --- a/target/linux/qualcommax/config-6.1 +++ b/target/linux/qualcommax/config-6.1 @@ -120,13 +120,10 @@ CONFIG_CRYPTO_LIB_SHA1=y CONFIG_CRYPTO_LIB_SHA256=y CONFIG_CRYPTO_LIB_UTILS=y CONFIG_CRYPTO_LZO=y -# CONFIG_CRYPTO_POLYVAL_ARM64_CE is not set CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_SHA1=y CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SM4_ARM64_CE_BLK is not set -# CONFIG_CRYPTO_SM4_ARM64_NEON_BLK is not set CONFIG_CRYPTO_XTS=y CONFIG_CRYPTO_ZSTD=y CONFIG_DCACHE_WORD_ACCESS=y diff --git a/target/linux/qualcommax/patches-6.1/0132-mmc-core-disable-TRIM-on-Micron-MTFC4GACAJCN-1M.patch b/target/linux/qualcommax/patches-6.1/0132-mmc-core-disable-TRIM-on-Micron-MTFC4GACAJCN-1M.patch deleted file mode 100644 index 0da71f1b097..00000000000 --- a/target/linux/qualcommax/patches-6.1/0132-mmc-core-disable-TRIM-on-Micron-MTFC4GACAJCN-1M.patch +++ /dev/null @@ -1,36 +0,0 @@ -From f5aaf6669bd4f1f0218dd7fd5dc90941267ad860 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Tue, 30 May 2023 23:26:30 +0200 -Subject: [PATCH] mmc: core: disable TRIM on Micron MTFC4GACAJCN-1M - -It seems that Micron MTFC4GACAJCN-1M despite advertising TRIM support does -not work when the core is trying to use REQ_OP_WRITE_ZEROES. - -We are seeing the following errors in OpenWrt under 6.1 on Qnap Qhora 301W -that we did not previously have and tracked it down to REQ_OP_WRITE_ZEROES: -[ 18.085950] I/O error, dev loop0, sector 596 op 0x9:(WRITE_ZEROES) flags 0x800 phys_seg 0 prio class 2 - -Disabling TRIM makes the error go away, so lets add a quirk for this eMMC -to disable TRIM. - -Signed-off-by: Robert Marko ---- - drivers/mmc/core/quirks.h | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/mmc/core/quirks.h -+++ b/drivers/mmc/core/quirks.h -@@ -124,6 +124,13 @@ static const struct mmc_fixup __maybe_un - MMC_QUIRK_TRIM_BROKEN), - - /* -+ * Micron MTFC4GACAJCN-1M advertises TRIM but it does not seems to -+ * support being used to offload WRITE_ZEROES. -+ */ -+ MMC_FIXUP("Q2J54A", CID_MANFID_MICRON, 0x014e, add_quirk_mmc, -+ MMC_QUIRK_TRIM_BROKEN), -+ -+ /* - * Some SD cards reports discard support while they don't - */ - MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd, diff --git a/target/linux/qualcommax/patches-6.1/0133-mmc-core-disable-TRIM-on-Kingston-EMMC04G-M627.patch b/target/linux/qualcommax/patches-6.1/0133-mmc-core-disable-TRIM-on-Kingston-EMMC04G-M627.patch deleted file mode 100644 index cc6f29e38e2..00000000000 --- a/target/linux/qualcommax/patches-6.1/0133-mmc-core-disable-TRIM-on-Kingston-EMMC04G-M627.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 26c97b6fb7d291f55e0e4a410d266d1355118ed9 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 31 May 2023 20:21:26 +0200 -Subject: [PATCH] mmc: core: disable TRIM on Kingston EMMC04G-M627 - -It seems that Kingston EMMC04G-M627 despite advertising TRIM support does -not work when the core is trying to use REQ_OP_WRITE_ZEROES. - -We are seeing I/O errors in OpenWrt under 6.1 on Zyxel NBG7815 that we did -not previously have and tracked it down to REQ_OP_WRITE_ZEROES. - -Trying to use fstrim seems to also throw errors like: -[93010.835112] I/O error, dev loop0, sector 16902 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 2 - -Disabling TRIM makes the error go away, so lets add a quirk for this eMMC -to disable TRIM. - -Signed-off-by: Robert Marko ---- - drivers/mmc/core/quirks.h | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/mmc/core/quirks.h -+++ b/drivers/mmc/core/quirks.h -@@ -131,6 +131,13 @@ static const struct mmc_fixup __maybe_un - MMC_QUIRK_TRIM_BROKEN), - - /* -+ * Kingston EMMC04G-M627 advertises TRIM but it does not seems to -+ * support being used to offload WRITE_ZEROES. -+ */ -+ MMC_FIXUP("M62704", CID_MANFID_KINGSTON, 0x0100, add_quirk_mmc, -+ MMC_QUIRK_TRIM_BROKEN), -+ -+ /* - * Some SD cards reports discard support while they don't - */ - MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd, diff --git a/target/linux/sunxi/image/cortexa7.mk b/target/linux/sunxi/image/cortexa7.mk index 5b9f27cef80..e14db24eb20 100644 --- a/target/linux/sunxi/image/cortexa7.mk +++ b/target/linux/sunxi/image/cortexa7.mk @@ -104,7 +104,8 @@ TARGET_DEVICES += sinovoip_bananapi-m2-ultra define Device/lemaker_bananapro DEVICE_VENDOR := LeMaker DEVICE_MODEL := Banana Pro - DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-sunxi kmod-brcmfmac + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-sunxi kmod-brcmfmac \ + cypress-firmware-43362-sdio wpad-basic-mbedtls SOC := sun7i-a20 endef TARGET_DEVICES += lemaker_bananapro @@ -176,6 +177,15 @@ define Device/sinovoip_bananapi-m2-plus endef TARGET_DEVICES += sinovoip_bananapi-m2-plus +define Device/sinovoip_bananapi-m3 + DEVICE_VENDOR := Sinovoip + DEVICE_MODEL := Banana Pi M3 + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-leds-gpio kmod-rtc-ac100 \ + kmod-brcmfmac cypress-firmware-43430-sdio wpad-basic-mbedtls + SOC := sun8i-a83t +endef +TARGET_DEVICES += sinovoip_bananapi-m3 + define Device/xunlong_orangepi-one DEVICE_VENDOR := Xunlong DEVICE_MODEL := Orange Pi One diff --git a/target/linux/sunxi/modules.mk b/target/linux/sunxi/modules.mk index 8bbafe98a7b..28ed86ba4c9 100644 --- a/target/linux/sunxi/modules.mk +++ b/target/linux/sunxi/modules.mk @@ -2,6 +2,40 @@ # # Copyright (C) 2013-2016 OpenWrt.org +define KernelPackage/mfd-ac100 + SUBMENU:=$(OTHER_MENU) + TITLE:=X-Powers AC100 MFD support + DEPENDS:=@TARGET_sunxi + KCONFIG:= \ + CONFIG_MFD_AC100 + FILES:=$(LINUX_DIR)/drivers/mfd/ac100.ko + AUTOLOAD:=$(call AutoLoad,50,ac100) +endef + +define KernelPackage/mfd-ac100/description + Support for the X-Powers AC100 RTC/audio chip +endef + +$(eval $(call KernelPackage,mfd-ac100)) + +define KernelPackage/rtc-ac100 + SUBMENU:=$(OTHER_MENU) + TITLE:=X-Powers AC100 RTC support + DEPENDS:=@TARGET_sunxi +kmod-mfd-ac100 + $(call AddDepends/rtc) + KCONFIG:= \ + CONFIG_RTC_DRV_AC100 \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ac100.ko + AUTOLOAD:=$(call AutoLoad,50,rtc-ac100) +endef + +define KernelPackage/rtc-ac100/description + Support for the X-Powers AC100 RTC +endef + +$(eval $(call KernelPackage,rtc-ac100)) + define KernelPackage/rtc-sunxi SUBMENU:=$(OTHER_MENU) TITLE:=Sunxi SoC built-in RTC support