DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*}
[ -z $DHCP_HOSTNAME ] || DHCP_ARGS="$DHCP_ARGS -H $DHCP_HOSTNAME"
[ "$if_proto" = "pptp" ] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &"
- oldpid=$(cat $pidfile)
+ [ -r $pidfile ] && oldpid=$(cat $pidfile 2>&-)
${DEBUG:-eval} "udhcpc $DHCP_ARGS"
- pidof udhcpc | grep "$oldpid" >&- 2>&- && {
+ [ -n "$oldpid" ] && pidof udhcpc | grep "$oldpid" >&- 2>&- && {
sleep 1
kill -9 $oldpid
}
sleep 2
-if [ $(cat /proc/sys/reset) = 1 -o "$(nvram get failsafe)" = 1 ]; then
+if [ "$(cat /proc/sys/reset 2>&-)" = 1 -o "$(nvram get failsafe)" = 1 ]; then
while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done &
export FAILSAFE=true
[ "$(nvram get boot_wait)" != "on" ] && {
if=$(nvram get ${type}_ifname)
proto=$(nvram get ${type}_proto)
if_valid $if && $DEBUG ifconfig $if down
-kill $(cat /var/run/${if}.pid 2>&-) 2>&-
+[ -r /var/run/${if}.pid ] && kill $(cat /var/run/${if}.pid 2>&-) 2>&-
killall ifup.$proto >&- 2>&-
case "$proto" in
pptp|pppoe) killall pppd >&- 2>&- ;;
if [ -n "$router" ] ; then
echo "deleting routers"
- while route del default gw 0.0.0.0 dev $interface ; do :; done
+ while route del default gw 0.0.0.0 dev $interface >&- 2>&- ; do :; done
for i in $router ; do
+ echo "adding router $i"
route add default gw $i dev $interface
done
fi
echo -n > $RESOLV_CONF
${domain:+echo search $domain} >> $RESOLV_CONF
for i in $dns ; do
- echo adding dns $i
- echo nameserver $i >> $RESOLV_CONF
+ echo "adding dns $i"
+ echo "nameserver $i" >> $RESOLV_CONF
done
hotplug_event ifup