2 [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
6 RESOLV_CONF="/tmp/resolv.conf.auto"
10 for ifc in $interfaces; do
11 config_get ifname $ifc ifname
12 [ "$ifname" = "$interface" ] || continue
14 config_get proto $ifc proto
15 [ "$proto" = "dhcp" ] || continue
17 env -i ACTION="$1" INTERFACE="$ifc" DEVICE="$ifname" PROTO=dhcp /sbin/hotplug-call iface
23 ifconfig $interface 0.0.0.0
27 ifconfig $interface $ip \
28 netmask ${subnet:-255.255.255.0} \
29 broadcast ${broadcast:-+}
31 if [ "$router" != "$(route -n | grep '^0.0.0.0' | grep $interface | awk '{ print $2 }')" ] ; then
32 echo "deleting routers"
33 while route del default gw 0.0.0.0 dev $interface >&- 2>&- ; do :; done
36 echo "adding router $i"
37 route add default gw $i dev $interface
42 echo -n > $RESOLV_CONF
43 ${domain:+echo search $domain} >> $RESOLV_CONF
46 echo "nameserver $i" >> $RESOLV_CONF
53 [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user