upgrade dnsmasq to v2.32
[openwrt.git] / package / base-files / default / usr / share / udhcpc / default.script
1 #!/bin/sh
2 [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
3 . /etc/config/network
4
5 RESOLV_CONF="/tmp/resolv.conf"
6
7 hotplug_event() {
8 for ifname in lan wan wifi ${ifnames}; do
9 eval "proto=\"\${${ifname}_proto}\""
10 eval "if=\"\${${ifname}_ifname}\""
11 [ "$proto" = "dhcp" ] || continue
12 [ "$if" = "$interface" ] || continue
13 env -i ACTION="$1" INTERFACE="$ifname" PROTO=dhcp /sbin/hotplug iface
14 done
15 }
16
17 case "$1" in
18 deconfig)
19 ifconfig $interface 0.0.0.0
20 hotplug_event ifdown
21 ;;
22 renew|bound)
23 ifconfig $interface $ip \
24 netmask ${subnet:-255.255.255.0} \
25 broadcast ${broadcast:-+}
26
27 if [ -n "$router" ] ; then
28 echo "deleting routers"
29 while route del default gw 0.0.0.0 dev $interface >&- 2>&- ; do :; done
30
31 for i in $router ; do
32 echo "adding router $i"
33 route add default gw $i dev $interface
34 done
35 fi
36
37 echo -n > $RESOLV_CONF
38 ${domain:+echo search $domain} >> $RESOLV_CONF
39 for i in $dns ; do
40 echo "adding dns $i"
41 echo "nameserver $i" >> $RESOLV_CONF
42 done
43
44 hotplug_event ifup
45
46 # user rules
47 [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user
48 ;;
49 esac
50
51 exit 0
This page took 0.040938 seconds and 5 git commands to generate.