summaryrefslogtreecommitdiffstats
path: root/package/base-files/files/usr/share/udhcpc
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-11-17 19:11:50 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-11-17 19:11:50 +0000
commitb71062831ca43cdf7be948640f13288b469eed9f (patch)
tree18df62e3f760aac318a0d1bf6ce01b12683a5820 /package/base-files/files/usr/share/udhcpc
parent93b487b3a576416e0e80e697a8c890ba1ceaf24f (diff)
[package] base-file: add metric option for static and dhcp protos, this simplifies the management of multiple default routes
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24020 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/usr/share/udhcpc')
-rwxr-xr-xpackage/base-files/files/usr/share/udhcpc/default.script4
1 files changed, 3 insertions, 1 deletions
diff --git a/package/base-files/files/usr/share/udhcpc/default.script b/package/base-files/files/usr/share/udhcpc/default.script
index 708f84783..9acde829d 100755
--- a/package/base-files/files/usr/share/udhcpc/default.script
+++ b/package/base-files/files/usr/share/udhcpc/default.script
@@ -19,6 +19,7 @@ setup_interface () {
local old_dns
local user_dns
local user_router
+ local user_metric
[ -n "$ifc" ] && {
old_ip="$(uci_get_state network "$ifc" ipaddr)"
@@ -43,6 +44,7 @@ setup_interface () {
change_state network "$ifc" lease_gateway "$router"
old_router="$(uci_get_state network "$ifc" gateway)"
user_router="$(uci_get network "$ifc" gateway)"
+ user_metric="$(uci_get network "$ifc" metric)"
[ -n "$user_router" ] && router="$user_router"
}
@@ -51,7 +53,7 @@ setup_interface () {
local valid_gw=""
for i in $router ; do
- route add default gw $i dev $interface
+ route add default gw $i ${user_metric:+metric $user_metric} dev $interface
valid_gw="${valid_gw:+$valid_gw|}$i"
done