From 87b819ba76ce350e5390799d34ab4ea24f7e909b Mon Sep 17 00:00:00 2001 From: Chris Cappuccio Date: Mon, 31 Jan 2000 17:51:43 +0000 Subject: Don't update /etc/resolv.conf if no data is returned for DNS servers or if user removes request domain-name-servers from /etc/dhclient.conf --- usr.sbin/dhcp/dhclient/scripts/dhclient-script | 39 +++++++++++++++++--------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/dhcp/dhclient/scripts/dhclient-script b/usr.sbin/dhcp/dhclient/scripts/dhclient-script index c2e289422b3..8cea2640444 100644 --- a/usr.sbin/dhcp/dhclient/scripts/dhclient-script +++ b/usr.sbin/dhcp/dhclient/scripts/dhclient-script @@ -1,4 +1,7 @@ #!/bin/sh +# +# $OpenBSD: dhclient-script,v 1.3 2000/01/31 17:51:42 chris Exp $ +# if [ x$new_network_number != x ]; then echo New Network Number: $new_network_number @@ -85,11 +88,17 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg route add $alias_ip_address 127.0.0.1 fi - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done - exit 0 + if [ x$new_domain_name != x ]; + then + if [ x$nameserver != 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 + exit 0 + fi + fi fi if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then @@ -147,15 +156,19 @@ if [ x$reason = xTIMEOUT ]; then shift; shift done fi - 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 ]; then - rm -f /etc/resolv.conf + if [ "$new_domain_name" != "" ]; then + if [ "$nameserver" != "" ]; 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 ]; then + rm -f /etc/resolv.conf + fi + mv /etc/resolv.conf.std /etc/resolv.conf + exit 0 + fi fi - mv /etc/resolv.conf.std /etc/resolv.conf - exit 0 fi fi ifconfig $interface inet -alias $new_ip_address $medium -- cgit v1.2.3