From 156f5e8f48adf12201849ad33d2b85e3d5a90ae7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 18 May 2021 23:41:33 +0200 Subject: [PATCH] base-files: migrate old UCI network sections defining bridges MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Old "interface" sections for bridges were mixing layer 2 and layer 3. That syntax got deprecated and UCI section "device" is used for bridge configuration now. Backward compatibility may be dropped from netifd soon now so migrate old configs using uci-defaults script. Signed-off-by: Rafał Miłecki --- .../uci-defaults/11_network-migrate-bridges | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges b/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges index ad13d1a353..a9dece418d 100644 --- a/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges +++ b/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges @@ -19,5 +19,31 @@ migrate_ports() { uci delete network.$config.ifname } +migrate_bridge() { + local config="$1" + local type ifname + + config_get type "$config" type + [ "$type" != "bridge" ] && return + + config_get ifname "$config" ifname + + uci -q batch <<-EOF + add network device + set network.@device[-1].name='br-$config' + set network.@device[-1].type='bridge' + EOF + for port in $ifname; do + uci add_list network.@device[-1].ports="$port" + done + + uci -q batch <<-EOF + delete network.$config.type + delete network.$config.ifname + set network.$config.device='br-$config' + EOF +} + config_load network config_foreach migrate_ports device +config_foreach migrate_bridge interface -- 2.30.2