[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ppp and new users (was: Re: Tecnology and marketing)



john@dhh.gt.org writes:
> As long as the system is dialing into only one isp, we can just put the
> nameservers in /etc/resolv.conf and be happy.  The problem comes when the
> user wants to be able to dial in to several isps.  He should use the name
> servers of the isp he is currently connected to.  The obvious way to do
> this is to put all the nameservers in resolv.conf and re-order it for each
> connection.  I find this distasteful.  Is there a cleaner way to achieve a
> the same result with bind?

It's worse than distateful, if there are multiple packages that try to do this
it can be serious problems. This is why there's a policy prohibition on
packages editting configuration files belonging to another package.

In this case it would appear /etc/resolv.conf doesn't "belong" to any package
at all. Probably the netbase package should adopt it and provide a script to
manipulate it. This script could look at another file the user can customize
to control whether how it ajusts resolv.conf, or whether it is allowed to
touch resolve.conf at all. Bind would have to cause this script to edit the
forwarding nameservers to use, and leave resolv.conf pointing to localhost.

In any case editting /etc/resolv.conf doesn't work very well. I believe 
(ie, I haven't checked the sources, but empirically it would appear that)
The resolver library reads this file once, and if the file changes afterwards
programs that are already running never notice the change. Since it appears
people do want to be able to change nameservers dynamically we should perhaps
look into changing this.

greg

PS, a possible implementation of such a script would be something like:

#!/bin/sh
set -e
if [ ! -r /etc/resolv.auto ] ; then
    # don't do anything
elif grep 'adjust-bind-forwarding' /etc/resolv.auto ; then
    grep -v '^nameserver' /etc/resolv.conf > /etc/resolv.conf.new
    echo 'nameserver 127.0.0.1' >> /etc/resolv.conf.new
    mv /etc/resolv.conf.new /etc/resolv.conf
    /sbin/bindconfig "$@" # whatever arguments needed to set up forwarding
elif grep 'adjust-resolver' /etc/resolv.auto ; then
    grep -v '^nameserver' /etc/resolv.conf > /etc/resolv.conf.new
    if [ -r /etc/resolv.conf.in ] ; then
        cat /etc/resolv.conf.in >> /etc/resolv.conf.new
    end
    for i in "$@" ; do
	echo "$i" >> /etc/resolv.conf.new
    done
    mv /etc/resolv.conf.new /etc/resolv.conf
fi


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: