aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-12-03 22:27:06 +0000
committerJo-Philipp Wich <jow@openwrt.org>2015-12-03 22:27:06 +0000
commitb7dcc615b9d3ef5b2fb977b4d7563fa93713152a (patch)
tree3f8678455385f4de5a681542c4ad7bc77e78518f /package/base-files/files/lib/functions
parentfd83873d6440d699fee4277151729e2c0ebbdc6d (diff)
downloadmaster-187ad058-b7dcc615b9d3ef5b2fb977b4d7563fa93713152a.tar.gz
master-187ad058-b7dcc615b9d3ef5b2fb977b4d7563fa93713152a.tar.bz2
master-187ad058-b7dcc615b9d3ef5b2fb977b4d7563fa93713152a.zip
base-files: board.d: support specifiying the protocol of lan and wan
Some boards, e.g. the Sheeva Plug, require the lan interface to be set to DHCP instead of a static address, therfore support that. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47732 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/lib/functions')
-rwxr-xr-xpackage/base-files/files/lib/functions/uci-defaults-new.sh36
1 files changed, 26 insertions, 10 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults-new.sh b/package/base-files/files/lib/functions/uci-defaults-new.sh
index 9fa3fa204e..b350549b34 100755
--- a/package/base-files/files/lib/functions/uci-defaults-new.sh
+++ b/package/base-files/files/lib/functions/uci-defaults-new.sh
@@ -32,9 +32,26 @@ json_select_object() {
_ucidef_set_interface() {
local name="$1"
local iface="$2"
+ local proto="$3"
json_select_object "$name"
json_add_string ifname "$iface"
+
+ if ! json_is_a protocol string; then
+ case "$proto" in
+ static|dhcp|none) : ;;
+ *)
+ case "$name" in
+ lan) proto="static" ;;
+ wan) proto="dhcp" ;;
+ *) proto="none" ;;
+ esac
+ ;;
+ esac
+
+ json_add_string protocol "$proto"
+ fi
+
json_select ..
}
@@ -57,19 +74,15 @@ ucidef_set_interface_loopback()
}
ucidef_set_interface_lan() {
- local lan_if="$1"
-
json_select_object network
- _ucidef_set_interface lan "$lan_if"
+ _ucidef_set_interface lan "$@"
json_select ..
}
ucidef_set_interface_wan() {
- local wan_if="$1"
-
- json_select_object network
- _ucidef_set_interface wan "$wan_if"
- json_select ..
+ json_select_object network
+ _ucidef_set_interface wan "$@"
+ json_select ..
}
ucidef_set_interfaces_lan_wan() {
@@ -164,14 +177,17 @@ _ucidef_finish_switch_roles() {
json_select ..
json_select_object network
+ local devices
+
json_select_object "$role"
# attach previous interfaces (for multi-switch devices)
- local devices; json_get_var devices ifname
+ json_get_var devices ifname
if ! list_contains devices "$device"; then
devices="${devices:+$devices }$device"
fi
- json_add_string ifname "$devices"
json_select ..
+
+ _ucidef_set_interface "$role" "$devices"
json_select ..
done
}