add copyright headers to base-files scripts and config files
[openwrt.git] / package / base-files / default / etc / hotplug.d / net / 10-net
index 4bb6937..f306ae3 100644 (file)
@@ -1,4 +1,6 @@
 #!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+
 find_name()
 {
        for ifname in lan wan wifi ${ifnames}; do
@@ -47,10 +49,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 ] || {
This page took 0.021885 seconds and 4 git commands to generate.