You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by da...@sent.com on 2013/11/02 22:07:19 UTC

apr name-resolution (e.g. used in SVN) fails if /etc/resolv.conf points to nameserver IPv6-addresses

Using Subversion v1.8.4 to checkout repositories FAILs @ name-resolution
if using a URL-target, rather than an IP-address-target, when resolvers
in /etc/resolv.conf point to nameservers @ addresses.

I raised this issue @ Subversion ML
(http://news.gmane.org/gmane.comp.version-control.subversion.user), and
was advised to bring it to dev@apr.apache.org:

	"It is either an APR issue, or a packaging issue. APR's
	apr_sockaddr_info_get function, which Subversion uses to resolve
	a
	hostname, does not have a flag to enable or disable IPv6 DNS
	lookups.
	All your list above proves is that your APR does not support DNS
	lookups
	to IPv6 name servers. I don't know whether this is a general
	limitation
	of APR, or whether your particular version of APR is too old, or
	compiled in a way that those lookups are disabled. In any case,
	I
	suggest you take that question to the APR developers; it's
	dev@apr.apache.org.

	But please be prepared to give a bit more information about your
	environment, starting with your OS version and APR version."

In summary:

 (1) if resolv.conf -> IPv4, packaged svn co @ URL-target               
 ====> OK
 (2) if resolv.conf -> IPv6, packaged svn co @ URL-target               
 ====> FAIL
 (3) if resolv.conf -> IPv4, built-from-src svn co @ URL-target         
 ====> OK
 (4) if resolv.conf -> IPv6, built-from-src svn co @ URL-target         
 ====> FAIL
 (5) if resolv.conf -> IPv4, packaged svn co @ IPv4-address-target      
 ====> OK
 (6) if resolv.conf -> IPv6, packaged svn co @ IPv4-address-target      
 ====> OK
 (7) if resolv.conf -> IPv4, built-from-src svn co @ IPv6-address-target
 ====> OK
 (8) if resolv.conf -> IPv6, built-from-src svn co @ IPv6-address-target
 ====> OK

Q: Is this an APR bug or other config issue?

--darx

Details:

	uname -a
		Linux darxdev.int 3.7.10-1.16-desktop #1 SMP PREEMPT Fri
		May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64 x86_64
		GNU/Linux

With each/either of 2 subversion+apr instances:

(1) distro-packaged

	rpm -qa | egrep -i "apr|subversion"
		libapr1-devel-1.4.8-48.1.x86_64
		libapr-util1-devel-1.5.2-39.1.x86_64
		libapr1-1.4.8-48.1.x86_64
		libapr-util1-1.5.2-39.1.x86_64
		subversion-1.8.4-127.1.x86_64

	/usr/bin/svn --version --verbose
	/usr/bin/apr-1-config  --version
		1.4.8
	/usr/bin/apr-1-config  --cppflags --cflags --ldflags --libs
		-DLINUX -D_REENTRANT -D_GNU_SOURCE  -pthread   -lpthread
		-ldl

	/usr/bin/svn --version --verbose
		svn, version 1.8.4 (r1534716)

		Copyright (C) 2013 The Apache Software Foundation.
		This software consists of contributions made by many
		people;
		see the NOTICE file for more information.
		Subversion is open source software, see
		http://subversion.apache.org/

		The following repository access (RA) modules are
		available:

		* ra_svn : Module for accessing a repository using the
		svn network protocol.
		  - with Cyrus SASL authentication
		  - handles 'svn' scheme
		* ra_local : Module for accessing a repository on local
		disk.
		  - handles 'file' scheme
		* ra_serf : Module for accessing a repository via WebDAV
		protocol using serf.
		  - using serf 1.3.2
		  - handles 'http' scheme
		  - handles 'https' scheme

		System information:

		* running on x86_64-unknown-linux-gnu
		  - openSUSE 12 (Dartmout) [Linux 3.7.10-1.16-xen]
		* linked dependencies:
		  - APR 1.4.8 (compiled with 1.4.6)
		  - APR-Util 1.5.2 (compiled with 1.4.1)
		  - SQLite 3.7.15.1 (static)

	ldd /usr/bin/svn | egrep -i apr
	        libaprutil-1.so.0 => /usr/lib64/libaprutil-1.so.0
	        (0x00007fa1753da000)
	        libapr-1.so.0 => /usr/lib64/libapr-1.so.0
	        (0x00007fa1751ab000)


(2) locally built

	cd     /home/darxSVN_TEST
	wget http://download.nextag.com/apache/apr/apr-1.4.8.tar.gz
	wget http://download.nextag.com/apache/apr/apr-util-1.5.2.tar.gz
	wget
	http://psg.mtu.edu/pub/apache/subversion/subversion-1.8.4.tar.gz
	tar zxvf apr-1.4.8.tar.gz
	tar zxvf apr-util-1.5.2.tar.gz
	tar zxvf subversion-1.8.4.tar.gz

	cd apr-1.4.8
	./configure \
	--prefix=/home/darxSVN_TEST/apr1 \
	--libdir=/home/darxSVN_TEST/apr1/lib64 \
	--enable-ipv6
	make -j4
	make install

	cd ../apr-util-1.5.2
	./configure \
	--prefix=/home/darxSVN_TEST/apr1 \
	--libdir=/home/darxSVN_TEST/apr1/lib64 \
	--with-apr=/home/darxSVN_TEST/apr1/bin/apr-1-config
	make -j4
	make install

	cd ..
	ls -al ./apr1/lib64/*.so
		lrwxrwxrwx 1 root root 17 Nov  2 11:50
		./apr1/lib64/libapr-1.so -> libapr-1.so.0.4.8*
		lrwxrwxrwx 1 root root 21 Nov  2 11:50
		./apr1/lib64/libaprutil-1.so -> libaprutil-1.so.0.5.2*

	cd ./subversion-1.8.4

	LDFLAGS="-L/home/darxSVN_TEST/apr1/lib64
	-Wl,-rpath,/home/darxSVN_TEST/apr1/lib64 -laprutil-1 -lapr-1"
	LIBS="-laprutil-1 -lapr-1"

	make clean
	./configure \
	--prefix=/home/darxSVN_TEST/svn184 \
	--libdir=/home/darxSVN_TEST/svn184/lib64 \
	--with-apr=/home/darxSVN_TEST/apr1/bin/apr-1-config \
	--with-apr-util=/home/darxSVN_TEST/apr1/bin/apu-1-config \
	--with-gnu-ld \
	--with-serf
	make -j4
	make install

	ldd /home/darxSVN_TEST/svn184/bin/svn | grep apr
	        libaprutil-1.so.0 =>
	        /home/darxSVN_TEST/apr1/lib64/libaprutil-1.so.0
	        (0x00007f5cdec92000)
	        libapr-1.so.0 =>
	        /home/darxSVN_TEST/apr1/lib64/libapr-1.so.0
	        (0x00007f5cde83b000)


	/home/darxSVN_TEST/apr1/bin/apr-1-config --version
		1.4.8
	/home/darxSVN_TEST/apr1/bin/apr-1-config  --cppflags --cflags
	--ldflags --libs
		-DLINUX -D_REENTRANT -D_GNU_SOURCE  -pthread  -luuid
		-lrt -lcrypt  -lpthread -ldl

	/home/darxSVN_TEST/svn184/bin/svn --version --verbose
		svn, version 1.8.4 (r1534716)
		   compiled Nov  2 2013, 12:31:46 on
		   x86_64-unknown-linux-gnu

		Copyright (C) 2013 The Apache Software Foundation.
		This software consists of contributions made by many
		people;
		see the NOTICE file for more information.
		Subversion is open source software, see
		http://subversion.apache.org/

		The following repository access (RA) modules are
		available:

		* ra_svn : Module for accessing a repository using the
		svn network protocol.
		  - with Cyrus SASL authentication
		  - handles 'svn' scheme
		* ra_local : Module for accessing a repository on local
		disk.
		  - handles 'file' scheme
		* ra_serf : Module for accessing a repository via WebDAV
		protocol using serf.
		  - using serf 1.3.2
		  - handles 'http' scheme
		  - handles 'https' scheme

		System information:

		* running on x86_64-unknown-linux-gnu
		  - openSUSE 12 (Dartmout) [Linux 3.7.10-1.16-xen]
		* linked dependencies:
		  - APR 1.4.8 (compiled with 1.4.8)
		  - APR-Util 1.5.2 (compiled with 1.5.2)
		  - SQLite 3.8.1 (compiled with 3.8.1)

with resolvers set to IPv4

	cat /etc/resolv.conf
		nameserver 74.207.241.5
		nameserver 74.207.242.5
		options rotate

checking hosts

	dig A    www.nlnetlabs.nl      +short
		213.154.224.1
	dig AAAA www.nlnetlabs.nl      +short
		2001:7b8:206:1::1

no problems with resolver.

testing SVN co's

	S="www.nlnetlabs.nl"
	T="svn/nsd/tags/NSD_4_0_0_REL/tpkg/manual"

OK
	rm -rf test
	/usr/bin/svn co http://$S/$T test
		...
		Checked out revision 4089.
OK
	rm -rf test
	/usr/bin/svn co http://213.154.224.1/$T test
		...
		Checked out revision 4089.
OK
	rm -rf test
	/usr/bin/svn co http://[2001:7b8:206:1::1]/$T test
		...
		Checked out revision 4089.
OK
	rm -rf test
	/home/darxSVN_TEST/svn184/bin/svn co http://$S/$T test
		...
		Checked out revision 4089.
OK
	rm -rf test
	/home/darxSVN_TEST/svn184/bin/svn co http://213.154.224.1/$T
	test
		...
		Checked out revision 4089.
OK
	rm -rf test
	/home/darxSVN_TEST/svn184/bin/svn co
	http://[2001:7b8:206:1::1]/$T test
		...
		Checked out revision 4089.

switching to resolvers set to IPv6

	cat /etc/resolv.conf
		nameserver 2600:3c01::2
		nameserver 2600:3c01::3
		options rotate

checking hosts

	dig A    www.nlnetlabs.nl      +short
		213.154.224.1
	dig AAAA www.nlnetlabs.nl      +short
		2001:7b8:206:1::1

no problems with resolver

repeat testing SVN co's

	rm -rf test
FAIL
	/usr/bin/svn co http://$S/$T test
		svn: E670002: Unable to connect to a repository at URL
		'http://www.nlnetlabs.nl/svn/nsd/tags/NSD_4_0_0_REL/tpkg/manual'
		svn: E670002: Name or service not known
OK
	rm -rf test
	/usr/bin/svn co http://213.154.224.1/$T test
		...
		Checked out revision 4089.
OK
	rm -rf test
	/usr/bin/svn co http://[2001:7b8:206:1::1]/$T test
		...
		Checked out revision 4089.
FAIL
	rm -rf test
	/home/darxSVN_TEST/svn184/bin/svn co http://$S/$T test
		svn: E670002: Unable to connect to a repository at URL
		'http://www.nlnetlabs.nl/svn/nsd/tags/NSD_4_0_0_REL/tpkg/manual'
		svn: E670002: Name or service not known
OK
	rm -rf test
	/home/darxSVN_TEST/svn184/bin/svn co http://213.154.224.1/$T
	test
		...
		Checked out revision 4089.
OK
	rm -rf test
	/home/darxSVN_TEST/svn184/bin/svn co
	http://[2001:7b8:206:1::1]/$T test
		...
		Checked out revision 4089.


Re: apr name-resolution (e.g. used in SVN) fails if /etc/resolv.conf points to nameserver IPv6-addresses

Posted by da...@sent.com.
Fyi, for those interested,

On Sun, Nov 3, 2013, at 11:32 AM, Ben Reser wrote:
> Glad you figured it out.

, not entirely.

@ https://bugzilla.novell.com/show_bug.cgi?id=848783#c4

The issue's been pushed (back) to the "lipapr1 maintainer", where it
sits being ignored.  I'll bump it, but it seems there's blame being
placed on libapr.  Whether that's @distro, or @upstream, remains to be
seen.

Re: apr name-resolution (e.g. used in SVN) fails if /etc/resolv.conf points to nameserver IPv6-addresses

Posted by Ben Reser <be...@reser.org>.
On 11/2/13 7:35 PM, darx@sent.com wrote:
> Turns out it's real, but has nothing to do with svn, apr, or serf.
> 
> Rather, the culprit is "options rotate" in /etc/resolv.conf.  Remove it,
> problem goes away.
> 
> ( @BenReser, iiuc, you did NOT try that in your tests ... )
> 
> It's a known bug in glibc, and, afaict, has NOT yet been patched on my
> distro (opensuse).
> 
> fyi, I've posted a bug
> (https://bugzilla.novell.com/show_bug.cgi?id=848783) with referenced to
> other sightings, and a patch @redhat.

Glad you figured it out.  No I did not try "options rotate", but it wouldn't
have helped I was testing on OS X which doesn't have glibc but rather has a BSD
based libc that's unique to the Mac.  My Linux setups weren't in as easy of a
situation to change to pure IPv6 resolvers.

Re: apr name-resolution (e.g. used in SVN) fails if /etc/resolv.conf points to nameserver IPv6-addresses

Posted by da...@sent.com.
Turns out it's real, but has nothing to do with svn, apr, or serf.

Rather, the culprit is "options rotate" in /etc/resolv.conf.  Remove it,
problem goes away.

( @BenReser, iiuc, you did NOT try that in your tests ... )

It's a known bug in glibc, and, afaict, has NOT yet been patched on my
distro (opensuse).

fyi, I've posted a bug
(https://bugzilla.novell.com/show_bug.cgi?id=848783) with referenced to
other sightings, and a patch @redhat.

darx

Re: apr name-resolution (e.g. used in SVN) fails if /etc/resolv.conf points to nameserver IPv6-addresses

Posted by da...@sent.com.

On Sat, Nov 2, 2013, at 04:14 PM, Ben Reser wrote:
> I suspect that your distro provided APR does not have proper IPv6 support
> included in it.

My tests includec BOTH the distro-provided APR *and* my DIY'd
built-from-src APR with ipv6 explicitly enabled 

> As far as I can tell from your info in this email you aren't rebuilding serf

correct.  remedying that ...

> serf is built against a different APR than Subversion is.

In the test following, apr, apr-util, serf and subversion are
version-consistently built.

The distro-provided AND source-built SVN *both* still FAIL in the case
of URL name targets, and SUCCEED in the case of URL IP-address targets.

details:

cd     /home/darx/SVN_TEST
rm -rf /home/darx/SVN_TEST/*

wget http://download.nextag.com/apache/apr/apr-1.4.8.tar.gz
wget http://download.nextag.com/apache/apr/apr-util-1.5.2.tar.gz
wget http://serf.googlecode.com/files/serf-1.3.2.tar.bz2
wget http://psg.mtu.edu/pub/apache/subversion/subversion-1.8.4.tar.gz


tar zxvf apr-1.4.8.tar.gz
tar zxvf apr-util-1.5.2.tar.gz
tar jxvf serf-1.3.2.tar.bz2
tar zxvf subversion-1.8.4.tar.gz

cd apr-1.4.8
./configure \
--prefix=/home/darx/SVN_TEST/apr1 \
--libdir=/home/darx/SVN_TEST/apr1/lib64 \
--enable-ipv6
make -j4
make install

cd ../apr-util-1.5.2
./configure \
--prefix=/home/darx/SVN_TEST/apr1 \
--libdir=/home/darx/SVN_TEST/apr1/lib64 \
--with-apr=/home/darx/SVN_TEST/apr1/bin/apr-1-config
make -j4
make install

cd ../serf-1.3.2
scons -c
scons \
 PREFIX=/home/darx/SVN_TEST/serf \
 LIBDIR=/home/darx/SVN_TEST/serf/lib64 \
 APR=/home/darx/SVN_TEST/apr1/bin/apr-1-config \
 APU=/home/darx/SVN_TEST/apr1/bin/apu-1-config
scons install

cd ../subversion-1.8.4

LDFLAGS="-L/home/darx/SVN_TEST/apr1/lib64
-Wl,-rpath,/home/darx/SVN_TEST/apr1/lib64
-L/home/darx/SVN_TEST/serv/lib64
-Wl,rpath,/home/darx/SVN_TEST/serv/lib64 -laprutil-1 -lapr-1 -lserf"
LIBS="-laprutil-1 -lapr-1 -lserf"

make clean
./configure \
--prefix=/home/darx/SVN_TEST/svn184 \
--libdir=/home/darx/SVN_TEST/svn184/lib64 \
--with-apr=/home/darx/SVN_TEST/apr1/bin/apr-1-config \
--with-apr-util=/home/darx/SVN_TEST/apr1/bin/apu-1-config \
--with-gnu-ld \
--with-serf
make -j4
make install

verify consistent apr, apr-util, serf, subversion links

	ldd /home/darx/SVN_TEST/svn184/bin/svn | egrep -i "apr|serf"
		libsvn_ra_serf-1.so.0 =>
		/home/darx/SVN_TEST/svn184/lib64/libsvn_ra_serf-1.so.0
		(0x00007fcf15ae0000)
		libserf-1.so.1 =>
		/home/darx/SVN_TEST/serf/lib64/libserf-1.so.1
		(0x00007fcf158c6000)
		libaprutil-1.so.0 =>
		/home/darx/SVN_TEST/apr1/lib64/libaprutil-1.so.0
		(0x00007fcf14b1e000)
		libapr-1.so.0 =>
		/home/darx/SVN_TEST/apr1/lib64/libapr-1.so.0
		(0x00007fcf148ef000)

with resolvers set to IPv6

	cat /etc/resolv.conf
		nameserver 2600:3c01::2
		nameserver 2600:3c01::3
		options rotate

checking hosts

	dig A    www.nlnetlabs.nl      +short
		213.154.224.1
	dig AAAA www.nlnetlabs.nl      +short
		2001:7b8:206:1::1

no problems with resolver

testing 2 specific FAIL cases, as reported previously,

	S="www.nlnetlabs.nl"
	T="svn/nsd/tags/NSD_4_0_0_REL/tpkg/manual"

both

	rm -rf test
	/usr/bin/svn co http://$S/$T test
		svn: E670002: Unable to connect to a repository at URL
		'http://www.nlnetlabs.nl/svn/nsd/tags/NSD_4_0_0_REL/tpkg/manual'
		svn: E670002: Name or service not known

and

	rm -rf test
	/home/darx/SVN_TEST/svn184/bin/svn co http://$S/$T test
		svn: E670002: Unable to connect to a repository at URL
		'http://www.nlnetlabs.nl/svn/nsd/tags/NSD_4_0_0_REL/tpkg/manual'
		svn: E670002: Name or service not known

still FAIL.

but, testing with the numeric IPv6 IP-address, both

	rm -rf test
	/usr/bin/svn co http://[2001:7b8:206:1::1]/$T test
		...
		Checked out revision 4089.

and

	rm -rf test
	/home/darx/SVN_TEST/svn184/bin/svn co
	http://[2001:7b8:206:1::1]/$T test
		...
		Checked out revision 4089.

still succeed.


Re: apr name-resolution (e.g. used in SVN) fails if /etc/resolv.conf points to nameserver IPv6-addresses

Posted by Ben Reser <be...@reser.org>.
On 11/2/13 2:07 PM, darx@sent.com wrote:
> Using Subversion v1.8.4 to checkout repositories FAILs @ name-resolution
> if using a URL-target, rather than an IP-address-target, when resolvers
> in /etc/resolv.conf point to nameservers @ addresses.

I suspect that your distro provided APR does not have proper IPv6 support
included in it.  All of your tests are using HTTP which uses ra_serf in 1.8.x
and which ultimately uses the serf library.  Subversion provides the URL to the
serf library and the serf library is responsible for resolving it.  The serf
library uses APR as well.

As far as I can tell from your info in this email you aren't rebuilding serf
but are using a distro provided version or only built it once in which case
serf is using the distro provided APR.  Rebuild serf pointed at your rebuilt
APR with IPv6 support and I suspect you'll find that everything works fine.

To be perfectly honest, I'd a tad surprised that things work right at all if
serf is built against a different APR than Subversion is.