mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-02-09 07:41:56 +02:00
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
This commit is contained in:
parent
0b11c9308c
commit
68bdf5f9b2
@ -47,10 +47,22 @@ do_ifup() {
|
|||||||
eval "netmask=\"\${${2}_netmask}\""
|
eval "netmask=\"\${${2}_netmask}\""
|
||||||
eval "gateway=\"\${${2}_gateway}\""
|
eval "gateway=\"\${${2}_gateway}\""
|
||||||
eval "dns=\"\${${2}_dns}\""
|
eval "dns=\"\${${2}_dns}\""
|
||||||
|
eval "static_route=\"\${${2}_static_route}\""
|
||||||
|
|
||||||
$DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
|
$DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
|
||||||
[ -n "$ip6" ] && $DEBUG ifconfig $if add $ip6
|
[ -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}
|
${gateway:+$DEBUG route add default gw $gateway}
|
||||||
|
|
||||||
[ -f /tmp/resolv.conf ] || {
|
[ -f /tmp/resolv.conf ] || {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user