Changeset 3628


Ignore:
Timestamp:
2006-04-13T13:38:18+02:00 (12 years ago)
Author:
florian
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/whiterussian/openwrt/package/base-files/default/etc/functions.sh

    r3550 r3628  
    3838                gateway=$(nvram get ${2}_gateway) 
    3939                mtu=$(nvram get ${2}_mtu) 
     40                static_route=$(nvram get ${2}_static_route) 
    4041 
    4142                $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} ${mtu:+mtu $(($mtu))} broadcast + up 
    4243                ${gateway:+$DEBUG route add default gw $gateway} 
     44 
     45                [ -n "$static_route" ] && { 
     46                        for route in $static_route; do 
     47                                if [ "$(echo $route | cut -d \/ -f2)" != "32" ]; 
     48                                then 
     49                                        route add -net $(echo $route | cut -d \/ -f1) netmask $(echo $route | cut -d \/ -f1) dev $if 
     50                                else 
     51                                        route add -host $(echo $route | cut -d \/ -f1) dev $if 
     52                                fi 
     53                        done 
     54                } 
    4355 
    4456                [ -f /etc/resolv.conf ] || { 
Note: See TracChangeset for help on using the changeset viewer.