diff options
author | Mike Baker <mbm@openwrt.org> | 2007-05-14 08:37:57 +0000 |
---|---|---|
committer | Mike Baker <mbm@openwrt.org> | 2007-05-14 08:37:57 +0000 |
commit | 3e112cbedb2d8b14f72e6da0baa4d40be30f4597 (patch) | |
tree | 6ac191ac5368fd0099ca0f4238cf61f30f16905f /package/base-files/files/usr | |
parent | d5027649533fd543f144752b03ef6f3b000ba45f (diff) | |
download | mtk-20170518-3e112cbedb2d8b14f72e6da0baa4d40be30f4597.zip mtk-20170518-3e112cbedb2d8b14f72e6da0baa4d40be30f4597.tar.gz mtk-20170518-3e112cbedb2d8b14f72e6da0baa4d40be30f4597.tar.bz2 |
cleaner version of the udhcp script
SVN-Revision: 7222
Diffstat (limited to 'package/base-files/files/usr')
-rwxr-xr-x | package/base-files/files/usr/share/udhcpc/default.script | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/package/base-files/files/usr/share/udhcpc/default.script b/package/base-files/files/usr/share/udhcpc/default.script index f209920..76ba746 100755 --- a/package/base-files/files/usr/share/udhcpc/default.script +++ b/package/base-files/files/usr/share/udhcpc/default.script @@ -28,15 +28,17 @@ case "$1" in netmask ${subnet:-255.255.255.0} \ broadcast ${broadcast:-+} - if [ "$router" != "$(route -n | grep '^0.0.0.0' | grep $interface | awk '{ print $2 }')" ] ; then - echo "deleting routers" - while route del default gw 0.0.0.0 dev $interface >&- 2>&- ; do :; done - + [ "$router"] && { for i in $router ; do echo "adding router $i" route add default gw $i dev $interface + valid="$valid|$i" + done - fi + + echo "deleting old routes" + $(route -n | awk '/^0.0.0.0\W{9}('$valid')\W/ {next} /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}') + } [ -n "$dns" ] && { echo -n > $RESOLV_CONF |