diff options
author | Chris Cappuccio <chris@cvs.openbsd.org> | 2000-01-31 17:51:43 +0000 |
---|---|---|
committer | Chris Cappuccio <chris@cvs.openbsd.org> | 2000-01-31 17:51:43 +0000 |
commit | 87b819ba76ce350e5390799d34ab4ea24f7e909b (patch) | |
tree | d935a4e47e5aca841df44a9ce8bcb8f61da378a6 /usr.sbin | |
parent | 87fd49747d8e4df1fa404cc0bbaa340d399002fc (diff) |
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
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dhcp/dhclient/scripts/dhclient-script | 39 |
1 files changed, 26 insertions, 13 deletions
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 |