Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 53861 - getaddrinfo returns three duplicate records per actual record
Summary: getaddrinfo returns three duplicate records per actual record
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-13 23:26 UTC by Paul Forgey
Modified: 2004-12-24 20:10 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Forgey 2004-06-13 23:26:43 UTC
when resolving dns records which have multiple values, three duplicate records are returned per actual value.  That is:

host.example.com IN A 1.2.3.4
host.example.com IN A 1.2.3.5

returns 1.2.3.4, 1.2.3.4, 1.2.3.4, 1.2.3.5, 1.2.3.5, 1.2.3.5


Reproducible: Always
Steps to Reproduce:
        r = getaddrinfo ("www.yahoo.com", NULL, NULL, &res);

        for (rptr = res; rptr; rptr = rptr->ai_next)
            printf ("%s\n", inet_ntoa (
                        ((struct sockaddr_in *)rptr->ai_addr)->sin_addr));

        freeaddrinfo (res);


Actual Results:  
146.186.218.253
146.186.218.253
146.186.218.253
66.92.68.246
66.92.68.246
66.92.68.246
66.115.130.4
66.115.130.4
66.115.130.4
66.187.233.4
66.187.233.4
66.187.233.4
128.95.231.7
128.95.231.7
128.95.231.7
204.17.42.202
204.17.42.202
204.17.42.202
216.165.129.244
216.165.129.244
216.165.129.244
64.115.129.106
64.115.129.106
64.115.129.106
205.142.198.4
205.142.198.4
205.142.198.4
209.126.142.251
209.126.142.251
209.126.142.251
209.132.176.4
209.132.176.4
209.132.176.4
63.73.218.130
63.73.218.130
63.73.218.130
65.75.183.220
65.75.183.220
65.75.183.220
65.125.233.206
65.125.233.206
65.125.233.206
67.129.68.9
67.129.68.9
67.129.68.9


Expected Results:  
66.94.230.36
66.94.230.37
66.94.230.38
66.94.230.39
66.94.230.41
66.94.230.42
66.94.230.44
66.94.230.32


Portage 2.0.50-r8 (default-x86-1.4, gcc-3.3.3, glibc-2.3.3.20040420-r0, 2.4.25_pre7-gss-r5)
===============================================================
==
System uname: 2.4.25_pre7-gss-r5 i686 Intel(R) Xeon(TM) CPU 2.40GHz
Gentoo Base System version 1.4.16
distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium3 -O3 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /
usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium3 -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/
gentoo"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X acpi apm arts avi berkdb crypt cups curl encode esd foomaticdb gdbm gif gnome gpm gtk gtk2 
imlib innodb ipv6 jpeg kde ldap libg++ libwww mad mikmod mmx motif mpeg mysql ncurses nls 
oggvorbis opengl oss pam pdflib perl png python qt quicktime readline samba sdl slang spell ssl svga 
tcpd truetype x86 xml2 xmms xv zlib"
Comment 1 Paul Forgey 2004-06-13 23:31:21 UTC
Resolution from another hostname with multiple values was shown in the erroneous output.  The expected output has the proper addresses for the hostname quoted in the sample code.

However, the expected wrong results do indeed occur (66.94.230.36 66.94.230.36 66.94.230.36..)

Sorry for any confusion.
Comment 2 Paul Forgey 2004-10-11 14:22:23 UTC
I can reproduce this bug on newer Debian machines now, indicating this is probably not a Gentoo specific bug.  This bug should probably be forwarded to the glibc project.
Comment 3 SpanKY gentoo-dev 2004-11-23 22:03:36 UTC
seems to happen in an uclibc environment also ...
Comment 4 rob holland (RETIRED) gentoo-dev 2004-12-23 07:31:58 UTC
I don't think this is a bug at all. If you read the man page for getaddrinfo it says it will return one entry per host per protocol that can reach it.

Try printing the socktype and protocol fields of the structs as well.
Comment 5 Paul Forgey 2004-12-23 13:38:43 UTC
Agreed.  Furthermore, passing AF_INET/SOCK_STREAM (or SOCK_DGRAM) to the hints field properly filters it.
Comment 6 SpanKY gentoo-dev 2004-12-24 20:10:08 UTC
ah, thanks guys for the feedback