aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorMike Baker <mbm@openwrt.org>2007-05-14 08:37:57 +0000
committerMike Baker <mbm@openwrt.org>2007-05-14 08:37:57 +0000
commit310ddc4c62d46e6ea7d308b232a0389b300389a4 (patch)
treedd2db1f13f81f8120b744714c2cdabbb72a6d231 /package
parent36fbb96b59b1f8788b361d472cfc46a4774ca1ad (diff)
downloadupstream-310ddc4c62d46e6ea7d308b232a0389b300389a4.tar.gz
upstream-310ddc4c62d46e6ea7d308b232a0389b300389a4.tar.bz2
upstream-310ddc4c62d46e6ea7d308b232a0389b300389a4.zip
cleaner version of the udhcp script
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7222 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/usr/share/udhcpc/default.script12
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 f2099204e3..76ba746e28 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