summaryrefslogtreecommitdiff
path: root/package/base-files/files/lib
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/lib
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/lib')
-rwxr-xr-xpackage/base-files/files/lib/network/config.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh
index d285da2..358e610 100755
--- a/package/base-files/files/lib/network/config.sh
+++ b/package/base-files/files/lib/network/config.sh
@@ -228,16 +228,17 @@ setup_interface_static() {
config_get ip6addr "$config" ip6addr
[ -z "$ipaddr" -o -z "$netmask" ] && [ -z "$ip6addr" ] && return 1
- local gateway ip6gw dns bcast
+ local gateway ip6gw dns bcast metric
config_get gateway "$config" gateway
config_get ip6gw "$config" ip6gw
config_get dns "$config" dns
config_get bcast "$config" broadcast
+ config_get metric "$config" metric
[ -z "$ipaddr" ] || $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" broadcast "${bcast:-+}"
[ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" add "$ip6addr"
- [ -z "$gateway" ] || $DEBUG route add default gw "$gateway" dev "$iface"
- [ -z "$ip6gw" ] || $DEBUG route -A inet6 add default gw "$ip6gw" dev "$iface"
+ [ -z "$gateway" ] || $DEBUG route add default gw "$gateway" ${metric:+metric $metric} dev "$iface"
+ [ -z "$ip6gw" ] || $DEBUG route -A inet6 add default gw "$ip6gw" ${metric:+metric $metric} dev "$iface"
[ -z "$dns" ] || add_dns "$config" $dns
config_get type "$config" TYPE