Compare commits

...

5 Commits

Author SHA1 Message Date
Fabian Bläse da0a853e69 layer3-config: Add DSA migration script for migrated devices
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 <fabian@blaese.de>
2024-01-25 18:08:44 +01:00
Fabian Bläse 6586cc8944 mpc85xx: retain old compat_version for sysupgrade compatibility
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 <fabian@blaese.de>
2024-01-25 18:08:25 +01:00
Fabian Bläse a60c018de6 fff-network: adjust network configuration of TP-Link TL-WDR4900 for DSA
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 <fabian@blaese.de>
2024-01-25 18:08:19 +01:00
Fabian Bläse 5f619cb08d fff-network: add missing cpuport case for the FritzBox 4040
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 <fabian@blaese.de>
2024-01-25 18:07:46 +01:00
Fabian Bläse bd17defba1 fff-layer3-config: bump config_version
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 <fabian@blaese.de>
2024-01-25 18:07:33 +01:00
6 changed files with 102 additions and 6 deletions

View File

@ -0,0 +1,17 @@
From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= <fabian@blaese.de>
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

View File

@ -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

View File

@ -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

View File

@ -15,9 +15,11 @@ get_cpu_port() {
xiaomi,mi-router-4a-100m)
CPUPORT="6t"
;;
avm,fritzbox-4040|\
netgear,r6220|\
tplink,cpe210-v2|\
tplink,cpe210-v3|\
tplink,tl-wdr4900-v1|\
ubnt,edgerouter-4|\
ubnt,edgerouter-x|\
ubnt,edgerouter-x-sfp|\

View File

@ -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'