From bd17defba1576f9f7ae03f579d73806fa9535b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Thu, 25 Jan 2024 18:03:22 +0100 Subject: [PATCH 1/5] fff-layer3-config: bump config_version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With OpenWrt 23.05 a few more devices have been migrated to DSA. Bump the config_version of layer3-config to reflect the necessary migration. Signed-off-by: Fabian Bläse --- .../fff/fff-layer3-config/files/etc/layer3.d/01-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/fff/fff-layer3-config/files/etc/layer3.d/01-version b/src/packages/fff/fff-layer3-config/files/etc/layer3.d/01-version index 79432208..5045eb63 100644 --- a/src/packages/fff/fff-layer3-config/files/etc/layer3.d/01-version +++ b/src/packages/fff/fff-layer3-config/files/etc/layer3.d/01-version @@ -7,7 +7,7 @@ configure() { fi # check version of configuration - local expected_version=2 + local expected_version=3 local config_version=$(uci -q get gateway.meta.config_version) if ! [ -n "$config_version" ]; then -- 2.39.2 From 5f619cb08d5330cc780b92d99c40c65a68ab0cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Thu, 25 Jan 2024 17:53:36 +0100 Subject: [PATCH 2/5] fff-network: add missing cpuport case for the FritzBox 4040 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When adjusting our configuration for the DSA migration of the FritzBox 4040, the cpuport was forgotten. The cpuport has to be removed for DSA devices. Signed-off-by: Fabian Bläse --- src/packages/fff/fff-network/files/lib/functions/fff/cpuport | 1 + 1 file changed, 1 insertion(+) diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/cpuport b/src/packages/fff/fff-network/files/lib/functions/fff/cpuport index 77de67ce..ab577be9 100644 --- a/src/packages/fff/fff-network/files/lib/functions/fff/cpuport +++ b/src/packages/fff/fff-network/files/lib/functions/fff/cpuport @@ -15,6 +15,7 @@ get_cpu_port() { xiaomi,mi-router-4a-100m) CPUPORT="6t" ;; + avm,fritzbox-4040|\ netgear,r6220|\ tplink,cpe210-v2|\ tplink,cpe210-v3|\ -- 2.39.2 From a60c018de66d3cc76cada82960eb995940ee6e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Thu, 25 Jan 2024 17:53:50 +0100 Subject: [PATCH 3/5] fff-network: adjust network configuration of TP-Link TL-WDR4900 for DSA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the TL-WDR4900 was migrated to a DSA driver with OpenWrt 23.05. Adjust our network configuration accordingly. Fixes: #302 Signed-off-by: Fabian Bläse --- .../fff/fff-network/files/lib/functions/fff/cpuport | 1 + .../fff-network/powerpc/network.tplink,tl-wdr4900-v1 | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/packages/fff/fff-network/files/lib/functions/fff/cpuport b/src/packages/fff/fff-network/files/lib/functions/fff/cpuport index ab577be9..42a77c74 100644 --- a/src/packages/fff/fff-network/files/lib/functions/fff/cpuport +++ b/src/packages/fff/fff-network/files/lib/functions/fff/cpuport @@ -19,6 +19,7 @@ get_cpu_port() { netgear,r6220|\ tplink,cpe210-v2|\ tplink,cpe210-v3|\ + tplink,tl-wdr4900-v1|\ ubnt,edgerouter-4|\ ubnt,edgerouter-x|\ ubnt,edgerouter-x-sfp|\ diff --git a/src/packages/fff/fff-network/powerpc/network.tplink,tl-wdr4900-v1 b/src/packages/fff/fff-network/powerpc/network.tplink,tl-wdr4900-v1 index 97085959..545f55f8 100644 --- a/src/packages/fff/fff-network/powerpc/network.tplink,tl-wdr4900-v1 +++ b/src/packages/fff/fff-network/powerpc/network.tplink,tl-wdr4900-v1 @@ -1,10 +1,11 @@ . /lib/functions/fff/network -WANDEV=eth0 -SWITCHDEV=eth0 -CLIENT_PORTS="0t 4 5" -WAN_PORTS="0t 1" -BATMAN_PORTS="0t 2 3" +WANDEV=switch0 +SWITCHDEV=switch0 +CLIENT_PORTS="lan3 lan4" +WAN_PORTS="wan" +BATMAN_PORTS="lan1 lan2" +DSA=1 # use mac address from phy1 with 'locally administered' bit set to '1' # only possible, because wXmesh is created first and therefore gets the 'universally administered address' -- 2.39.2 From 6586cc89440b957998c8ff2844bd30dc43d6e9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Wed, 24 Jan 2024 16:55:33 +0100 Subject: [PATCH 4/5] mpc85xx: retain old compat_version for sysupgrade compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenWrt images contain a compat_version, which is used to block upgrades to newer versions with incompatible configuration, if the configuration cannot be migrated. As we maintain our own configuration and all OpenWrt configuration files are dropped on an upgrade, this upgrade block is not required. To simplify the upgrade process, retain the old compat_version for the next sysupgrade release. The compat_version will then be bumped automatically by the `05_compat-version` board.d script. Signed-off-by: Fabian Bläse --- ...0052-mpc85xx-retain-old-compat_version.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 build_patches/openwrt/0052-mpc85xx-retain-old-compat_version.patch diff --git a/build_patches/openwrt/0052-mpc85xx-retain-old-compat_version.patch b/build_patches/openwrt/0052-mpc85xx-retain-old-compat_version.patch new file mode 100644 index 00000000..29874a4c --- /dev/null +++ b/build_patches/openwrt/0052-mpc85xx-retain-old-compat_version.patch @@ -0,0 +1,17 @@ +From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= +Date: Wed, 24 Jan 2024 16:50:12 +0200 +Subject: [PATCH] mpc85xx: retain old compat_version + +diff --git a/target/linux/mpc85xx/image/p1010.mk b/target/linux/mpc85xx/image/p1010.mk +index c0de19f6c6..5aa580300f 100644 +--- a/target/linux/mpc85xx/image/p1010.mk ++++ b/target/linux/mpc85xx/image/p1010.mk +@@ -51,8 +51,6 @@ define Device/tplink_tl-wdr4900-v1 + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := TL-WDR4900 + DEVICE_VARIANT := v1 +- DEVICE_COMPAT_VERSION := 1.1 +- DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA + TPLINK_HEADER_VERSION := 1 + TPLINK_HWID := 0x49000001 + TPLINK_HWREV := 1 -- 2.39.2 From da0a853e69864152bf760253fb90e2db1c611bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Thu, 25 Jan 2024 17:54:00 +0100 Subject: [PATCH 5/5] layer3-config: Add DSA migration script for migrated devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because of to the switch from swconfig to DSA, the switchport names have to be migrated for a few devices. Due to past migrations, we already have developed a migration script for that. Duplicate and adjust the script for the newly migrated devices. While at it, rename the old script to reflect the configuration version bump. Fixes: #301 Signed-off-by: Fabian Bläse --- ...migrate-dsa => 20-l3config-migrate-1-to-2} | 0 .../uci-defaults/21-l3config-migrate-2-to-3 | 76 +++++++++++++++++++ 2 files changed, 76 insertions(+) rename src/packages/fff/fff-layer3-config/files/etc/uci-defaults/{20-l3config-migrate-dsa => 20-l3config-migrate-1-to-2} (100%) create mode 100644 src/packages/fff/fff-layer3-config/files/etc/uci-defaults/21-l3config-migrate-2-to-3 diff --git a/src/packages/fff/fff-layer3-config/files/etc/uci-defaults/20-l3config-migrate-dsa b/src/packages/fff/fff-layer3-config/files/etc/uci-defaults/20-l3config-migrate-1-to-2 similarity index 100% rename from src/packages/fff/fff-layer3-config/files/etc/uci-defaults/20-l3config-migrate-dsa rename to src/packages/fff/fff-layer3-config/files/etc/uci-defaults/20-l3config-migrate-1-to-2 diff --git a/src/packages/fff/fff-layer3-config/files/etc/uci-defaults/21-l3config-migrate-2-to-3 b/src/packages/fff/fff-layer3-config/files/etc/uci-defaults/21-l3config-migrate-2-to-3 new file mode 100644 index 00000000..0d5d4b7c --- /dev/null +++ b/src/packages/fff/fff-layer3-config/files/etc/uci-defaults/21-l3config-migrate-2-to-3 @@ -0,0 +1,76 @@ +## this script migrates configs from version 2 to 3. +## +## with version 2 the switchport names of some devices changed +## due to the switch to DSA + + +BOARD="$(uci get board.model.name)" + +# only migrate appropriate config versions +[ "$(uci -q get gateway.meta.config_version)" = "2" ] || exit 1 + +translate_ports() { + local vlan="$1" + local oldports="$(uci -q get gateway.$vlan.ports)" + local newports + + local name + local tag + + for port in $oldports; do + # generate new tagged/untagged syntax + if [ -z "${port##*t}" ]; then + # port is tagged + tag=":t" + else + # port is untagged + tag=":*" + fi + + # generate new name + case "$BOARD" in + avm,fritzbox-4040) + case "${port%%t}" in + 1) name="lan1" ;; + 2) name="lan2" ;; + 3) name="lan3" ;; + 4) name="lan4" ;; + 5) name="wan" ;; + *) name="" ;; + esac + ;; + tplink,tl-wdr4900-v1) + case "${port%%t}" in + 1) name="wan" ;; + 2) name="lan1" ;; + 3) name="lan2" ;; + 4) name="lan3" ;; + 5) name="lan4" ;; + *) name="" ;; + esac + ;; + esac + + # catch empty name (invalid entry or old cpuport) + [ -z "$name" ] && continue + + # assemble new port name + newports="$newports ${name}${tag}" + done + + # cleanup unnecessary spaces + newports=$(echo "$newports" | xargs) + + uci set gateway.$vlan.ports="$newports" +} + +case "$BOARD" in + avm,fritzbox-4040|\ + tplink,tl-wdr4900-v1) + config_load gateway + config_foreach translate_ports vlan + ;; +esac + +uci set gateway.meta.config_version='3' +uci commit gateway -- 2.39.2