• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Set net.<iface>.dnsN properties that contain the
2# DNS server addresses given by the DHCP server.
3
4if [[ $interface == p2p* ]]
5    then
6    intf=p2p
7    else
8    intf=$interface
9fi
10
11set_dns_props()
12{
13    case "${new_domain_name_servers}" in
14    "")   return 0;;
15    esac
16
17    count=1
18    for i in 1 2 3 4; do
19        setprop dhcp.${intf}.dns${i} ""
20    done
21
22    count=1
23    for dnsaddr in ${new_domain_name_servers}; do
24        setprop dhcp.${intf}.dns${count} ${dnsaddr}
25        count=$(($count + 1))
26    done
27}
28
29unset_dns_props()
30{
31    for i in 1 2 3 4; do
32        setprop dhcp.${intf}.dns${i} ""
33    done
34}
35
36case "${reason}" in
37BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)       set_dns_props;;
38EXPIRE|FAIL|IPV4LL|RELEASE|STOP)                unset_dns_props;;
39esac
40