aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/base-files
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2014-07-03 21:40:59 +0000
committerHauke Mehrtens <hauke@openwrt.org>2014-07-03 21:40:59 +0000
commit0f7a9d7a21c292236fb21c03cbc6360599fcdcf4 (patch)
tree474cb8e391d2d2185cb9a0b92cdb8d8d2b1e1202 /target/linux/brcm47xx/base-files
parentbf1bcf5f2739aa84726579ff6c48850399e13225 (diff)
downloadupstream-0f7a9d7a21c292236fb21c03cbc6360599fcdcf4.tar.gz
upstream-0f7a9d7a21c292236fb21c03cbc6360599fcdcf4.tar.bz2
upstream-0f7a9d7a21c292236fb21c03cbc6360599fcdcf4.zip
brcm47xx: migrate basic network settings from old releases
Old OpenWrt releases were using network configs that are not valid anymore. They were specifying ports tagging in a different way (or were not tagging CPU at all) and were using VID 0 which is a reserved value. Modifying network configuration to apply all needed changes would be pretty tricky. Script /etc/init.d/netconfig that generates new config is quite complex itself. So instead let's save the most important settings, regenerate config from the scratch and restore values. This should work for 99% of users. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41500 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx/base-files')
-rw-r--r--target/linux/brcm47xx/base-files/etc/uci-defaults/03_network_migration29
1 files changed, 29 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/base-files/etc/uci-defaults/03_network_migration b/target/linux/brcm47xx/base-files/etc/uci-defaults/03_network_migration
new file mode 100644
index 0000000000..cef5add106
--- /dev/null
+++ b/target/linux/brcm47xx/base-files/etc/uci-defaults/03_network_migration
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+
+uci show network | grep "\.vlan=0"
+[ $? -ne 0 ] && exit 0
+
+logger -t network "network config is invalid, creating new one"
+
+local lan_proto="$(uci -q get network.lan.proto)"
+local lan_ipaddr="$(uci -q get network.lan.ipaddr)"
+local lan_netmask="$(uci -q get network.lan.netmask)"
+local wan_proto="$(uci -q get network.wan.proto)"
+local wan_ipaddr="$(uci -q get network.wan.ipaddr)"
+local wan_netmask="$(uci -q get network.wan.netmask)"
+
+rm /etc/config/network
+/etc/init.d/netconfig start
+
+uci set network.lan.proto=$lan_proto
+uci set network.lan.ipaddr=$lan_ipaddr
+uci set network.lan.netmask=$lan_netmask
+uci set network.wan.proto=$wan_proto
+uci set network.wan.ipaddr=$wan_ipaddr
+uci set network.wan.netmask=$wan_netmask
+uci commit network
+
+exit 0