Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 0x4A6F-master
  • 0x4A6F-rpi4
  • autinerd/experimental-openwrt-24.10
  • experimental
  • feature/addMikrotikwAP
  • master
  • nrb/airmax-test
  • nrb/ar9344-reset-sequence
  • nrb/ex400-remove-wps
  • nrb/gluon-master-cpe510
  • nrb/test-radv-filter
  • nrbffs/fastd-remove-delay
  • nrbffs/netgear-ex6120
  • v2018.2.2-ffs
  • v2018.2.3-ffs
  • v2019.1-ffs
  • v2019.1.1-ffs
  • v2019.1.2-ffs
  • v2020.1-ffs
  • v2020.1.1-ffs
  • v2020.1.3-ffs
  • v2020.2-ffs
  • v2020.2.1-ffs
  • v2020.2.2-ffs
  • v2020.2.3-ffs
  • v2021.1-ffs
  • v2021.1.1-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • v2022.1.3-ffs
  • v2022.1.4-ffs
  • v2023.1-ffs
  • v2023.2-ffs
  • v2023.2.2-ffs
  • v2023.2.3-ffs
  • v2023.2.4-ffs
  • v2023.2.5-ffs
  • experimental-2022-09-24
  • experimental-2022-09-24-base
  • experimental-2023-03-11
  • experimental-2023-03-11-base
  • experimental-2023-03-12
  • experimental-2023-03-12-base
  • experimental-2023-03-16
  • experimental-2023-03-16-base
  • experimental-2023-03-20
  • experimental-2023-03-20-base
  • experimental-2023-03-23
  • experimental-2023-03-23-base
  • experimental-2023-03-25
  • experimental-2023-03-25-base
  • experimental-2023-03-26
  • experimental-2023-03-26-base
  • experimental-2023-03-30
  • experimental-2023-03-30-base
  • experimental-2023-03-31
  • experimental-2023-03-31-base
  • experimental-2023-04-01
  • experimental-2023-04-01-base
  • experimental-2023-04-08
  • experimental-2023-04-08-base
  • experimental-2023-04-10
  • experimental-2023-04-10-base
  • experimental-2023-04-13
  • experimental-2023-04-13-base
  • experimental-2023-04-15
  • experimental-2023-04-15-base
  • experimental-2023-04-16
  • experimental-2023-04-16-base
  • experimental-2023-04-18
  • experimental-2023-04-18-base
  • experimental-2023-04-20
  • experimental-2023-04-20-base
  • experimental-2023-04-26
  • experimental-2023-04-26-base
  • experimental-2023-04-28
  • experimental-2023-04-28-base
  • experimental-2023-04-30
  • experimental-2023-04-30-base
  • experimental-2023-05-02
  • experimental-2023-05-02-base
  • experimental-2023-05-03
  • experimental-2023-05-03-base
  • experimental-2023-05-12
  • experimental-2023-05-12-base
  • experimental-2023-05-21
  • experimental-2023-05-21-base
  • experimental-2023-05-25
  • experimental-2023-05-25-base
  • experimental-2023-07-02
  • experimental-2023-07-02-base
  • experimental-2023-07-04
  • experimental-2023-07-04-base
  • experimental-2023-07-12
  • experimental-2023-07-12-base
  • experimental-2023-07-16
  • experimental-2023-07-16-base
  • experimental-2023-08-04
  • experimental-2023-08-04-base
  • experimental-2023-08-10
  • experimental-2023-08-10-base
  • experimental-2023-09-08
  • experimental-2023-09-08-base
  • experimental-2023-09-09
  • experimental-2023-09-09-base
  • experimental-2023-09-10
  • experimental-2023-09-10-base
  • experimental-2023-09-11
  • experimental-2023-09-11-base
  • experimental-2023-09-12
  • experimental-2023-09-12-base
  • experimental-2023-09-13
  • experimental-2023-09-13-base
  • experimental-2023-09-15
  • experimental-2023-09-15-base
  • experimental-2023-09-16
  • experimental-2023-09-16-base
  • experimental-2023-09-18
  • experimental-2023-09-18-base
  • experimental-2023-09-20
  • experimental-2023-09-20-base
  • experimental-2023-09-27
  • experimental-2023-09-27-base
  • experimental-2023-09-28
  • experimental-2023-09-28-base
  • experimental-2023-09-29
  • experimental-2023-09-29-base
  • experimental-2023-10-02
  • experimental-2023-10-02-base
  • experimental-2023-10-13
  • experimental-2023-10-13-base
  • experimental-2023-10-14
  • experimental-2023-10-14-base
  • experimental-2023-10-16
  • experimental-2023-10-16-base
  • experimental-2023-10-23
  • experimental-2023-10-23-base
137 results

Target

Select target project
  • firmware/gluon
  • 0x4A6F/gluon
  • patrick/gluon
3 results
Select Git revision
  • 0x4A6F-master
  • 0x4A6F-rpi4
  • 2014.3.x
  • 2014.4.x
  • babel
  • experimental
  • hoodselector
  • master
  • nrb/gluon-master-cpe510
  • nrb/test-radv-filter
  • nrbffs/fastd-remove-delay
  • nrbffs/netgear-ex6120
  • radv-filterd
  • v2015.1.x
  • v2016.1.x
  • v2016.2.4-batmanbug
  • v2016.2.x
  • v2018.2.2-ffs
  • v2018.2.3-ffs
  • v2018.2.x
  • v2019.1-ffs
  • v2019.1.1-ffs
  • v2019.1.2-ffs
  • v2020.1-ffs
  • v2020.1.1-ffs
  • v2020.1.3-ffs
  • v2020.2-ffs
  • v2020.2.1-ffs
  • v2020.2.2-ffs
  • v2020.2.3-ffs
  • v2020.2.x
  • v2021.1-ffs
  • v2021.1.1-ffs
  • v2021.1.2-ffs
  • v2014.1
  • v2014.2
  • v2014.3
  • v2014.3.1
  • v2014.4
  • v2015.1
  • v2015.1.1
  • v2015.1.2
  • v2016.1
  • v2016.1.1
  • v2016.1.2
  • v2016.1.3
  • v2016.1.4
  • v2016.1.5
  • v2016.1.6
  • v2016.2
  • v2016.2.1
  • v2016.2.2
  • v2016.2.3
  • v2016.2.4
  • v2016.2.5
  • v2016.2.6
  • v2016.2.7
  • v2017.1
  • v2017.1.1
  • v2017.1.2
  • v2017.1.3
  • v2017.1.4
  • v2017.1.5
  • v2017.1.6
  • v2017.1.7
  • v2017.1.8
  • v2018.1
  • v2018.1.1
  • v2018.1.2
  • v2018.1.3
  • v2018.1.4
  • v2018.2
  • v2018.2-ffs0.1
  • v2018.2.1
  • v2018.2.1-ffs0.1
  • v2018.2.2-ffs0.1
  • v2018.2.3-ffs0.1
  • v2019.1-ffs0.1
  • v2019.1.1-ffs0.1
  • v2019.1.2-ffs0.1
  • v2020.1-ffs0.1
  • v2020.1.1-ffs0.1
  • v2020.1.3-ffs0.1
  • v2020.2
  • v2020.2-ffs0.1
  • v2020.2.1-ffs0.1
  • v2020.2.2-ffs0.1
  • v2020.2.3-ffs0.1
  • v2020.2.3-ffs0.2
  • v2020.2.3-ffs0.3
  • v2020.2.x-ffs0.1
  • v2021.1-ffs0.1
  • v2021.1.1-ffs0.1
  • v2021.1.1-ffs0.2
  • v2021.1.1-ffs0.3
  • v2021.1.1-ffs0.4
  • v2021.1.2-ffs0.1
  • v2021.1.2-ffs0.2
