Problems, off and online

David Kastrup dak at gnu.org
Tue Jan 10 06:23:26 EST 2006


Uwe Brauer <oub at mat.ucm.es> writes:

>>>>>> "David" == David Kastrup <dak at gnu.org> writes:
>
>    David> Uwe Brauer <oub at mat.ucm.es> writes:
>
>    David> FWIW, Emacs displays similar behavior at my site.  I suspect
>    David> the name resolver not being made to reread /etc/resolv.conf
>    David> (which gets updated when making a connection) or something
>    David> similar.
>
>    David> It is no problem if no network access is done with the
>    David> freshly started Emacs before the connection is made.  But if
>    David> there is, there is nothing short of exiting and restarting
>    David> Emacs to get it on the net.
>
> Thanks for the confirmation, however I have the impression that the
> problem is more subtle, than simply reading resolv.conf, for I have
> shutdown my LAN (ifconfig eth1 down) connection, open xemacs and start
> the connection, then everything is fine. So it seems that the ppp
> connection somehow behaves differently!

I don't see how this contradicts my guess.  The ppp connection will
temporarily update resolv.conf.

I have in

    /etc/ppp/ip-up.d/0000usepeerdns

the following:

#!/bin/sh -e

# this variable is only set if the usepeerdns pppd option is being used
[ "$USEPEERDNS" ] || exit 0

# exit if the resolvconf package is installed
[ -x /sbin/resolvconf ] && exit 0

# create the file if it does not exist
if [ ! -e /etc/resolv.conf ]; then
  : > /etc/resolv.conf
fi

# follow any symlink to find the real file
REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)

# merge the new nameservers with the other options from the old configuration
{
  cat /etc/ppp/resolv.conf
  grep --invert-match '^nameserver[[:space:]]' "$REALRESOLVCONF" || true
} > "$REALRESOLVCONF.tmp"

# backup the old configuration and install the new one
cp -a "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup"
mv -f "$REALRESOLVCONF.tmp" "$REALRESOLVCONF"

# restart nscd because resolv.conf has changed
if [ -e /var/run/nscd.pid ]; then
  /etc/init.d/nscd restart || true
fi

exit 0



-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




More information about the XEmacs-Beta mailing list