summaryrefslogtreecommitdiff
path: root/package/base-files/files/usr
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-11-17 19:11:50 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-11-17 19:11:50 +0000
commitd0ab35c115643db40b2bece8698ecd472f4ce147 (patch)
treea713b7eb2bcde7c4f5a2c15a4273463011611370 /package/base-files/files/usr
parent2201a230a9872cfe2fa1733b66742dea5cb816e6 (diff)
downloadmtk-20170518-d0ab35c115643db40b2bece8698ecd472f4ce147.zip
mtk-20170518-d0ab35c115643db40b2bece8698ecd472f4ce147.tar.gz
mtk-20170518-d0ab35c115643db40b2bece8698ecd472f4ce147.tar.bz2
base-file: add metric option for static and dhcp protos, this simplifies the management of multiple default routes
SVN-Revision: 24020
Diffstat (limited to 'package/base-files/files/usr')
-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 708f847..9acde82 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