- echo -n > "${RESOLV_CONF}.tmp"
- for i in $dns ; do
- echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
- done
- ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
- mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
-
- change_state network "$ifc" dnsdomain "$domain"
- change_state network "$ifc" dns "$dns"
+ add_dns "$ifc" $dns
+
+ [ -n "$domain" ] && [ "$domain" != "$old_domain" ] && {
+ echo "udhcpc: setting dns domain: $domain"
+ sed -i -e "${old_domain:+/^search $old_domain$/d; }/^search $domain$/d" "${RESOLV_CONF}"
+ echo "search $domain" >> "${RESOLV_CONF}"
+ change_state network "$ifc" dnsdomain "$domain"
+ }