summaryrefslogtreecommitdiffstats
path: root/target/default/target_skeleton/usr/share/udhcpc/default.script
diff options
context:
space:
mode:
authormbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-01-16 11:43:02 +0000
committermbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-01-16 11:43:02 +0000
commit2f006aa5e8a74e2dd224f5e9b90d36c79651fd66 (patch)
tree85d694c0a5715a49a401cadec16be849169d8d6a /target/default/target_skeleton/usr/share/udhcpc/default.script
Initial revision
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@197 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/default/target_skeleton/usr/share/udhcpc/default.script')
-rwxr-xr-xtarget/default/target_skeleton/usr/share/udhcpc/default.script39
1 files changed, 39 insertions, 0 deletions
diff --git a/target/default/target_skeleton/usr/share/udhcpc/default.script b/target/default/target_skeleton/usr/share/udhcpc/default.script
new file mode 100755
index 000000000..a52a7f812
--- /dev/null
+++ b/target/default/target_skeleton/usr/share/udhcpc/default.script
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# udhcpc script edited by Tim Riker <Tim@Rikers.org>
+
+[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
+
+RESOLV_CONF="/etc/resolv.conf"
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
+
+case "$1" in
+ deconfig)
+ /sbin/ifconfig $interface 0.0.0.0
+ ;;
+
+ renew|bound)
+ /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+
+ 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
+ fi
+
+ echo -n > $RESOLV_CONF
+ [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
+ for i in $dns ; do
+ echo adding dns $i
+ echo nameserver $i >> $RESOLV_CONF
+ done
+ ;;
+esac
+
+exit 0