Add support for static routes per interface. You can specify one or more routes, subnets or hosts. Closes #308 for kamikaze

SVN-Revision: 3629
owl
Florian Fainelli 2006-04-13 11:39:20 +00:00
parent 19e37cab15
commit 39ee633444
1 changed files with 12 additions and 0 deletions

View File

@ -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 ] || {