aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate')
-rw-r--r--target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate23
1 files changed, 23 insertions, 0 deletions
diff --git a/target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate b/target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate
new file mode 100644
index 0000000000..7350f57e5d
--- /dev/null
+++ b/target/linux/bcm53xx/base-files/etc/uci-defaults/03_dsa_migrate
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# Exit if network doesn't contain any swconfig section
+uci -q get network.@switch[0] > /dev/null || exit 0
+
+lan_proto="$(uci -q get network.lan.proto)"
+lan_ipaddr="$(uci -q get network.lan.ipaddr)"
+lan_netmask="$(uci -q get network.lan.netmask)"
+wan_proto="$(uci -q get network.wan.proto)"
+wan_ipaddr="$(uci -q get network.wan.ipaddr)"
+wan_netmask="$(uci -q get network.wan.netmask)"
+
+rm /etc/config/network
+config_generate
+
+uci -q batch <<-EOF
+ set network.lan.proto="$lan_proto"
+ set network.lan.ipaddr="$lan_ipaddr"
+ set network.lan.netmask="$lan_netmask"
+ set network.wan.proto="$wan_proto"
+ set network.wan.ipaddr="$wan_ipaddr"
+ set network.wan.netmask="$wan_netmask"
+EOF