Fixup OpenWrt 23.05 network configuration changes #304

Closed
fbl wants to merge 5 commits from fbl/firmware:fixup-openwrt2305 into master
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'