summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-12-01 22:48:48 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-12-01 22:48:48 +0000
commit4f6c58adac8422300040b7bc9e64f94a70e37946 (patch)
tree9dc2f5a6b4a3eb4cc92e52f1f389026fa4a61082 /target
parent39348e387f97af1b2bf22f10370b65ebee664b2e (diff)
downloadmtk-20170518-4f6c58adac8422300040b7bc9e64f94a70e37946.zip
mtk-20170518-4f6c58adac8422300040b7bc9e64f94a70e37946.tar.gz
mtk-20170518-4f6c58adac8422300040b7bc9e64f94a70e37946.tar.bz2
ramips: use /lib/functions/uci-defaults.sh
SVN-Revision: 29386
Diffstat (limited to 'target')
-rwxr-xr-xtarget/linux/ramips/base-files/etc/uci-defaults/network38
1 files changed, 12 insertions, 26 deletions
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/network b/target/linux/ramips/base-files/etc/uci-defaults/network
index 9d464cd..7cb6b83 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/network
+++ b/target/linux/ramips/base-files/etc/uci-defaults/network
@@ -2,23 +2,13 @@
. /etc/functions.sh
. /lib/ramips.sh
+. /lib/functions/uci-defaults.sh
if [ ! -x /usr/sbin/maccalc ]; then
echo "$0: maccalc not found!"
return
fi
-create_lan_wan()
-{
- uci batch <<EOF
-set network.lan.ifname=eth0.1
-set network.wan=interface
-set network.wan.ifname=eth0.2
-set network.wan.proto=dhcp
-commit network
-EOF
-}
-
get_mac_binary()
{
local mtdname="$1"
@@ -52,32 +42,24 @@ get_mac_nvram()
maccalc add "$mac_dirty" 0
}
-set_interface_mac()
-{
- local iface="$1"
- local mac="$2"
-
- uci batch <<EOF
-set network.$iface.macaddr=""$mac"
-commit network
-EOF
-}
-
ramips_setup_interfaces()
{
local board="$1"
+ ucidef_set_interface_loopback
+
case $board in
argus-atp52b | \
b2c | \
f5d8235-v2 | \
nw718)
- create_lan_wan
+ ucidef_set_interfaces_lan_wan "eth0.1 eth0.2"
;;
*)
RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
- [ -z "${RT3X5X}" ] || create_lan_wan
+ [ -z "${RT3X5X}" ] || \
+ ucidef_set_interfaces_lan_wan "eth0.1 eth0.2"
;;
esac
}
@@ -102,11 +84,15 @@ ramips_setup_macs()
;;
esac
- [ -n $lan_mac ] && set_interface_mac lan $lan_mac
- [ -n $wan_mac ] && set_interface_mac wan $wan_mac
+ [ -n $lan_mac ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n $wan_mac ] && ucidef_set_interface_macaddr wan $wan_mac
}
board=$(ramips_board_name)
ramips_setup_interfaces $board
ramips_setup_macs $board
+
+uci commit network
+
+exit 0