2005-01-16 13:43:02 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
|
2005-09-13 13:59:54 +03:00
|
|
|
# (slightly modified for OpenWrt)
|
2005-01-16 13:43:02 +02:00
|
|
|
|
2005-02-06 02:52:16 +02:00
|
|
|
[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
|
2005-01-16 13:43:02 +02:00
|
|
|
|
2005-02-06 02:52:16 +02:00
|
|
|
RESOLV_CONF="/tmp/resolv.conf"
|
2005-01-16 13:43:02 +02:00
|
|
|
|
|
|
|
case "$1" in
|
2005-02-06 02:52:16 +02:00
|
|
|
deconfig)
|
|
|
|
ifconfig $interface 0.0.0.0
|
|
|
|
;;
|
|
|
|
|
|
|
|
renew|bound)
|
|
|
|
ifconfig $interface $ip \
|
2005-04-20 04:52:32 +03:00
|
|
|
netmask ${subnet:-255.255.255.0} \
|
|
|
|
broadcast ${broadcast:-+}
|
2005-02-06 02:52:16 +02:00
|
|
|
|
|
|
|
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
|
2005-07-04 23:30:29 +03:00
|
|
|
${domain:+echo search $domain} >> $RESOLV_CONF
|
2005-02-06 02:52:16 +02:00
|
|
|
for i in $dns ; do
|
|
|
|
echo adding dns $i
|
|
|
|
echo nameserver $i >> $RESOLV_CONF
|
2005-09-13 13:59:54 +03:00
|
|
|
|
|
|
|
# user rules
|
|
|
|
[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user
|
|
|
|
|
2005-02-06 02:52:16 +02:00
|
|
|
done
|
|
|
|
;;
|
2005-01-16 13:43:02 +02:00
|
|
|
esac
|
|
|
|
exit 0
|