1# Set net.<iface>.dnsN properties that contain the 2# DNS server addresses given by the DHCP server. 3 4set_dns_props() 5{ 6 case "${new_domain_name_servers}" in 7 "") return 0;; 8 esac 9 10 count=1 11 for i in 1 2 3 4; do 12 setprop dhcp.${interface}.dns${i} "" 13 done 14 15 count=1 16 for dnsaddr in ${new_domain_name_servers}; do 17 setprop dhcp.${interface}.dns${count} ${dnsaddr} 18 count=$(($count + 1)) 19 done 20} 21 22unset_dns_props() 23{ 24 for i in 1 2 3 4; do 25 setprop dhcp.${interface}.dns${i} "" 26 done 27} 28 29case "${reason}" in 30BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) set_dns_props;; 31EXPIRE|FAIL|IPV4LL|RELEASE|STOP) unset_dns_props;; 32esac 33