Do not delete default route if the router is the same, fixes #138
authorFlorian Fainelli <florian@openwrt.org>
Wed, 11 Jan 2006 16:29:11 +0000 (16:29 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Wed, 11 Jan 2006 16:29:11 +0000 (16:29 +0000)
SVN-Revision: 2913

openwrt/package/base-files/default/usr/share/udhcpc/default.script

index 9fac6286c9ffcf1eb3b30a808d5899087845aee9..304be1197e34ce882cbeafb389d72a2cb8501d38 100755 (executable)
@@ -26,12 +26,14 @@ case "$1" in
                broadcast ${broadcast:-+}
 
                if [ -n "$router" ] ; then
                broadcast ${broadcast:-+}
 
                if [ -n "$router" ] ; then
-                       echo "deleting routers"
-                       while route del default gw 0.0.0.0 dev $interface ; do :; done
-                                       
-                       for i in $router ; do
-                               route add default gw $i dev $interface
-                       done
+
+                       if [ "$router" != "$(route -n | grep '^0.0.0.0' | grep vlan1 | awk '{ print $2 }')" ] ; then
+                               echo "deleting routers"
+                               while route del default gw 0.0.0.0 dev $interface ; do :; done                          
+                               for i in $router ; do
+                                       route add default gw $i dev $interface
+                               done
+                       fi
                fi
 
                echo -n > $RESOLV_CONF
                fi
 
                echo -n > $RESOLV_CONF