aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
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
commit7abbf699c23f6e4c092ff44435b318d550a51e50 (patch)
treeccc98040c5fe8b1c3239bfdabe26c44353066918 /package/base-files
parent7bc260f9c3e19f4fb65f3968fae0c9371f8c4824 (diff)
downloadupstream-7abbf699c23f6e4c092ff44435b318d550a51e50.tar.gz
upstream-7abbf699c23f6e4c092ff44435b318d550a51e50.tar.bz2
upstream-7abbf699c23f6e4c092ff44435b318d550a51e50.zip
Add support for static routes per interface. You can specify one or more routes, subnets or hosts. Closes #308 for kamikaze
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3629 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/default/etc/hotplug.d/net/10-net12
1 files changed, 12 insertions, 0 deletions
diff --git a/package/base-files/default/etc/hotplug.d/net/10-net b/package/base-files/default/etc/hotplug.d/net/10-net
index 4bb69378ff..b68ec1be28 100644
--- a/package/base-files/default/etc/hotplug.d/net/10-net
+++ b/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 ] || {