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 uci
set "/var/state/network.$ifc.ipaddr=$ip"
18 uci
set "/var/state/network.$ifc.netmask=${subnet:-255.255.255.0}"
19 uci
set "/var/state/network.$ifc.dnsdomain=$domain"
20 uci
set "/var/state/network.$ifc.dns=$dns"
21 uci
set "/var/state/network.$ifc.gateway=$router"
23 env
-i ACTION
="$1" INTERFACE
="$ifc" DEVICE
="$ifname" PROTO
=dhcp
/sbin
/hotplug-call iface
29 ifconfig
$interface 0.0.0.0
33 ifconfig
$interface $ip \
34 netmask
${subnet:-255.255.255.0} \
35 broadcast
${broadcast:-+}
39 echo "adding router $i"
40 route add default gw
$i dev
$interface
45 echo "deleting old routes"
46 $
(route
-n |
awk '/^0.0.0.0\W{9}('$valid')\W/ {next} /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}')
50 echo -n > $RESOLV_CONF
51 ${domain:+echo search $domain} >> $RESOLV_CONF
54 echo "nameserver $i" >> $RESOLV_CONF
61 [ -f /etc
/udhcpc.user
] && .
/etc
/udhcpc.user
This page took 0.046328 seconds and 5 git commands to generate.