#!/system/bin/sh # Set dhcp.ipv6..dnsN properties that contain the # DNS server addresses given by the DHCPv6 server. set_dns_props() { case "${new_domain_name_servers}" in "") return 0;; esac count=1 for i in 1 2; do setprop dhcp.ipv6.${interface}.dns${i} "" done count=1 for dnsaddr in ${new_domain_name_servers}; do case "$count" in 1|2) setprop dhcp.ipv6.${interface}.dns${count} ${dnsaddr} ;; esac count=$(($count + 1)) done } unset_dns_props() { for i in 1 2; do setprop dhcp.ipv6.${interface}.dns${i} "" setprop net.dns.ipv6_${i} "" done } unset_iana_props() { setprop dhcp.ipv6.${interface}.leasetime "" setprop dhcp.ipv6.${interface}.ipaddress "" } # For debugging: setprop dhcp.ipv6.${interface}.reason "${REASON}" case "${REASON}" in REQUEST|CONFIRM|INFOREQ) set_dns_props setprop dhcp.ipv6.${interface}.result "ok" ;; RENEW|REBIND) set_dns_props setprop dhcp.ipv6.${interface}.renewresult "ok" ;; RELEASE) unset_dns_props unset_iana_props setprop dhcp.ipv6.${interface}.result "released" ;; *) setprop dhcp.ipv6.${interface}.result "failed" ;; esac