2 [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
6 RESOLV_CONF
="/tmp/resolv.conf.auto"
10 config_load
/var
/state
/network
11 for ifc
in $interfaces; do
12 config_get ifname
$ifc ifname
13 [ "$ifname" = "$interface" ] ||
continue
15 config_get proto
$ifc proto
16 [ "$proto" = "dhcp" ] ||
continue
18 uci
set "/var/state/network.$ifc.ipaddr=$ip"
19 uci
set "/var/state/network.$ifc.netmask=${subnet:-255.255.255.0}"
20 uci
set "/var/state/network.$ifc.dnsdomain=$domain"
21 uci
set "/var/state/network.$ifc.dns=$dns"
22 uci
set "/var/state/network.$ifc.gateway=$router"
24 env
-i ACTION
="$1" INTERFACE
="$ifc" DEVICE
="$ifname" PROTO
=dhcp
/sbin
/hotplug-call iface
30 ifconfig
$interface 0.0.0.0
34 ifconfig
$interface $ip \
35 netmask
${subnet:-255.255.255.0} \
36 broadcast
${broadcast:-+}
40 echo "adding router $i"
41 route add default gw
$i dev
$interface
46 echo "deleting old routes"
47 $
(route
-n |
awk '/^0.0.0.0\W{9}('$valid')\W/ {next} /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}')
51 echo -n > "${RESOLV_CONF}.tmp"
52 ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
55 echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
57 mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
63 [ -f /etc
/udhcpc.user
] && .
/etc
/udhcpc.user
This page took 0.047801 seconds and 5 git commands to generate.