Subject: bin/12065: /etc/resolv.conf corrupted during DHCP lease renewal
To: None <gnats-bugs@gnats.netbsd.org>
From: None <sjg@quick.com.au>
List: netbsd-bugs
Date: 01/27/2001 21:55:25
>Number: 12065
>Category: bin
>Synopsis: /etc/resolv.conf corrupted during DHCP lease renewal
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jan 27 21:58:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Simon J. Gerraty
>Release: 1.5
>Organization:
Zen Programming...
>Environment:
System: NetBSD too 1.5L NetBSD 1.5L (TOO) #0: Thu Dec 7 01:09:02 PST 2000 root@too:/l0/NetBSD/obj/sys/compile/TOO sparc
>Description:
I think this is a /bin/sh bug, hence the priority. I've only seen this
on sparcs running 1.5 and later, but others report the problem on
earlier releases and other platforms (eg 1.4/i386).
dhclient script contains:
make_resolv_conf() {
echo search $new_domain_name >/etc/resolv.conf
for nameserver in $new_domain_name_servers; do
echo nameserver $nameserver >>/etc/resolv.conf
done
}
When dhclient-exit-hooks containing:
if [ "$new_ntp_servers" ]; then
case " $new_ntp_servers " in
*" $new_ip_address "*) ;;# don't frob ntp.conf on one of the servers!
*)
for ntp in $new_ntp_servers
do
echo server $ntp
done > /etc/ntp.conf
if [ "$old_ntp_servers" != "$new_ntp_servers" ]; then
[ -s /etc/rc_d/ntp ] && /etc/rc_d/ntp stop
ntpdate -b -v $new_ntp_servers
[ -s /etc/rc_d/ntp ] && /etc/rc_d/ntp start
fi
;;
esac
fi
is sourced by dhclient-script, the stdout from the ntpdate and
ntpd startup scripts ends up in /etc/resolv.conf
With the above script this only happens when the ntp server list
is updated.
>How-To-Repeat:
Put something in /etc/dhclient-exit-hooks that will output to stdout.
>Fix:
An effective work around is to put
#!/bin/ksh
at the start of dhclient-script. This lends weight to the notion that
this is a bug in /bin/sh
>Release-Note:
>Audit-Trail:
>Unformatted: