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 config_get userdns
"$ifc" dns
18 [ -n "$userdns" ] && {
21 echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
25 uci_set_state network
"$ifc" ipaddr
"$ip"
26 uci_set_state network
"$ifc" netmask
"${subnet:-255.255.255.0}"
27 uci_set_state network
"$ifc" dnsdomain
"$domain"
28 uci_set_state network
"$ifc" dns
"$dns"
29 uci_set_state network
"$ifc" gateway
"$router"
32 env
-i ACTION
="$1" INTERFACE
="$ifc" DEVICE
="$ifname" PROTO
=dhcp
/sbin
/hotplug-call iface
38 ifconfig
$interface 0.0.0.0
42 ifconfig
$interface $ip \
43 netmask
${subnet:-255.255.255.0} \
44 broadcast
${broadcast:-+}
48 echo "adding router $i"
49 route add default gw
$i dev
$interface
54 echo "deleting old routes"
55 $
(route
-n |
awk '/^0.0.0.0\W{9}('$valid')\W/ {next} /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}')
59 echo -n > "${RESOLV_CONF}.tmp"
62 [ -s "${RESOLV_CONF}.tmp" ] ||
{
65 echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
69 ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
71 mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
74 if [ "$1" = "renew" ]; then
81 [ -f /etc
/udhcpc.user
] && .
/etc
/udhcpc.user
This page took 0.061126 seconds and 5 git commands to generate.