dhclient trashes my resolv.conf
Oliver Lehmann
lehmann at ans-netz.de
Wed Oct 27 14:32:43 PDT 2004
Gregory Neil Shapiro wrote:
> > that looks more like a hack than a clear solution (and I didn't tested
> > it)
>
> I personally disagree. IMHO, the whole reason for that function is
> so users can override it (my setup prevents rewrites if the DNS servers
> haven't changed).
I thougt/think, it is just there to prevent redundant code (it is called
twice in dhclient-script).
I think sth. like that in /sbin/dhclient-script would be nice (if there is
no other way to disable - oh yeah, there is chflags schg /etc/resolv.conf)
. /etc/rc.subr
load_rc_config dhclient
make_resolv_conf() {
case "$dhclient_keep_resolv_conf" in
[Yy][Ee][Ss])
;;
*)
if [ x"$new_domain_name_servers" != x ]; then
if [ "x$new_domain_name" != x ]; then
( echo search $new_domain_name >/etc/resolv.conf )
exit_status=$?
else
( rm -f /etc/resolv.conf )
exit_status=$?
fi
if [ $exit_status -ne 0 ]; then
$LOGGER "WARNING: Unable to update resolv.conf:
Error $exit_status"
else
for nameserver in $new_domain_name_servers; do
( echo nameserver $nameserver >>/etc/resolv.conf
)
done
fi
fi
;;
esac
}
And sth. like dhclient_keep_resolv_conf="NO" in defaults/rc.conf
--
Oliver Lehmann
http://www.pofo.de/
http://wishlist.ans-netz.de/
More information about the freebsd-current
mailing list