From b5ff75c13e555e6dee7664a9e901e1ab4990f09e Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Wed, 11 Jan 2006 16:29:11 +0000 Subject: [PATCH] Do not delete default route if the router is the same, fixes #138 SVN-Revision: 2913 --- .../default/usr/share/udhcpc/default.script | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/openwrt/package/base-files/default/usr/share/udhcpc/default.script b/openwrt/package/base-files/default/usr/share/udhcpc/default.script index 9fac6286c9f..304be1197e3 100755 --- a/openwrt/package/base-files/default/usr/share/udhcpc/default.script +++ b/openwrt/package/base-files/default/usr/share/udhcpc/default.script @@ -26,12 +26,14 @@ case "$1" in 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 -- 2.30.2