summaryrefslogtreecommitdiff
path: root/openwrt/package/base-files/default/etc
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2006-04-13 11:39:20 +0000
committerFlorian Fainelli <florian@openwrt.org>2006-04-13 11:39:20 +0000
commit39ee633444a2c54f92d21f276d797adf911d058a (patch)
tree146006f700eb996cc3b59335bd20ae7615cf9d22 /openwrt/package/base-files/default/etc
parent19e37cab1585f14d8e2b5a593074432ea99c4bf9 (diff)
downloadmtk-20170518-39ee633444a2c54f92d21f276d797adf911d058a.zip
mtk-20170518-39ee633444a2c54f92d21f276d797adf911d058a.tar.gz
mtk-20170518-39ee633444a2c54f92d21f276d797adf911d058a.tar.bz2
Add support for static routes per interface. You can specify one or more routes, subnets or hosts. Closes #308 for kamikaze
SVN-Revision: 3629
Diffstat (limited to 'openwrt/package/base-files/default/etc')
-rw-r--r--openwrt/package/base-files/default/etc/hotplug.d/net/10-net12
1 files changed, 12 insertions, 0 deletions
diff --git a/openwrt/package/base-files/default/etc/hotplug.d/net/10-net b/openwrt/package/base-files/default/etc/hotplug.d/net/10-net
index 4bb6937..b68ec1b 100644
--- a/openwrt/package/base-files/default/etc/hotplug.d/net/10-net
+++ b/openwrt/package/base-files/default/etc/hotplug.d/net/10-net
@@ -47,10 +47,22 @@ do_ifup() {
eval "netmask=\"\${${2}_netmask}\""
eval "gateway=\"\${${2}_gateway}\""
eval "dns=\"\${${2}_dns}\""
+ eval "static_route=\"\${${2}_static_route}\""
$DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
[ -n "$ip6" ] && $DEBUG ifconfig $if add $ip6
+ [ -n "$static_route" ] && {
+ for route in $static_route; do
+ if [ "$(echo $route | cut -d \/ -f2)" != "32" ];
+ then
+ route add -net $(echo $route | cut -d \/ -f1) netmask $(echo $route | cut -d \/ -f1) dev $if
+ else
+ route add -host $(echo $route | cut -d \/ -f1) dev $if
+ fi
+ done
+ }
+
${gateway:+$DEBUG route add default gw $gateway}
[ -f /tmp/resolv.conf ] || {