http://bugzilla.novell.com/show_bug.cgi?id=606980 http://bugzilla.novell.com/show_bug.cgi?id=606980#c0 Summary: getaddrinfo() returns duplicate addresses under AI_ADDRCONFIG Classification: openSUSE Product: openSUSE 11.2 Version: Final Platform: i686 OS/Version: openSUSE 11.2 Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: matthias.andree@gmx.de QAContact: qa@suse.de Found By: --- Blocker: --- Created an attachment (id=363088) --> (http://bugzilla.novell.com/attachment.cgi?id=363088) demo code that shows the problem User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3 Presume I have a computer that has no global IPv6 addresses, but a few IPv4 addresses. Applications using getaddrinfo() with hints.ai_flags = AI_ADDRCONFIG set will properly omit IPv6 addresses, HOWEVER they will return duplicate IPv4 addresses. Demonstration code attached. Without IPv6 addresses: # show setup $ grep -w localhost /etc/hosts 127.0.0.1 localhost ::1 localhost ipv6-localhost ipv6-loopback $ ip a d fe80::260:XXXX:XXXX:XXXX/64 dev eth0 # fill in your HWADDR $ ip a s | grep inet inet 127.0.0.1/8 brd 127.255.255.255 scope host lo inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo inet6 ::1/128 scope host inet 192.168.0.1/24 brd 192.168.0.255 scope global eth0 # compile test case $ gcc -Wall -Wextra -pedantic -O -o libcbug-demo libcbug-demo.c # run test case $ ./libcbug-demo localhost echo Address 1: 127.0.0.1 Address 2: 127.0.0.1 (127.0.0.1 should be listed only once, Solaris 10 for instance achieves that) Now configure a fake IPv6 address (don't do this on hosts with real IPv6 connectivity, it suffices to use your real IPv6 address) and re-run the application: $ ip a a 2001::2001 dev eth0 # set up IPv6 $ ./libcbug-demo localhost echo Address 1: ::1 Address 2: 127.0.0.1 $ ip a d 2001::2001 dev eth0 # deconfigure bogus address (This is fine) Practical consequence: excessive connection retries by applications that possibly take a long time. This also affects Ubuntu 10.04 LTS on amd64, please consider forwarding upstream. Reproducible: Always Steps to Reproduce: see details Actual Results: Duplicate 127.0.0.1 address. Expected Results: 127.0.0.1 address listed once. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.