[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: system/3135: dhclient-script doesn't update resolv.conf
- To: bugs_(_at_)_cvs_(_dot_)_openbsd_(_dot_)_org
- Subject: Re: system/3135: dhclient-script doesn't update resolv.conf
- From: Jan Johansson <janj+openbsd_(_at_)_wenf_(_dot_)_org>
- Date: Sun, 9 Mar 2003 01:45:01 -0700 (MST)
- Cc:
- Reply-to: Jan Johansson <janj+openbsd_(_at_)_wenf_(_dot_)_org>
The following reply was made to PR system/3135; it has been noted by GNATS.
From: Jan Johansson <janj+openbsd_(_at_)_wenf_(_dot_)_org>
To: gnats_(_at_)_openbsd_(_dot_)_org
Cc:
Subject: Re: system/3135: dhclient-script doesn't update resolv.conf
Date: Sun, 9 Mar 2003 09:32:22 +0100
The patch is wrong, it adds the name server everytime the DHCP is
updated. This patch clears the resolv.conf before.
Index: dhclient-script
===================================================================
RCS file: /cvs/src/usr.sbin/dhcp/dhclient/scripts/dhclient-script,v
retrieving revision 1.11
diff -u -r1.11 dhclient-script
--- dhclient-script 2000/10/18 23:42:56 1.11
+++ dhclient-script 2003/03/09 08:26:13
@@ -76,19 +76,22 @@
ifconfig $interface inet alias $alias_ip_address netmask $alias_subnet_mask
route add $alias_ip_address 127.0.0.1
fi
- if [ "x$new_domain_name" != "x" ];
+ if [ -n "$new_domain_name_servers" ];
then
- if [ -n "$new_domain_name_servers" ];
+ if [ -f /etc/resolv.conf ]; then
+ rm -f /etc/resolv.conf
+ fi
+ if [ "x$new_domain_name" != "x" ];
then
echo "search $new_domain_name" >/etc/resolv.conf
- for nameserver in $new_domain_name_servers; do
- echo nameserver $nameserver >>/etc/resolv.conf
- done
- if [ -f /etc/resolv.conf.tail ]; then
- cat /etc/resolv.conf.tail >>/etc/resolv.conf
- fi
- exit 0
fi
+ for nameserver in $new_domain_name_servers; do
+ echo nameserver $nameserver >>/etc/resolv.conf
+ done
+ if [ -f /etc/resolv.conf.tail ]; then
+ cat /etc/resolv.conf.tail >>/etc/resolv.conf
+ fi
+ exit 0
fi
fi
@@ -147,21 +150,21 @@
shift; shift
done
fi
- if [ "$new_domain_name" != "" ]; then
- if [ -n "$new_domain_name_servers" ]; then
+ if [ -n "$new_domain_name_servers" ]; then
+ if [ "$new_domain_name" != "" ]; then
echo "search $new_domain_name" >/etc/resolv.conf.std
- for nameserver in $new_domain_name_servers; do
- echo "nameserver $nameserver" >>/etc/resolv.conf.std
- done
- if [ -f /etc/resolv.conf.tail ]; then
- cat /etc/resolv.conf.tail >>/etc/resolv.conf.std
- fi
- if [ -f /etc/resolv.conf ]; then
- rm -f /etc/resolv.conf
- fi
- mv /etc/resolv.conf.std /etc/resolv.conf
- exit 0
fi
+ for nameserver in $new_domain_name_servers; do
+ echo "nameserver $nameserver" >>/etc/resolv.conf.std
+ done
+ if [ -f /etc/resolv.conf.tail ]; then
+ cat /etc/resolv.conf.tail >>/etc/resolv.conf.std
+ fi
+ if [ -f /etc/resolv.conf ]; then
+ rm -f /etc/resolv.conf
+ fi
+ mv /etc/resolv.conf.std /etc/resolv.conf
+ exit 0
fi
fi
fi
Visit your host, monkey.org