Path: blob/master/system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf
4283 views
# Set net.<iface>.dnsN properties that contain the1# DNS server addresses given by the DHCP server.23if [[ $interface == p2p* ]]4then5intf=p2p6else7intf=$interface8fi910set_dns_props()11{12case "${new_domain_name_servers}" in13"") return 0;;14esac1516count=117for i in 1 2 3 4; do18setprop dhcp.${intf}.dns${i} ""19done2021count=122for dnsaddr in ${new_domain_name_servers}; do23setprop dhcp.${intf}.dns${count} ${dnsaddr}24count=$(($count + 1))25done2627separator=" "28if [ -z "$new_domain_name" ]; then29separator=""30else31if [ -z "$new_domain_search" ]; then32separator=""33fi34fi35setprop dhcp.${interface}.domain "${new_domain_name}$separator${new_domain_search}"36}3738unset_dns_props()39{40for i in 1 2 3 4; do41setprop dhcp.${intf}.dns${i} ""42done4344setprop dhcp.${interface}.domain ""45}4647case "${reason}" in48BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT) set_dns_props;;49EXPIRE|FAIL|IPV4LL|RELEASE|STOP) unset_dns_props;;50esac515253