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_state network
"$ifc" ipaddr
"$ip"
18 uci_set_state network
"$ifc" netmask
"${subnet:-255.255.255.0}"
19 uci_set_state network
"$ifc" dnsdomain
"$domain"
20 uci_set_state network
"$ifc" dns
"$dns"
21 uci_set_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}.tmp"
51 ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
54 echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
56 mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
59 if [ "$1" = "renew" ]; then
66 [ -f /etc
/udhcpc.user
] && .
/etc
/udhcpc.user
This page took 0.043026 seconds and 5 git commands to generate.