Comment 8 for bug 8634

Revision history for this message
In , Paul Kremer (paulkremer) wrote : dhcp3-client: suggested patch

Package: dhcp3-client
Version: 3.0+3.0.1rc13-1
Severity: normal
Followup-For: Bug #159529

Hi,
this is a very old issues that should be fairly easy to correct by
making the if a boolean OR relation and by keeping old nameservers if no
new ones were provided. At least, that should work for 99% of the
people, at least more than it currently does.

The argument stating that the DHCP-server has to respond with a domain
name, is a bit invalid, as there are many proprietary hardware routers
(e.g. DSL modems...) out there which don't do that.

here is my patch (requires 'sed' to be installed, don't know if that is
a problem):

--- dhclient-script.orig 2004-04-22 21:56:56.000000000 +0200
+++ dhclient-script 2004-04-22 22:16:42.000000000 +0200
@@ -7,15 +7,19 @@
 # The alias handling in here probably still sucks. -mdz

 make_resolv_conf() {
- if [ -n "$new_domain_name" -a -n "$new_domain_name_servers" ]; then
+ if [ -n "$new_domain_name" -o -n "$new_domain_name_servers" ]; then
         local new_resolv_conf=/etc/resolv.conf.dhclient-new
         rm -f $new_resolv_conf
         if [ -n "$new_domain_name" ]; then
             echo search $new_domain_name >>$new_resolv_conf
         fi
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>$new_resolv_conf
- done
+ if [ -n "$new_domain_name_servers" ]; then
+ for nameserver in $new_domain_name_servers; do
+ echo nameserver $nameserver >>$new_resolv_conf
+ done
+ else # keep 'old' nameservers
+ sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
+ fi
         chown --reference=/etc/resolv.conf $new_resolv_conf
         chmod --reference=/etc/resolv.conf $new_resolv_conf
         mv $new_resolv_conf /etc/resolv.conf

-- System Information:
Debian Release: sarge
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.24-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8

Versions of packages dhcp3-client depends on:
ii debconf 1.4.22 Debian configuration management sy
ii debianutils 2.8.1 Miscellaneous utilities specific t
ii dhcp3-common 3.0+3.0.1rc13-1 Common files used by all the dhcp3
ii libc6 2.3.2.ds1-11 GNU C Library: Shared libraries an

-- no debconf information