Stopping DNS requests

Glynn Clements glynn at gclements.plus.com
Fri Jul 22 20:58:42 PDT 2005


paul rogers wrote:

> > Regardless of whether or not the kernel supports IPv6, some clients
> > and libraries will attempt to perform canonicalisation using an IPv6
> > query first, then IPv4 if the IPv6 query fails.
> 
> This is an LFS based system, so I compile everything from scratch. Is
> that optional? For the time being I'm not aware of any need for IPv6
> support. I don't think my ISP supports it, my LAN doesn't.

I use Gentoo, which has an "ipv6" USE flag. I compile everything with
"-ipv6", which disables it. Some packages might require an explicit
--disable-ipv6 (or similar) flag.

Gentoo's xorg-x11 ebuild handles the ipv6 as follows:

	if use ipv6; then
		# In case Gentoo ever works on a system with IPv6 sockets that don't
		# also listen on IPv4 (see config/cf/X11.tmpl)
		echo "#define PreferXdmcpIPv6 YES" >> ${HOSTCONF}
	fi

	use_build ipv6 BuildIPv6

Where the use_build command will run either:

	echo "#define BuildIPv6 YES" >> ${HOSTCONF}
or
	echo "#define BuildIPv6 NO" >> ${HOSTCONF}

depending upon whether the ipv6 USE flag was defined.

[NB: ${HOSTCONF} is "config/cf/host.def"]

So, I suspect that you need to add:

	#define BuildIPv6 NO

to config/cf/host.def.before building X if you don't want IPv6
support.

> > Note that the client isn't interested in the IP address which is
> > returned, but in the canonical hostname which is returned along with
> > it.
> 
> I haven't found an understandable "HOWTO" for doing that in /etc/hosts
> yet, if you would have a reference. 99% of the time my "network"
> consists of the workstation and the (LEAF-Bering) firewall/gateway, my
> LAN's "server" isn't running. So I have tried to set up everything to
> resolve by files.

I haven't found anything authoritative, but I did come across this:

	http://lists.debian.org/debian-ipv6/2002/10/msg00042.html

which suggests that something like this:

	::FFFF:192.168.1.1 local-host.local-domain

in /etc/hosts may work.

Even if you manage to disable the IPv6 usage within X, it's probably a
good idea to figure out how to stop IPv6-enabled hostname
canonicalisation from performing a DNS query. It's quite likely that X
won't be the only thing which does this unless you forcibly disable
it.

> > Does it happen if you use "x=xterm startx" or "x=twm startx"? Or even
> 
> Yes, in both cases.
> 
> > something simpler, e.g. "xinit /usr/X11R6/bin/xlogo"? If it also
> 
> No, neither when I run just "Xorg".

But I bet that "startx /usr/X11R6/bin/xlogo" does cause it; see below.

> > happens in those cases, it looks like it's the X server.
> 
> I had thought it was something that happened down the startx thread.

Hmm. My "startx" script calls a couple of things which may be relevant:

1. "hostname -f"
2. xauth.

You said earlier that "hostname -f" doesn't cause it, but looking at
the source code for recent versions of xauth indicates that it will
try to perform IPv6 lookups using getaddrinfo() if IPv6 support is
enabled:

http://cvs.freedesktop.org/xorg/xc/programs/xauth/gethost.c?rev=1.2&view=markup

Try running e.g. "nm -D /usr/X11R6/bin/xauth"; if "getaddrinfo"
appears in the output, your xauth binary was built with IPv6 support,
and will try to use IPv6 lookups for hostname canonicalisation.

> > If it only happens when you run blackbox/fluxbox, then it would appear
> > to be one of those programs (or a library which they use).
> 
> I'm using the same installations I had when running XFree86-4.2.1, and
> they didn't then.
> 
> I still have the source/build directories online, would the xmakefile
> be helpful?

Checking whether "nm -D .../xauth" shows a dependency upon getaddrinfo
is likely to be the most reliable test of whether IPv6 support was
enabled.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list