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:-+}
33 echo "adding router $i"
34 route add default gw $i dev $interface
39 echo "deleting old routes"
40 $(route -n | awk '/^0.0.0.0\W{9}('$valid')\W/ {next} /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}')
44 echo -n > $RESOLV_CONF
45 ${domain:+echo search $domain} >> $RESOLV_CONF
48 echo "nameserver $i" >> $RESOLV_CONF
55 [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user