98 results
Show changes
Showing
with 1103 additions and 698 deletions
From: Sven Eckelmann <sven@narfation.org>
Date: Mon, 25 Feb 2019 20:42:28 +0100
Subject: mac80211: ath10k: fix incorrect multicast/broadcast rate setting
If no mcast_rate is set for the wifi-iface then there is no rate_idx (0)
set for the bss. This breaks for example 5GHz meshpoint interfaces because
0 maps to a CCK rate (11Mbit/s).
Fixes: db90c243a0b9 ("mac80211: update to version based on 4.19-rc4")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
diff --git a/package/kernel/mac80211/patches/979-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch b/package/kernel/mac80211/patches/979-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8695b7e094885bb479e14386a0461a25cf57603d
--- /dev/null
+++ b/package/kernel/mac80211/patches/979-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch
@@ -0,0 +1,43 @@
+From: Pradeep kumar Chitrapu <pradeepc@codeaurora.org>
+Date: Mon, 10 Dec 2018 20:56:11 -0800
+Subject: ath10k: fix incorrect multicast/broadcast rate setting
+
+Invalid rate code is sent to firmware when multicast rate value of 0 is
+sent to driver indicating disabled case, causing broken mesh path.
+so fix that.
+
+Tested on QCA9984 with firmware 10.4-3.6.1-00827
+
+Fixes: cd93b83ad92 ("ath10k: support for multicast rate control")
+Co-developed-by: Zhi Chen <zhichen@codeaurora.org>
+Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
+Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
+
+Origin: other, https://patchwork.kernel.org/patch/10723033/
+
+--- a/drivers/net/wireless/ath/ath10k/mac.c
++++ b/drivers/net/wireless/ath/ath10k/mac.c
+@@ -5484,8 +5484,8 @@ static void ath10k_bss_info_changed(stru
+ struct cfg80211_chan_def def;
+ u32 vdev_param, pdev_param, slottime, preamble;
+ u16 bitrate, hw_value;
+- u8 rate, basic_rate_idx;
+- int rateidx, ret = 0, hw_rate_code;
++ u8 rate, basic_rate_idx, rateidx;
++ int ret = 0, hw_rate_code, mcast_rate;
+ enum nl80211_band band;
+ const struct ieee80211_supported_band *sband;
+
+@@ -5658,7 +5658,11 @@ static void ath10k_bss_info_changed(stru
+ if (changed & BSS_CHANGED_MCAST_RATE &&
+ !WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) {
+ band = def.chan->band;
+- rateidx = vif->bss_conf.mcast_rate[band] - 1;
++ mcast_rate = vif->bss_conf.mcast_rate[band];
++ if (mcast_rate > 0)
++ rateidx = mcast_rate - 1;
++ else
++ rateidx = ffs(vif->bss_conf.basic_rates) - 1;
+
+ if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY)
+ rateidx += ATH10K_MAC_FIRST_OFDM_RATE_IDX;
From: David Bauer <mail@david-bauer.net>
Date: Thu, 9 May 2019 18:01:13 +0200
Subject: ramips: fix R6120 factory image
The factory firmware omits the JFFS2 end-marker while flashing via
web-interface. Add a 64k padding after the marker fixes this problem.
When the end-marker is not present, OpenWRT won't save the overlayfs
after initial flash.
Reported-by: Andreas Ziegler <dev@andreas-ziegler.de>
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index f1bf78e0713a1bc47d4ac384efdac1d08c1bd8bc..a096720b09be18bae450edaab187df8be734fe13 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -118,7 +118,7 @@ define Device/netgear_r6120
IMAGES += factory.img
IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE)| append-rootfs | pad-rootfs
IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
- IMAGE/factory.img := pad-extra 576k | $$(IMAGE/default) | \
+ IMAGE/factory.img := pad-extra 576k | $$(IMAGE/default) | pad-to $$$$(BLOCKSIZE) | \
sercom-footer | pad-to 128 | zip R6120.bin | sercom-seal
endef
TARGET_DEVICES += netgear_r6120
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Wed, 10 Oct 2018 20:05:53 +0200
Subject: firmware-utils: tplink-safeloader: Add CPE210 v3
Add TP-Link CPE210 v3 to the support list.
It's identical to the v2.
Signed-off-by: Robert Marko <robimarko@gmail.com>
[Use separate definition to prevent cross-updates]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 4b227e1c97b6c5b236dba29dbdd5f0bcd68621cb..de15faf6796c993efc6c2a36b22bb1e978e3be90 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -197,6 +197,42 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "support-list",
},
+ /** Firmware layout for the CPE210 V3 */
+ {
+ .id = "CPE210V3",
+ .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n",
+ .support_list =
+ "SupportList:\r\n"
+ "CPE210(TP-LINK|EU|N300-2|45550000):3.0\r\n"
+ "CPE210(TP-LINK|UN|N300-2|00000000):3.0\r\n"
+ "CPE210(TP-LINK|UN|N300-2):3.0\r\n"
+ "CPE210(TP-LINK|EU|N300-2):3.0\r\n",
+ .support_trail = '\xff',
+ .soft_ver = NULL,
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"partition-table", 0x20000, 0x02000},
+ {"default-mac", 0x30000, 0x00020},
+ {"product-info", 0x31100, 0x00100},
+ {"device-info", 0x31400, 0x00400},
+ {"signature", 0x32000, 0x00400},
+ {"device-id", 0x33000, 0x00100},
+ {"os-image", 0x40000, 0x1c0000},
+ {"file-system", 0x200000, 0x5b0000},
+ {"soft-version", 0x7b0000, 0x00100},
+ {"support-list", 0x7b1000, 0x01000},
+ {"user-config", 0x7c0000, 0x10000},
+ {"default-config", 0x7d0000, 0x10000},
+ {"log", 0x7e0000, 0x10000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "support-list",
+ },
+
/** Firmware layout for the CPE510/520 */
{
.id = "CPE510",
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Wed, 10 Oct 2018 20:13:09 +0200
Subject: ar71xx: Add support for TP-Link CPE210 v3
Looks identical to the v2
This PR adds support for a popular low-cost 2.4GHz N based AP
Specifications:
- SoC: Qualcomm Atheros QCA9533 (650MHz)
- RAM: 64MB
- Storage: 8 MB SPI NOR
- Wireless: 2.4GHz N based built into SoC 2x2
- Ethernet: 1x 100/10 Mbps, integrated into SoC, 24V POE IN
Installation:
Flash factory image through stock firmware WEB UI or
through TFTP
To get to TFTP recovery just hold reset button while
powering on for around 4-5 seconds and release.
Rename factory image to recovery.bin
Stock TFTP server IP:192.168.0.100
Stock device TFTP address:192.168.0.254
Signed-off-by: Robert Marko <robimarko@gmail.com>
[Adjusted for separate safeloader entry, do not inherit device
definition from cpe210-v2]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds
index 23f3d23bf53883fb08944bc65b98cac06a16c0a5..e0222f3637b60b89a6ef6c0d10cfb20fbe73f075 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -249,6 +249,7 @@ cf-e530n)
;;
cpe210|\
cpe210-v2|\
+cpe210-v3|\
cpe510|\
wbs210|\
wbs510)
@@ -259,7 +260,8 @@ wbs510)
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "76" "100" "-75" "13"
case "$board" in
- cpe210-v2)
+ cpe210-v2|\
+ cpe210-v3)
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan0" "eth0"
;;
*)
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index e9522252a2b8ba7de1c8ca7d070ff7f2897aade9..386d93e58451b953937320b1bfe8d71ed73c69fd 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -75,6 +75,7 @@ ar71xx_setup_interfaces()
cf-e380ac-v1|\
cf-e380ac-v2|\
cpe210-v2|\
+ cpe210-v3|\
dr342|\
eap120|\
eap300v2|\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index ccbd4e77c324a36e7fba6e6dccad59d8f94a3921..2200069c647b33220126e797b6a61928d1fb428e 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -583,6 +583,10 @@ ar71xx_board_detect() {
name="cpe210-v2"
tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)"
;;
+ *"CPE210 v3")
+ name="cpe210-v3"
+ tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)"
+ ;;
*"CPE505N")
name="cpe505n"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index ca1270b7fdc84c53f8417c226f18ca4fff1f27d8..a04dd7441d28e9db4dc7c744707bb5f35936da00 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -587,7 +587,8 @@ platform_check_image() {
tplink_pharos_check_image "$1" "7f454c46" "$(tplink_pharos_get_model_string)" '' && return 0
return 1
;;
- cpe210-v2)
+ cpe210-v2|\
+ cpe210-v3)
tplink_pharos_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0
return 1
;;
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
index ceb1769ddd522d51014228fe65e2662f2f3e627c..f25a69f08e8a69d9b6de0ca9d7d7d14f8dff5fa0 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
@@ -236,6 +236,9 @@ MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
MIPS_MACHINE(ATH79_MACH_CPE210_V2, "CPE210V2", "TP-LINK CPE210 v2",
cpe210_v2_setup);
+MIPS_MACHINE(ATH79_MACH_CPE210_V3, "CPE210V3", "TP-LINK CPE210 v3",
+ cpe210_v2_setup);
+
MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520",
cpe510_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 80f6e1d95b7a4e5559e7d5da041b32d962ad4e84..c82cb17cf613bdb3796a15e384215d4579767468 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -75,6 +75,7 @@ enum ath79_mach_type {
ATH79_MACH_CF_E530N, /* COMFAST CF-E530N */
ATH79_MACH_CPE210, /* TP-LINK CPE210 v1 */
ATH79_MACH_CPE210_V2, /* TP-LINK CPE210 v2 */
+ ATH79_MACH_CPE210_V3, /* TP-LINK CPE210 v3 */
ATH79_MACH_CPE505N, /* P&W CPE505N */
ATH79_MACH_CPE510, /* TP-LINK CPE510 */
ATH79_MACH_CPE830, /* YunCore CPE830 */
diff --git a/target/linux/ar71xx/image/generic-tp-link.mk b/target/linux/ar71xx/image/generic-tp-link.mk
index daf6c35ae4610d844bd9e8f44ea5deab72143a48..8ad1f6e38228b639d1d127937ba875c030a6a632 100644
--- a/target/linux/ar71xx/image/generic-tp-link.mk
+++ b/target/linux/ar71xx/image/generic-tp-link.mk
@@ -195,6 +195,18 @@ define Device/cpe210-v2
endef
TARGET_DEVICES += cpe210-v2
+define Device/cpe210-v3
+ $(Device/cpexxx)
+ DEVICE_TITLE := TP-LINK CPE210 v3
+ BOARDNAME := CPE210V3
+ TPLINK_BOARD_ID := CPE210V3
+ KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header
+ TPLINK_HWID := 0x0
+ TPLINK_HWREV := 0
+ TPLINK_HEADER_VERSION := 1
+endef
+TARGET_DEVICES += cpe210-v3
+
define Device/wbs210-v1
$(Device/cpe510-520-v1)
DEVICE_TITLE := TP-LINK WBS210 v1
From: David Bauer <mail@david-bauer.net>
Date: Sun, 23 Jun 2019 15:10:01 +0200
Subject: ramips: add support for ASUS RT-AC57U
SoC: MediaTek MT7621AT
RAM: 128M (Winbond W631GG6KB-15)
FLASH: 16MB (Spansion S25FL128SA)
WiFi: MediaTek MT7603EN bgn 2SS
WiFi: MediaTek MT7612EN nac 2SS
BTN: Reset - WPS
LED: - Power
- LAN {1-4}
- WAN
- WiFi 2.4 GHz
- WiFi 5 GHz
- USB
UART: UART is present next to the Power LED.
TX - RX - GND - 3V3 / 57600-8N1
3V3 is the nearest one to the Power LED.
Installation
------------
Via TFTP:
1. Set your computers IP-Address to 192.168.1.75.
2. Power up the Router with the Reset button pressed.
3. Release the Reset button after 5 seconds.
4. Upload OpenWRT sysupgrade image via TFTP:
> tftp -4 -v -m binary 192.168.1.1 -c put <IMAGE>
Via SSH:
Note: User/password for SSH is identical with the one used in the
Web-interface.
1. Complete the initial setup wizard.
2. Activate SSH under "Administration" -> "System".
3. Transfer the OpenWrt sysupgrade image via scp:
> scp owrt.bin admin@192.168.1.1:/tmp
4. Connect via SSH to the router.
> ssh admin@192.168.1.1
5. Write the OpenWrt image to flash.
> mtd-write -i /tmp/owrt.bin -d linux
6. Reboot the router
> reboot
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 9424c7ddfd64f9149a24ff91e63b71990265d211..7ceec7742aa7a0248ea3c31053b9adda2b247c9c 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -186,6 +186,7 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;;
+ asus,rt-ac57u|\
atp-52b|\
awm002-evb-4M|\
awm002-evb-8M|\
@@ -413,6 +414,11 @@ ramips_setup_macs()
wmdr-143n)
lan_mac=$(cat /sys/class/net/eth0/address)
;;
+ asus,rt-ac57u|\
+ vr500)
+ lan_mac=$(mtd_get_mac_binary factory 57344)
+ wan_mac=$(mtd_get_mac_binary factory 57350)
+ ;;
all0239-3g|\
carambola|\
freestation5|\
@@ -541,10 +547,6 @@ ramips_setup_macs()
lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
;;
- vr500)
- lan_mac=$(mtd_get_mac_binary factory 57344)
- wan_mac=$(mtd_get_mac_binary factory 57350)
- ;;
w306r-v20)
lan_mac=$(cat /sys/class/net/eth0/address)
wan_mac=$(macaddr_add "$lan_mac" 5)
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 097cc6df569518f64dbfd641eeccc1a4b1b37a2b..16e482c3879ff727faea9ffde31da634004fee93 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -141,6 +141,7 @@ get_status_led() {
youhua,wr1200js)
status_led="$boardname:blue:wps"
;;
+ asus,rt-ac57u|\
d240|\
dap-1350|\
na930|\
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 7213b22d0c2734488bd96bc34e921f08649b8c2f..e4d813341b0e4d1ac804ee8cf0ec258e9c08fcd1 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -27,6 +27,7 @@ platform_check_image() {
ar725w|\
asl26555-8M|\
asl26555-16M|\
+ asus,rt-ac57u|\
awapn2403|\
awm002-evb-4M|\
awm002-evb-8M|\
diff --git a/target/linux/ramips/dts/RT-AC57U.dts b/target/linux/ramips/dts/RT-AC57U.dts
new file mode 100644
index 0000000000000000000000000000000000000000..cdab94676e13d259eb80afbcb28347d75d1f08f6
--- /dev/null
+++ b/target/linux/ramips/dts/RT-AC57U.dts
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "asus,rt-ac57u", "mediatek,mt7621-soc";
+ model = "ASUS RT-AC57U";
+
+ aliases {
+ led-boot = &led_power;
+ led-failsafe = &led_power;
+ led-running = &led_power;
+ led-upgrade = &led_power;
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x8000000>;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,57600";
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_power: power {
+ label = "rt-ac57u:blue:power";
+ gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
+ };
+
+ usb {
+ label = "rt-ac57u:blue:usb";
+ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys-polled";
+ poll-interval = <20>;
+
+ wps {
+ label = "wps";
+ gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_WPS_BUTTON>;
+ };
+
+ reset {
+ label = "reset";
+ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+
+ led-regulator {
+ compatible = "regulator-fixed";
+ regulator-name = "LED-Power";
+ gpio = <&gpio1 14 GPIO_ACTIVE_LOW>;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-always-on;
+ };
+};
+
+&spi0 {
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x30000>;
+ read-only;
+ };
+
+ partition@30000 {
+ label = "config";
+ reg = <0x30000 0x10000>;
+ read-only;
+ };
+
+ factory: partition@40000 {
+ label = "factory";
+ reg = <0x40000 0x10000>;
+ read-only;
+ };
+
+ partition@50000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x50000 0xfb0000>;
+ };
+ };
+ };
+};
+
+&pcie {
+ status = "okay";
+
+ pcie0 {
+ wifi@0,0 {
+ reg = <0x0000 0 0 0 0>;
+ mediatek,mtd-eeprom = <&factory 0x8000>;
+ device_type = "pci";
+
+ led {
+ led-sources = <2>;
+ led-active-low;
+ };
+ };
+ };
+
+ pcie1 {
+ wifi@0,0 {
+ reg = <0x0000 0 0 0 0>;
+ mediatek,mtd-eeprom = <&factory 0x0000>;
+ device_type = "pci";
+
+ led {
+ led-active-low;
+ };
+ };
+ };
+};
+
+&ethernet {
+ mtd-mac-address = <&factory 0x4e000>;
+};
+
+&pinctrl {
+ state_default: pinctrl0 {
+ gpio {
+ ralink,group = "sdhci";
+ ralink,function = "gpio";
+ };
+ };
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index c8de8bd5ff7d1bec4de5c4ffd84a589892871ecb..e0f8cc65ebbfc93b4bfd765db5e62b5afda27c40 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -49,6 +49,14 @@ define Device/11acnas
endef
TARGET_DEVICES += 11acnas
+define Device/asus_rt-ac57u
+ DTS := RT-AC57U
+ DEVICE_TITLE := ASUS RT-AC57U
+ IMAGE_SIZE := $(ralink_default_fw_size_16M)
+ DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-basic
+endef
+TARGET_DEVICES += asus_rt-ac57u
+
define Device/dir-860l-b1
DTS := DIR-860L-B1
BLOCKSIZE := 64k
diff --git a/target/linux/ramips/mt7621/config-4.14 b/target/linux/ramips/mt7621/config-4.14
index 2ea80a3ab0c174374fa8febc19031ff5a4dae4c3..0e060237802f2b1d6918f65894368934c225cb17 100644
--- a/target/linux/ramips/mt7621/config-4.14
+++ b/target/linux/ramips/mt7621/config-4.14
@@ -228,6 +228,8 @@ CONFIG_RCU_STALL_COMMON=y
CONFIG_REGMAP=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SPI=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_RESET_CONTROLLER=y
CONFIG_RFS_ACCEL=y
CONFIG_RPS=y
From: Nico <github@nicoboehr.de>
Date: Mon, 26 Apr 2021 14:12:43 +0000
Subject: fastd: remove random delay on inital handshake
When a peer limit is defined, fastd will by default randomly delay
the inital handshake. As our gateways delay their handshake to
better distribute their load, this is undesireable.
diff --git a/net/fastd/patches/0100-remove-random-delay-on-inital-handshake.patch b/net/fastd/patches/0100-remove-random-delay-on-inital-handshake.patch
new file mode 100644
index 0000000000000000000000000000000000000000..40ca26812bda65d8b08a1034e23d1b2335c77259
--- /dev/null
+++ b/net/fastd/patches/0100-remove-random-delay-on-inital-handshake.patch
@@ -0,0 +1,23 @@
+--- a/src/peer.c
++++ b/src/peer.c
+@@ -322,19 +322,11 @@ static void reset_peer(fastd_peer_t *pee
+
+ /**
+ Starts the first handshake with a newly setup peer
+-
+- If a peer group has a peer limit the handshakes will be delayed between 0 and 3 seconds
+- make the choice of peers random (it will be biased by the latency, which might or might not be
+- what a user wants)
+ */
+ static void init_handshake(fastd_peer_t *peer) {
+- unsigned delay = 0;
+- if (has_group_config_constraints(peer->group))
+- delay = fastd_rand(0, 3000);
+-
+ peer->state = STATE_HANDSHAKE;
+
+- fastd_peer_schedule_handshake(peer, delay);
++ fastd_peer_schedule_handshake(peer, 0);
+ }
+
+ /** Handles an asynchronous DNS resolve response */
From: Nico <github@nicoboehr.de>
Date: Fri, 29 Dec 2023 23:17:27 +0000
Subject: uradvd: add patch to announce prefix with preferred lifetime 0
diff --git a/net/uradvd/patches/001-uradvd-announce-with-pref-0.patch b/net/uradvd/patches/001-uradvd-announce-with-pref-0.patch
new file mode 100644
index 0000000000000000000000000000000000000000..7882639d1bfec0923460c93f55fe9f44e58212c1
--- /dev/null
+++ b/net/uradvd/patches/001-uradvd-announce-with-pref-0.patch
@@ -0,0 +1,11 @@
+--- a/uradvd.c
++++ b/uradvd.c
+@@ -43,7 +43,7 @@
+
+ /* These are in seconds */
+ #define AdvValidLifetime 86400u
+-#define AdvPreferredLifetime 14400u
++#define AdvPreferredLifetime 0u
+ #define AdvDefaultLifetime 0u
+ #define AdvCurHopLimit 64u
+ #define AdvRDNSSLifetime 1200u
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 25 Apr 2025 02:06:17 +0200
Subject: perl: replace 910-miniperl-needs-inc-dot.patch with smaller scope fix
The patch was first introduced in commit 4a94479f9652 ("perl: update to
5.26.1") to fix the target build when the host perl has
default_inc_excludes_dot enabled. It just added back the `-I`. to every
call of miniperl; this solution is questionable however, as it adds `.` to
the beginning of the search path, not as a final fallback like perl did
before default_inc_excludes_dot (and like miniperl does).
It is also not necessary - only two scripts, write_buildcustomize.pl and
configpm, expect to be able to include a file from `.` (in both cases a
file the script just generated). Just fix the two scripts instead.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/lang/perl/patches/910-fix-default_inc_excludes_dot.patch b/lang/perl/patches/910-fix-default_inc_excludes_dot.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ab3e6243bda314f137d1c328fbbf0e7f3bb34f36
--- /dev/null
+++ b/lang/perl/patches/910-fix-default_inc_excludes_dot.patch
@@ -0,0 +1,22 @@
+--- a/write_buildcustomize.pl
++++ b/write_buildcustomize.pl
+@@ -3,7 +3,7 @@
+ use strict;
+
+ my $osname = $^O;
+-my $file = 'lib/buildcustomize.pl';
++my $file = './lib/buildcustomize.pl';
+
+ if ( @ARGV % 2 ) {
+ my $dir = shift;
+--- a/configpm
++++ b/configpm
+@@ -129,7 +129,7 @@ if ($Opts{chdir}) {
+ my ($Config_SH, $Config_PM, $Config_heavy, $Config_POD);
+ my $Glossary = 'Porting/Glossary';
+
+-$Config_PM = "lib/Config.pm";
++$Config_PM = "./lib/Config.pm";
+ $Config_POD = "lib/Config.pod";
+ $Config_SH = "config.sh";
+
diff --git a/lang/perl/patches/910-miniperl-needs-inc-dot.patch b/lang/perl/patches/910-miniperl-needs-inc-dot.patch
deleted file mode 100644
index 6997f04d575e5bb92e78052cf693ae39bb464a20..0000000000000000000000000000000000000000
--- a/lang/perl/patches/910-miniperl-needs-inc-dot.patch
+++ /dev/null
@@ -1,38 +0,0 @@
---- a/Makefile.SH
-+++ b/Makefile.SH
-@@ -346,7 +346,7 @@ OBJ_EXT = $_o
- # Macros to invoke a copy of miniperl during the build. Targets which
- # are built using these macros should depend on \$(MINIPERL_EXE)
- MINIPERL_EXE = miniperl\$(EXE_EXT)
--MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE_EXT) -Ilib
-+MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE_EXT) -Ilib -I.
-
- # Macros to invoke sort the MANIFEST during build
- MANIFEST_SRT = MANIFEST.srt
-@@ -1001,7 +1001,7 @@ lib/buildcustomize.pl: $& $(miniperl_obj
- @$(RMS) miniperl.xok
- $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
- $(miniperl_objs) $(libs)
-- $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
-+ $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -I. -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
- $(MINIPERL) -f write_buildcustomize.pl
- !NO!SUBS!
- ;;
-@@ -1012,7 +1012,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_d
- @\$(RMS) miniperl.xok
- @\$(RMS) \$(MINIPERL_EXE)
- \$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
-- \$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
-+ \$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -I. -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
- \$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
- !GROK!THIS!
- else
-@@ -1021,7 +1021,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep
- @$(RMS) miniperl.xok
- $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
- $(miniperl_objs) $(libs)
-- $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
-+ $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -I. -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
- $(MINIPERL) -f write_buildcustomize.pl
- !NO!SUBS!
- fi
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 25 Apr 2025 12:35:23 +0200
Subject: perl: drop 110-always_use_miniperl.patch
The patch was introduced in commit 4c57844f0f04 ("lang/perl: Add hack to
make perl always use miniperl during build"), but it is not actually
necessary. By setting $perl to a non-empty value (using 'perl' as is
common on desktop distros), the logic works as intended and selects the
correct perl binary for host and target builds.
As miniperl just symlinks to host perl for target builds, the main
effect of this change is not unconditionally passing `-Ilib -I.`
anymore. This seems like a good thing; host libraries should be used
with host perl by default.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/lang/perl/files/base.config b/lang/perl/files/base.config
index 67232b6d83e70505e7e85ad6893a2661f4571f7f..7d8b88b200f589b0efad7b301d26c6f9b77dfb33 100644
--- a/lang/perl/files/base.config
+++ b/lang/perl/files/base.config
@@ -864,7 +864,7 @@ package='perl5'
pager='/usr/bin/less'
passcat='cat /etc/passwd'
path_sep=':'
-perl=''
+perl='perl'
perl5=''
perl_patchlevel=''
perl_static_inline='static __inline__'
diff --git a/lang/perl/patches/110-always_use_miniperl.patch b/lang/perl/patches/110-always_use_miniperl.patch
deleted file mode 100644
index 806a31256b2007ee5f2c36d75261fac0d176cc21..0000000000000000000000000000000000000000
--- a/lang/perl/patches/110-always_use_miniperl.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/Makefile.SH
-+++ b/Makefile.SH
-@@ -360,22 +360,11 @@ PERL_EXE_LDFLAGS=$exeldflags
- ;;
- esac
-
--case "$usecrosscompile$perl" in
--define?*)
-- $spitshell >>$Makefile <<!GROK!THIS!
--# Macros to invoke a copy of our fully operational perl during the build.
--PERL_EXE = perl\$(EXE_EXT)
--RUN_PERL = \$(LDLIBPTH) \$(RUN) $perl\$(EXE_EXT)
--!GROK!THIS!
-- ;;
--*)
-- $spitshell >>$Makefile <<!GROK!THIS!
-+$spitshell >>$Makefile <<!GROK!THIS!
- # Macros to invoke a copy of our fully operational perl during the build.
- PERL_EXE = perl\$(EXE_EXT)
--RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT) -Ilib -I.
-+RUN_PERL = \$(LDLIBPTH) \$(RUN) ./miniperl\$(EXE_EXT) -Ilib -I.
- !GROK!THIS!
-- ;;
--esac
-
- $spitshell >>$Makefile <<!GROK!THIS!
- # Macros to run our tests
diff --git a/lang/perl/patches/900-use-rm-force.patch b/lang/perl/patches/900-use-rm-force.patch
index 9e44f5402f184445dcf4e9c75d96d2e412e5c4e0..baff506f6427f0b16712c252b0159ad80db20243 100644
--- a/lang/perl/patches/900-use-rm-force.patch
+++ b/lang/perl/patches/900-use-rm-force.patch
@@ -8,7 +8,7 @@
ranlib = $ranlib
ECHO = $echo
-@@ -791,7 +792,7 @@ bitcount.h: generate_uudmap$(HOST_EXE_EX
+@@ -802,7 +803,7 @@ bitcount.h: generate_uudmap$(HOST_EXE_EX
./generate_uudmap$(HOST_EXE_EXT) $(generated_headers)
generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
@@ -17,7 +17,7 @@
$(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT)
!NO!SUBS!
-@@ -896,26 +897,26 @@ mydtrace.h: $(DTRACE_H)
+@@ -907,26 +908,26 @@ mydtrace.h: $(DTRACE_H)
define)
$spitshell >>$Makefile <<'!NO!SUBS!'
$(DTRACE_MINI_O): perldtrace.d $(miniperl_objs_nodt)
@@ -48,7 +48,7 @@
!NO!SUBS!
;;
-@@ -926,13 +927,13 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
+@@ -937,13 +938,13 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
case "$useshrplib" in
true)
$spitshell >>$Makefile <<'!NO!SUBS!'
@@ -64,7 +64,7 @@
mv $@ libperl$(OBJ_EXT)
$(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
!NO!SUBS!
-@@ -941,7 +942,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
+@@ -952,7 +953,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
;;
*)
$spitshell >>$Makefile <<'!NO!SUBS!'
@@ -73,7 +73,7 @@
$(AR) rc $(LIBPERL) $(perllib_objs) $(DYNALOADER)
@$(ranlib) $(LIBPERL)
!NO!SUBS!
-@@ -975,7 +976,7 @@ $(MINIPERL_EXE): lib/buildcustomize.pl
+@@ -986,7 +987,7 @@ $(MINIPERL_EXE): lib/buildcustomize.pl
amigaos*)
$spitshell >>$Makefile <<'!NO!SUBS!'
lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
@@ -82,7 +82,7 @@
$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
$(miniperl_objs) $(libs)
# $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
-@@ -997,7 +998,7 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -1008,7 +1009,7 @@ NAMESPACEFLAGS = -force_flat_namespace
esac
$spitshell >>$Makefile <<'!NO!SUBS!'
lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
@@ -91,7 +91,7 @@
$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
$(miniperl_objs) $(libs)
$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
-@@ -1008,8 +1009,8 @@ lib/buildcustomize.pl: $& $(miniperl_obj
+@@ -1019,8 +1020,8 @@ lib/buildcustomize.pl: $& $(miniperl_obj
if test "X$hostperl" != X; then
$spitshell >>$Makefile <<!GROK!THIS!
lib/buildcustomize.pl: \$& \$(miniperl_dep) write_buildcustomize.pl
@@ -102,7 +102,7 @@
\$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
\$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
\$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
-@@ -1017,7 +1018,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_d
+@@ -1028,7 +1029,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_d
else
$spitshell >>$Makefile <<'!NO!SUBS!'
lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
@@ -111,7 +111,7 @@
$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
$(miniperl_objs) $(libs)
$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
-@@ -1030,7 +1031,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep
+@@ -1041,7 +1042,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep
$spitshell >>$Makefile <<'!NO!SUBS!'
$(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
@@ -120,7 +120,7 @@
!NO!SUBS!
case "$osname" in
-@@ -1130,8 +1131,8 @@ pod/perl5400delta.pod: pod/perldelta.pod
+@@ -1141,8 +1142,8 @@ pod/perl5400delta.pod: pod/perldelta.pod
$(LNS) perldelta.pod pod/perl5400delta.pod
extra.pods: $(MINIPERL_EXE)
@@ -131,7 +131,7 @@
-@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
nx=`echo $$x | sed -e "s/README\.//"`; \
$(LNS) ../$$x "pod/perl"$$nx".pod" ; \
-@@ -1330,11 +1331,11 @@ realclean: _realcleaner _mopup
+@@ -1341,11 +1342,11 @@ realclean: _realcleaner _mopup
@echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
_clobber:
@@ -148,7 +148,7 @@
clobber: _realcleaner _mopup _clobber
-@@ -1342,24 +1343,24 @@ distclean: clobber
+@@ -1353,24 +1354,24 @@ distclean: clobber
# Like distclean but also removes emacs backups and *.orig.
veryclean: _verycleaner _mopup _clobber
@@ -184,7 +184,7 @@
-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
-@if test -f $(MINIPERL_EXE) ; then \
-@@ -1369,8 +1370,8 @@ _cleaner1:
+@@ -1380,8 +1381,8 @@ _cleaner1:
else \
sh $(CLEAN).sh ; \
fi
@@ -195,7 +195,7 @@
# Dear POSIX, thanks for making the default to xargs to be
# run once if nothing is passed in. It is such a great help.
-@@ -1385,24 +1386,24 @@ _cleaner1:
+@@ -1396,24 +1397,24 @@ _cleaner1:
# Add new rules before that line - the next line (rm -f so_locations ...) is
# used as a placeholder by a regen script.
_cleaner2:
@@ -237,7 +237,7 @@
-rmdir lib/version lib/threads lib/inc/ExtUtils lib/inc lib/encoding
-rmdir lib/autodie/exception lib/autodie/Scope lib/autodie lib/XS
-rmdir lib/Win32API lib/VMS lib/Unicode/Collate/Locale
-@@ -1459,11 +1460,11 @@ _realcleaner:
+@@ -1470,11 +1471,11 @@ _realcleaner:
_verycleaner:
@$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
@$(LDLIBPTH) $(MAKE) _cleaner2
@@ -251,7 +251,7 @@
lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
cscopeflags = -Rb # Recursive, build-only.
-@@ -1524,7 +1525,7 @@ case "$targethost" in
+@@ -1535,7 +1536,7 @@ case "$targethost" in
'') $spitshell >>$Makefile <<'!NO!SUBS!'
test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
$(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods) common_build
@@ -260,7 +260,7 @@
!NO!SUBS!
;;
-@@ -1574,7 +1575,7 @@ test_prep test-prep: test_prep_pre \$(MI
+@@ -1585,7 +1586,7 @@ test_prep test-prep: test_prep_pre \$(MI
$to config.sh
# --- For lib/diagnostics.t with -Duseshrplib
$to \$(PERL_EXE)
@@ -269,7 +269,7 @@
$to t/\$(PERL_EXE)
!GROK!THIS!
-@@ -1592,7 +1593,7 @@ else
+@@ -1603,7 +1604,7 @@ else
$spitshell >>$Makefile <<'!NO!SUBS!'
test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL)
$(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
@@ -278,7 +278,7 @@
!NO!SUBS!
fi
-@@ -1648,7 +1649,7 @@ minitest_prep: $(MINIPERL_EXE)
+@@ -1659,7 +1660,7 @@ minitest_prep: $(MINIPERL_EXE)
@echo "You may see some irrelevant test failures if you have been unable"
@echo "to build lib/Config.pm, or the Unicode data files."
@echo " "
diff --git a/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch b/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch
index e9e5688e475e810f45acbda5cd579c65e484b8b7..6436a8ea027f46a8ce1c41b13323b625cc51eb4d 100644
--- a/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch
+++ b/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch
@@ -42,10 +42,10 @@ Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
- ;;
-esac
-
- $spitshell >>$Makefile <<!GROK!THIS!
- # Macros to invoke a copy of our fully operational perl during the build.
- PERL_EXE = perl\$(EXE_EXT)
-@@ -1045,20 +1029,6 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPER
+ case "$usecrosscompile$perl" in
+ define?*)
+ $spitshell >>$Makefile <<!GROK!THIS!
+@@ -1056,20 +1040,6 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPER
$(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
!NO!SUBS!
;;
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 26 Apr 2025 22:37:16 +0200
Subject: perl: fix parallel build race condition in target build
We have received reports of builds of perl occasionally failing when
building with many parallel jobs, with a log like the following:
LD_LIBRARY_PATH=[...]/perl/perl-5.40.0 ./miniperl -Ilib make_ext.pl \
dist/constant/pm_to_blib MAKE="make" LIBPERL_A=libperl.so
File/Path.pm did not return a true value at [...]/hostpkg/usr/lib/perl5/5.40.0/ExtUtils/MakeMaker.pm line 13.
BEGIN failed--compilation aborted at [...]/hostpkg/usr/lib/perl5/5.40.0/ExtUtils/MakeMaker.pm line 13.
Compilation failed in require at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
Unsuccessful Makefile.PL(dist/constant): code=65280 at make_ext.pl line 532.
The failing extension (dist/constant in the above log) would differ
between runs.
The cause of the issue is the `-Ilib` in the command line of miniperl.
In the host build, `./miniperl -I lib` will use the following include
path:
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/AutoLoader/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/dist/Carp/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/dist/PathTools
[..]/build_dir/hostpkg/perl/perl-5.40.0/dist/PathTools/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/ExtUtils-Install/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/ExtUtils-MakeMaker/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/ExtUtils-Manifest/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/File-Path/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/ext/re
[..]/build_dir/hostpkg/perl/perl-5.40.0/dist/Term-ReadLine/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/dist/Exporter/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/ext/File-Find/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/Text-Tabs/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/dist/constant/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/version/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/Getopt-Long/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/Text-ParseWords/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/cpan/ExtUtils-PL2Bat/lib
[..]/build_dir/hostpkg/perl/perl-5.40.0/lib
.
Various dependencies of the extension build scripts (Makefile.PL) -
including File-Path, which failed to be loaded in the error log - are
included in the path by buildcustomize.pl, as these extensions are only
installed to `lib` as the build proceeds.
However, in a target build, miniperl is just a symlink to the previously
built host perl. As the host perl does not implicitly load
`buildcustomize.pl`, we get the following include path for
`./miniperl -Ilib`:
lib
[..]/staging_dir/hostpkg/usr/lib/perl5/site_perl/5.40.0/x86_64-linux
[..]/staging_dir/hostpkg/usr/lib/perl5/site_perl/5.40.0
[..]/staging_dir/hostpkg/usr/lib/perl5/5.40.0/x86_64-linux
[..]/staging_dir/hostpkg/usr/lib/perl5/5.40.0
The host perl's install location is used as the default include path
which provides File-Path etc. for the target build; however, as more
and more libraries get installed into `lib` during the extension build,
they may get loaded from there instead, as `lib` is at the beginning of
the include path. When multiple extensions are built in parallel, a
Makefile.PL may attempt to load File/Path from `lib` after the file has
been created, but before its contents have been written fully, resulting
in the build to fail.
In fact, we should not load anything from `lib` during the target build,
as it is the staging directory for the target, including native
extensions built for the target architecture - with one exception: The
build scripts expect to find target information in the `Config` module,
so simply removing `lib` from the include path completely would break
the build.
Solve the issue by creating an alternative lib directory `lib_build`,
symlinking `Config.pm` and its dependencies in it, and replacing the
`-Ilib` argument with `-Ilib_build` using a wrapper script around the
host perl executable. This is similar to the approach seen in perl's own
obsolete/broken cross compile scripts (`Cross/Makefile`).
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/lang/perl/Makefile b/lang/perl/Makefile
index 6a6dd5ea86798e7e95e3657a94cca829dbd0924b..6ad27818e17c211abc1530eb0d1b1e7c1238bf28 100644
--- a/lang/perl/Makefile
+++ b/lang/perl/Makefile
@@ -92,6 +92,21 @@ endef
# Target perl
define Build/Configure
+ # We don't want to pass -Ilib to host perl in the target build (as lib
+ # contains the target libraries, and files may currently be written
+ # while being imported in parallel builds). We do however need the
+ # target versions of the Config modules at the beginning of the include
+ # path for the build scripts' use.
+ #
+ # Create an alternative lib_build directory that will be added to the
+ # include path instead of lib (using hostperl-wrapper), containing only
+ # the config modules.
+ $(INSTALL_DIR) $(PKG_BUILD_DIR)/lib_build
+ ln -sf ../lib/Config.pm ../lib/Config_heavy.pl ../lib/Config_git.pl $(PKG_BUILD_DIR)/lib_build/
+
+ install -m0755 files/hostperl-wrapper $(PKG_BUILD_DIR)/hostperl-wrapper
+ sed -i "s'@HOST_PERL@'$(HOST_PERL_PREFIX)/bin/perl'g" $(PKG_BUILD_DIR)/hostperl-wrapper
+
$(PERL_CMD) files/perlconfig.pl -Dowrt:target_cc='$(TARGET_CC)' \
-Dowrt:gccversion=$(CONFIG_GCC_VERSION) \
-Dowrt:target_cross='$(TARGET_CROSS)' \
diff --git a/lang/perl/files/base.config b/lang/perl/files/base.config
index 7d8b88b200f589b0efad7b301d26c6f9b77dfb33..1cadfc10ac20c3b2bb05bed3c2cc8e946ba24eef 100644
--- a/lang/perl/files/base.config
+++ b/lang/perl/files/base.config
@@ -650,7 +650,7 @@ hint='recommended'
hostcat='cat /etc/hosts'
hostgenerate="$owrt:host_perl_prefix/bin/generate_uudmap"
hostosname=''
-hostperl="$owrt:host_perl_prefix/bin/perl"
+hostperl="./hostperl-wrapper"
html1dir=' '
html1direxp=''
html3dir=' '
diff --git a/lang/perl/files/hostperl-wrapper b/lang/perl/files/hostperl-wrapper
new file mode 100644
index 0000000000000000000000000000000000000000..e31ef1cf8fe37a7a90ee9dd7cc60d3ca947e7600
--- /dev/null
+++ b/lang/perl/files/hostperl-wrapper
@@ -0,0 +1,14 @@
+#!@HOST_PERL@
+
+foreach (@ARGV) {
+ # Stop parsing options if we encounter a non-option argument or --
+ last if $_ eq '--' || $_ !~ m/^-/;
+
+ # Modify first option of the form -Ilib, -I../lib, ... to refer to lib_build instead
+ if ($_ =~ m@-I(.*/)?lib@) {
+ $_ .= '_build';
+ last;
+ }
+}
+
+exec '@HOST_PERL@', @ARGV
From: Linus Lüssing <linus.luessing@c0d3.blue>
Date: Mon, 18 Feb 2019 18:28:03 +0100
Subject: batctl: remove kmod-batman-adv dependency
This always pulls in the batman-adv compat 15 kernel module. However,
batctl works just as well with batman-adv-legacy (compat 14).
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
diff --git a/batctl/Makefile b/batctl/Makefile
index 4e67512844d07607852a5447a336dc9f93f5990a..df96ca7325ba3f84bd682da6df32fa4489474113 100644
--- a/batctl/Makefile
+++ b/batctl/Makefile
@@ -23,7 +23,7 @@ define Package/batctl
URL:=https://www.open-mesh.org/
SECTION:=net
CATEGORY:=Network
- DEPENDS:=+kmod-batman-adv +libnl-tiny +libc +librt
+ DEPENDS:=+libnl-tiny +libc +librt
TITLE:=B.A.T.M.A.N. Advanced user space configuration tool batctl
MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
endef
From: Linus Lüssing <linus.luessing@c0d3.blue>
Date: Sun, 10 Nov 2024 19:34:26 +0100
Subject: batman-adv: Introduce no noflood mark
This mark prevents a multicast packet being flooded through the whole
mesh. The advantage of marking certain multicast packets via e.g.
ebtables instead of dropping is then the following:
This allows an administrator to let specific multicast packets pass as
long as they are forwarded to a limited number of nodes only and are
therefore creating no burdon to unrelated nodes.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
diff --git a/batman-adv/patches/2002-batman-adv-Introduce-no-noflood-mark.patch b/batman-adv/patches/2002-batman-adv-Introduce-no-noflood-mark.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6058bff5bb4d07c78a82f59b47213a52b04d6a1e
--- /dev/null
+++ b/batman-adv/patches/2002-batman-adv-Introduce-no-noflood-mark.patch
@@ -0,0 +1,137 @@
+From: Linus Lüssing <linus.luessing@c0d3.blue>
+Date: Sat, 31 Mar 2018 03:36:19 +0200
+Subject: batman-adv: Introduce no noflood mark
+
+This mark prevents a multicast packet being flooded through the whole
+mesh. The advantage of marking certain multicast packets via e.g.
+ebtables instead of dropping is then the following:
+
+This allows an administrator to let specific multicast packets pass as
+long as they are forwarded to a limited number of nodes only and are
+therefore creating no burdon to unrelated nodes.
+
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+
+--- a/include/uapi/linux/batman_adv.h
++++ b/include/uapi/linux/batman_adv.h
+@@ -481,6 +481,18 @@ enum batadv_nl_attrs {
+ */
+ BATADV_ATTR_MULTICAST_FANOUT,
+
++ /**
++ * @BATADV_ATTR_NOFLOOD_MARK: the noflood mark which allows to tag
++ * frames which should never be broadcast flooded through the mesh.
++ */
++ BATADV_ATTR_NOFLOOD_MARK,
++
++ /**
++ * @BATADV_ATTR_NOFLOOD_MASK: the noflood (bit)mask which allows to tag
++ * frames which should never be broadcast flooded through the mesh.
++ */
++ BATADV_ATTR_NOFLOOD_MASK,
++
+ /* add attributes above here, update the policy in netlink.c */
+
+ /**
+--- a/net/batman-adv/netlink.c
++++ b/net/batman-adv/netlink.c
+@@ -133,6 +133,8 @@ static const struct nla_policy batadv_ne
+ [BATADV_ATTR_AP_ISOLATION_ENABLED] = { .type = NLA_U8 },
+ [BATADV_ATTR_ISOLATION_MARK] = { .type = NLA_U32 },
+ [BATADV_ATTR_ISOLATION_MASK] = { .type = NLA_U32 },
++ [BATADV_ATTR_NOFLOOD_MARK] = { .type = NLA_U32 },
++ [BATADV_ATTR_NOFLOOD_MASK] = { .type = NLA_U32 },
+ [BATADV_ATTR_BONDING_ENABLED] = { .type = NLA_U8 },
+ [BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED] = { .type = NLA_U8 },
+ [BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED] = { .type = NLA_U8 },
+@@ -285,6 +287,14 @@ static int batadv_netlink_mesh_fill(stru
+ bat_priv->isolation_mark_mask))
+ goto nla_put_failure;
+
++ if (nla_put_u32(msg, BATADV_ATTR_NOFLOOD_MARK,
++ bat_priv->noflood_mark))
++ goto nla_put_failure;
++
++ if (nla_put_u32(msg, BATADV_ATTR_NOFLOOD_MASK,
++ bat_priv->noflood_mark_mask))
++ goto nla_put_failure;
++
+ if (nla_put_u8(msg, BATADV_ATTR_BONDING_ENABLED,
+ !!atomic_read(&bat_priv->bonding)))
+ goto nla_put_failure;
+@@ -463,6 +473,18 @@ static int batadv_netlink_set_mesh(struc
+ bat_priv->isolation_mark_mask = nla_get_u32(attr);
+ }
+
++ if (info->attrs[BATADV_ATTR_NOFLOOD_MARK]) {
++ attr = info->attrs[BATADV_ATTR_NOFLOOD_MARK];
++
++ bat_priv->noflood_mark = nla_get_u32(attr);
++ }
++
++ if (info->attrs[BATADV_ATTR_NOFLOOD_MASK]) {
++ attr = info->attrs[BATADV_ATTR_NOFLOOD_MASK];
++
++ bat_priv->noflood_mark_mask = nla_get_u32(attr);
++ }
++
+ if (info->attrs[BATADV_ATTR_BONDING_ENABLED]) {
+ attr = info->attrs[BATADV_ATTR_BONDING_ENABLED];
+
+--- a/net/batman-adv/soft-interface.c
++++ b/net/batman-adv/soft-interface.c
+@@ -177,6 +177,23 @@ static void batadv_interface_set_rx_mode
+ {
+ }
+
++/**
++ * batadv_send_skb_has_noflood_mark() - check if packet has a noflood mark
++ * @bat_priv: the bat priv with all the soft interface information
++ * @skb: the packet to check
++ *
++ * Return: True if the skb's mark matches a configured noflood mark and
++ * noflood mark mask. False otherwise.
++ */
++static bool
++batadv_skb_has_noflood_mark(struct batadv_priv *bat_priv, struct sk_buff *skb)
++{
++ u32 match_mark = skb->mark & bat_priv->noflood_mark_mask;
++
++ return bat_priv->noflood_mark_mask &&
++ match_mark == bat_priv->noflood_mark;
++}
++
+ static netdev_tx_t batadv_interface_tx(struct sk_buff *skb,
+ struct net_device *soft_iface)
+ {
+@@ -333,6 +350,9 @@ send:
+ if (batadv_dat_snoop_outgoing_arp_request(bat_priv, skb))
+ brd_delay = msecs_to_jiffies(ARP_REQ_DELAY);
+
++ if (batadv_skb_has_noflood_mark(bat_priv, skb))
++ goto dropped;
++
+ if (batadv_skb_head_push(skb, sizeof(*bcast_packet)) < 0)
+ goto dropped;
+
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -1711,6 +1711,18 @@ struct batadv_priv {
+ */
+ u32 isolation_mark_mask;
+
++ /**
++ * @noflood_mark: the skb->mark value used to allow directed targeting
++ * only
++ */
++ u32 noflood_mark;
++
++ /**
++ * @noflood_mark_mask: bitmask identifying the bits in skb->mark to be
++ * used for the noflood mark
++ */
++ u32 noflood_mark_mask;
++
+ /** @bcast_seqno: last sent broadcast packet sequence number */
+ atomic_t bcast_seqno;
+
From: Linus Lüssing <linus.luessing@c0d3.blue>
Date: Sun, 10 Nov 2024 19:35:52 +0100
Subject: batctl: Add noflood_mark command
Adds support for the new 'noflood_mark' setting in batman-adv.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
diff --git a/batctl/patches/2002-batctl-Add-noflood_mark-command.patch b/batctl/patches/2002-batctl-Add-noflood_mark-command.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d4498603785a21a71951a6195cd96661be44d685
--- /dev/null
+++ b/batctl/patches/2002-batctl-Add-noflood_mark-command.patch
@@ -0,0 +1,217 @@
+From 12884631753aa24d9e36c5d65950320ecab61384 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue>
+Date: Fri, 26 Apr 2019 19:27:38 +0200
+Subject: [PATCH] batctl: Add noflood_mark command
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Adds support for the new 'noflood_mark' setting in batman-adv.
+
+Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
+---
+ Makefile | 1 +
+ README.rst | 15 ++++++
+ batman_adv.h | 12 +++++
+ noflood_mark.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 168 insertions(+)
+ create mode 100644 noflood_mark.c
+
+--- a/Makefile
++++ b/Makefile
+@@ -69,6 +69,7 @@ $(eval $(call add_command,multicast_mode
+ $(eval $(call add_command,neighbors,y))
+ $(eval $(call add_command,neighbors_json,y))
+ $(eval $(call add_command,network_coding,y))
++$(eval $(call add_command,noflood_mark,y))
+ $(eval $(call add_command,orig_interval,y))
+ $(eval $(call add_command,originators,y))
+ $(eval $(call add_command,originators_json,y))
+--- a/README.rst
++++ b/README.rst
+@@ -430,6 +430,21 @@ Example::
+
+
+
++batctl noflood_mark
++=======================
++
++display or modify noflood_mark setting
++
++Usage::
++
++ batctl noflood_mark|nf $value[/0x$mask]
++
++* Example 1: ``batctl nf 0x00000001/0xffffffff``
++* Example 2: ``batctl nf 0x00040000/0xffff0000``
++* Example 3: ``batctl nf 16``
++* Example 4: ``batctl nf 0x0f``
++
++
+ batctl translocal
+ -----------------
+
+--- a/batman_adv.h
++++ b/batman_adv.h
+@@ -481,6 +481,18 @@ enum batadv_nl_attrs {
+ */
+ BATADV_ATTR_MULTICAST_FANOUT,
+
++ /**
++ * @BATADV_ATTR_NOFLOOD_MARK: the noflood mark which allows to tag
++ * frames which should never be broadcast flooded through the mesh.
++ */
++ BATADV_ATTR_NOFLOOD_MARK,
++
++ /**
++ * @BATADV_ATTR_NOFLOOD_MASK: the noflood (bit)mask which allows to tag
++ * frames which should never be broadcast flooded through the mesh.
++ */
++ BATADV_ATTR_NOFLOOD_MASK,
++
+ /* add attributes above here, update the policy in netlink.c */
+
+ /**
+--- /dev/null
++++ b/noflood_mark.c
+@@ -0,0 +1,140 @@
++// SPDX-License-Identifier: GPL-2.0
++/* Copyright (C) 2009-2019 B.A.T.M.A.N. contributors:
++ *
++ * Antonio Quartulli <a@unstable.cc>
++ * Linus Lüssing <linus.luessing@c0d3.blue>
++ *
++ * License-Filename: LICENSES/preferred/GPL-2.0
++ */
++
++#include <errno.h>
++#include <stddef.h>
++#include <stdint.h>
++#include <string.h>
++
++#include "main.h"
++#include "sys.h"
++
++static struct noflood_mark_data {
++ uint32_t noflood_mark;
++ uint32_t noflood_mask;
++} noflood_mark;
++
++static int parse_noflood_mark(struct state *state, int argc, char *argv[])
++{
++ struct settings_data *settings = state->cmd->arg;
++ struct noflood_mark_data *data = settings->data;
++ char *mask_ptr;
++ char buff[256];
++ uint32_t mark;
++ uint32_t mask;
++ char *endptr;
++
++ if (argc != 2) {
++ fprintf(stderr, "Error - incorrect number of arguments (expected 1)\n");
++ return -EINVAL;
++ }
++
++ strncpy(buff, argv[1], sizeof(buff));
++ buff[sizeof(buff) - 1] = '\0';
++
++ /* parse the mask if it has been specified, otherwise assume the mask is
++ * the biggest possible
++ */
++ mask = 0xFFFFFFFF;
++ mask_ptr = strchr(buff, '/');
++ if (mask_ptr) {
++ *mask_ptr = '\0';
++ mask_ptr++;
++
++ /* the mask must be entered in hex base as it is going to be a
++ * bitmask and not a prefix length
++ */
++ mask = strtoul(mask_ptr, &endptr, 16);
++ if (!endptr || *endptr != '\0')
++ goto inval_format;
++ }
++
++ /* the mark can be entered in any base */
++ mark = strtoul(buff, &endptr, 0);
++ if (!endptr || *endptr != '\0')
++ goto inval_format;
++
++ data->noflood_mask = mask;
++ /* erase bits not covered by the mask */
++ data->noflood_mark = mark & mask;
++
++ return 0;
++
++inval_format:
++ fprintf(stderr, "Error - incorrect number of arguments (expected 1)\n");
++ fprintf(stderr, "The following formats for mark(/mask) are allowed:\n");
++ fprintf(stderr, " * 0x12345678\n");
++ fprintf(stderr, " * 0x12345678/0xabcdef09\n");
++ return -EINVAL;
++}
++
++static int print_noflood_mark(struct nl_msg *msg, void *arg)
++{
++ struct nlattr *attrs[BATADV_ATTR_MAX + 1];
++ struct nlmsghdr *nlh = nlmsg_hdr(msg);
++ struct genlmsghdr *ghdr;
++ int *result = arg;
++
++ if (!genlmsg_valid_hdr(nlh, 0))
++ return NL_OK;
++
++ ghdr = nlmsg_data(nlh);
++
++ if (nla_parse(attrs, BATADV_ATTR_MAX, genlmsg_attrdata(ghdr, 0),
++ genlmsg_len(ghdr), batadv_netlink_policy)) {
++ return NL_OK;
++ }
++
++ if (!attrs[BATADV_ATTR_NOFLOOD_MARK] ||
++ !attrs[BATADV_ATTR_NOFLOOD_MASK])
++ return NL_OK;
++
++ printf("0x%08x/0x%08x\n",
++ nla_get_u32(attrs[BATADV_ATTR_NOFLOOD_MARK]),
++ nla_get_u32(attrs[BATADV_ATTR_NOFLOOD_MASK]));
++
++ *result = 0;
++ return NL_STOP;
++}
++
++static int get_noflood_mark(struct state *state)
++{
++ return sys_simple_nlquery(state, BATADV_CMD_GET_MESH,
++ NULL, print_noflood_mark);
++}
++
++static int set_attrs_noflood_mark(struct nl_msg *msg, void *arg)
++{
++ struct state *state = arg;
++ struct settings_data *settings = state->cmd->arg;
++ struct noflood_mark_data *data = settings->data;
++
++ nla_put_u32(msg, BATADV_ATTR_NOFLOOD_MARK, data->noflood_mark);
++ nla_put_u32(msg, BATADV_ATTR_NOFLOOD_MASK, data->noflood_mask);
++
++ return 0;
++}
++
++static int set_noflood_mark(struct state *state)
++{
++ return sys_simple_nlquery(state, BATADV_CMD_SET_MESH,
++ set_attrs_noflood_mark, NULL);
++}
++
++static struct settings_data batctl_settings_noflood_mark = {
++ .data = &noflood_mark,
++ .parse = parse_noflood_mark,
++ .netlink_get = get_noflood_mark,
++ .netlink_set = set_noflood_mark,
++};
++
++COMMAND_NAMED(SUBCOMMAND, noflood_mark, "nf", handle_sys_setting,
++ COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
++ &batctl_settings_noflood_mark,
++ "[mark] \tdisplay or modify noflood_mark setting");
#!/usr/bin/env bash
set -euo pipefail
echo "CONFIG_DEVEL=y"
if [ "$GLUON_AUTOREMOVE" != "0" ]; then
echo "CONFIG_AUTOREMOVE=y"
else
echo "# CONFIG_AUTOREMOVE is not set"
fi
#!/usr/bin/env bash
# shellcheck enable=check-unassigned-uppercase
set -euo pipefail
# move into base directory, in case this script is not executed via `make container`
cd "$(dirname "$0")/.."
# normalize branch name to reflect a valid image name
BRANCH=$(git branch --show-current 2>/dev/null | sed 's/[^a-z0-9-]/_/ig')
TAG="gluon:${BRANCH:-latest}"
if [ "$(command -v podman)" ]
then
podman build -t "${TAG}" contrib/docker
podman run -it --rm -u "$(id -u):$(id -g)" --userns=keep-id --volume="$(pwd):/gluon:z" "${TAG}"
elif [ "$(command -v docker)" ]
then
docker build -t "${TAG}" contrib/docker
docker run -it --rm -u "$(id -u):$(id -g)" --volume="$(pwd):/gluon" -e HOME=/gluon "${TAG}"
else
echo "Please install either podman or docker. Exiting" >&2
exit 1
fi
local lib = dofile('scripts/target_lib.lua')
local env = lib.env
local target = env.GLUON_TARGET
assert(target)
assert(env.GLUON_IMAGEDIR)
assert(env.GLUON_PACKAGEDIR)
local target = arg[1]
local openwrt_target
local subtarget = env.SUBTARGET
if subtarget ~= '' then
......@@ -26,22 +27,30 @@ end
mkdir(env.GLUON_IMAGEDIR..'/factory')
mkdir(env.GLUON_IMAGEDIR..'/sysupgrade')
mkdir(env.GLUON_IMAGEDIR..'/other')
mkdir(env.GLUON_DEBUGDIR)
mkdir(env.GLUON_METADIR..'/openwrt-profiles')
lib.include(target)
local function image_source(image)
return string.format(
'openwrt/bin/targets/%s/openwrt-%s-%s%s%s',
bindir, openwrt_target, image.name, image.in_suffix, image.extension)
end
local function clean(image, name)
local dir, file = image:dest_name(name, '\0', '\0')
lib.exec {'rm', '-f', dir..'/'..file}
end
for _, image in ipairs(lib.images) do
for _, images in pairs(lib.images) do
for _, image in ipairs(images) do
clean(image, image.image)
local destdir, destname = image:dest_name(image.image)
local source = string.format('openwrt/bin/targets/%s/openwrt-%s-%s%s%s',
bindir, openwrt_target, image.name, image.in_suffix, image.extension)
local source = image_source(image)
lib.exec {'cp', source, destdir..'/'..destname}
......@@ -53,9 +62,36 @@ for _, image in ipairs(lib.images) do
end
end
for _, image in ipairs(images) do
local source = image_source(image)
lib.exec {'rm', '-f', source}
end
end
-- copy kernel image with debug symbols
local kernel_debug_glob = string.format('%s/gluon-\0-%s-kernel-debug.tar.zst',
env.GLUON_DEBUGDIR,
target)
lib.exec {'rm', '-f', kernel_debug_glob}
local kernel_debug_source = string.format('openwrt/bin/targets/%s/kernel-debug.tar.zst',
bindir)
local kernel_debug_dest = string.format('%s/gluon-%s-%s-%s-kernel-debug.tar.zst',
env.GLUON_DEBUGDIR,
lib.site_code,
env.GLUON_RELEASE,
target)
lib.exec {'cp', kernel_debug_source, kernel_debug_dest}
-- copy OpenWrt profile JSON
local profile_json_source = string.format('openwrt/bin/targets/%s/profiles.json',
bindir)
local profile_json_dest = string.format('%s/openwrt-profiles/%s.json',
env.GLUON_METADIR,
target)
lib.exec {'cp', profile_json_source, profile_json_dest}
-- Copy opkg repo
if lib.opkg and (env.GLUON_DEVICES or '') == '' then
if (env.GLUON_DEVICES or '') == '' then
local package_prefix = string.format('gluon-%s-%s', lib.site_code, env.GLUON_RELEASE)
local function dest_dir(prefix)
return env.GLUON_PACKAGEDIR..'/'..prefix..'/'..bindir
......@@ -64,5 +100,6 @@ if lib.opkg and (env.GLUON_DEVICES or '') == '' then
lib.exec {'rm', '-f', dest_dir('\0')..'/\0'}
lib.exec({'rmdir', '-p', dest_dir('\0')}, true, '2>/dev/null')
mkdir(dest_dir(package_prefix))
lib.exec {'rm', '-rf', 'openwrt/bin/targets/'..bindir..'/packages/tmp'}
lib.exec {'cp', 'openwrt/bin/targets/'..bindir..'/packages/\0', dest_dir(package_prefix)}
end
DEFAULT_FEEDS="$(awk '{print $2}' openwrt/feeds.conf.default)"
#!/bin/sh
# list feeds which don't start with #
DEFAULT_FEEDS="$(awk '!/^#/ {print $2}' openwrt/feeds.conf.default)"
export DEFAULT_FEEDS
local cjson = require 'cjson'
local json = require 'jsonc'
local function load_json(filename)
local f = assert(io.open(filename))
local json = cjson.decode(f:read('*a'))
f:close()
return json
end
local domain = load_json(arg[1])
local domain = assert(json.load(arg[1]))
for k, _ in pairs(domain.domain_names) do
print(k)
end
local M = {}
local function to_keys(t)
local ret = {}
for _, v in ipairs(t) do
ret[v] = true
end
return ret
end
local function collect_keys(t)
local ret = {}
for v in pairs(t) do
table.insert(ret, v)
end
return ret
end
function M.get_packages(files, features)
local enabled_features = to_keys(features)
local handled_features = {}
local packages = {}
local funcs = {}
local function add_pkgs(pkgs)
for _, pkg in ipairs(pkgs or {}) do
packages[pkg] = true
end
end
function funcs._(feature)
return enabled_features[feature] ~= nil
end
function funcs.feature(feature, pkgs)
assert(
type(feature) == 'string',
'Incorrect use of feature(): pass a feature name without _ as first argument')
if enabled_features[feature] then
handled_features[feature] = true
add_pkgs(pkgs)
end
end
function funcs.when(cond, pkgs)
assert(
type(cond) == 'boolean',
'Incorrect use of when(): pass a locical expression of _-prefixed strings as first argument')
if cond then
add_pkgs(pkgs)
end
end
-- Evaluate the feature definition files
for _, file in ipairs(files) do
local f, err = loadfile(file)
if not f then
error('Failed to parse feature definition: ' .. err)
end
setfenv(f, funcs)
f()
end
-- Handle default packages
for _, feature in ipairs(features) do
if not handled_features[feature] then
packages['gluon-' .. feature] = true
end
end
return collect_keys(packages)
end
return M
#!/bin/bash --norc
set -e
shopt -s nullglob
nodefault() {
# We define a function instead of a variable, as variables could
# be predefined in the environment (in theory)
eval "gluon_feature_nodefault_$1() {
:
}"
}
packages() {
:
}
for f in package/features packages/*/features; do
. "$f"
done
# Shell variables can't contain minus signs, so we escape them
# using underscores (and also escape underscores to avoid mapping
# multiple inputs to the same output)
sanitize() {
local v="$1"
v="${v//_/_1}"
v="${v//-/_2}"
echo -n "$v"
}
vars=
for feature in $1; do
if [ "$(type -t gluon_feature_nodefault_${feature})" != 'function' ]; then
echo "gluon-${feature}"
fi
vars="$vars $(sanitize "$feature")=1"
done
nodefault() {
:
}
packages() {
local cond="$(sanitize "$1")"
shift
# We only allow variable names, parentheses and the operators: & | !
if [ "$(expr match "$cond" '.*[^A-Za-z0-9_()&|! ].*')" -gt 0 ]; then
exit 1
fi
# Let will return false when the result of the passed expression is 0,
# so we always add 1. This way false is only returned for syntax errors.
local ret="$(env -i $vars bash --norc -ec "let _result_='1+($cond)'; echo -n \"\$_result_\"" 2>/dev/null)"
case "$ret" in
2)
for pkg in "$@"; do
echo "$pkg"
done
;;
1)
;;
*)
exit 1
esac
}
for f in package/features packages/*/features; do
. "$f"
done