X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/0bb68e81eca839c8eed0c629b403ac558ea662e6..841e5a0f16d54f9548f83f30c8b4efd736a3af12:/package/base-files/default/usr/share/udhcpc/default.script diff --git a/package/base-files/default/usr/share/udhcpc/default.script b/package/base-files/default/usr/share/udhcpc/default.script index 9fac6286c..42d3eaf0c 100755 --- a/package/base-files/default/usr/share/udhcpc/default.script +++ b/package/base-files/default/usr/share/udhcpc/default.script @@ -26,12 +26,15 @@ 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 $interface | awk '{ print $2 }')" ] ; then + while route del default gw 0.0.0.0 dev $interface 2>&- ; do + echo "removing old default route" + done + for i in $router ; do + route add default gw $i dev $interface + done + fi fi echo -n > $RESOLV_CONF