Subject: bin/8026: dhclient-script patch
To: None <gnats-bugs@gnats.netbsd.org>
From: Mason Loring Bliss <mason@acheron.middleboro.ma.us>
List: netbsd-bugs
Date: 07/18/1999 09:36:12
>Number:         8026
>Category:       bin
>Synopsis:       allow control of resolv.conf generation in dhclient-script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 18 09:35:01 1999
>Last-Modified:
>Originator:     Mason Loring Bliss
>Organization:
    Mason Loring Bliss  mason@acheron.middleboro.ma.us  They also surf who
awake ? sleep : dream;  http://acheron.ne.mediaone.net  only stand on waves.
>Release:        1999.07.18
>Environment:
	
System: NetBSD acheron.middleboro.ma.us 1.4G NetBSD 1.4G (MLB) #9: Sun Jul 18 12:19:24 EDT 1999 root@acheron.middleboro.ma.us:/usr/src/sys/arch/i386/compile/MLB i386


>Description:

I have a cable modem on a NetBSD box, and a LAN behind that that uses IP-NAT.
Because of this, I run named on my box so that internal addresses can have
names. dhclient-script automatically overwrites /etc/resolv.conf every time
it runs, which is bad. This should be configurable.

>How-To-Repeat:

Reboot.

>Fix:

There's already a mechanism for setting up custom behaviour for dhclient-
script - dhclient-enter-hooks. The following patch doesn't change the default
behaviour of dhclient-script at all, but if someone sets an environment
variable in /etc/dhclient-enter-hooks with the appropriate name and value,
/etc/resolv.conf will not be overwritten.



Here's a sample /etc/dhclient-enter-hooks file:

#!/bin/sh
export make_new_resolv_conf=NO



Here's a simple patch to make this work:

*** netbsd	Sun Jul 18 12:02:34 1999
--- netbsd.fixed	Sun Jul 18 12:06:40 1999
***************
*** 129,135 ****
      ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
      route add $alias_ip_address 127.0.0.1
    fi
!   make_resolv_conf
    exit_with_hooks 0
  fi
  
--- 129,137 ----
      ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
      route add $alias_ip_address 127.0.0.1
    fi
!   if [ x$make_new_resolv_conf != xNO ]; then
!     make_resolv_conf
!   fi
    exit_with_hooks 0
  fi
  
***************
*** 196,202 ****
  	route add $0 $1
  	shift; shift
        done
!       make_resolv_conf
        exit_with_hooks 0
      fi
    fi
--- 198,206 ----
  	route add $0 $1
  	shift; shift
        done
!       if [ x$make_new_resolv_conf != xNO ]; then
!         make_resolv_conf
!       fi
        exit_with_hooks 0
      fi
    fi

>Audit-Trail:
>Unformatted: