Subject: bin/17087: dhclient-script:make_resolv_conf() doesn't very well
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cagney@mac.com>
List: netbsd-bugs
Date: 05/28/2002 07:55:17
>Number:         17087
>Category:       bin
>Synopsis:       dhclient-script:make_resolv_conf() doesn't very well
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 28 07:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Cagney
>Release:        1.5.2++ (i.e. userland from 1.5 branch)
>Organization:
>Environment:
ac131313@nettle$ uname -a
NetBSD localhost 1.5ZC NetBSD 1.5ZC (NETLUX) #0: Sun Apr  7 14:25:14 EDT 2002     boor@localhost:/usr/src/new/sys/arch/macppc/compile/NETLUX macppc
ac131313@nettle$ 
>Description:
dhclient-script contains:

make_resolv_conf() {
        if [ \( ! -z "$new_domain_name" \) -a \
             \( ! -z "$new_domain_name_servers" \) ]; then
                echo search $new_domain_name > $RESOLV
                for nameserver in $new_domain_name_servers; do
                        echo nameserver $nameserver
                done >> $RESOLV
        fi
}

as a consequence, it only updates /etc/resolv.conf iff there is both a domain name and a list of servers.

I think it should handle each separatly so that, even when there isn't a domain name, the server part is filled in vis:

make_resolv_conf ()
{
    echo -n > $RESOLV
    if test ! -z "$new_domain_name"
    then
        echo search $new_domain_name >> $RESOLV
        echo search $new_domain_name > /dev/console
    fi
    if test ! -z "$new_domain_name_servers"
    then
        for nameserver in $new_domain_name_servers
        do
            echo nameserver $nameserver >> $RESOLV
            echo nameserver $nameserver > /dev/console
        done
    fi
}

I now know why /etc/resolv.conf never gets updated when plugged into one network.

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: