This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/14307] getaddrinfo() sends superfluous DNS requests in x86_64 programs for certain hostnames


http://sourceware.org/bugzilla/show_bug.cgi?id=14307

--- Comment #4 from Jeroen van Bemmel <jvb127 at gmail dot com> 2012-06-30 03:16:07 UTC ---
in function getanswer_r (resolv/nss_dns/dns-host.c) the temporary buffer is
used for the following struct:

struct host_data
  {
    char *aliases[MAX_NR_ALIASES];
    unsigned char host_addr[16];        /* IPv4 or IPv6 */
    char *h_addr_ptrs[0];
  } *host_data

sizeof( struct host_data ) == 400 for x86_64, and 208 for x86 32-bit.

One could argue that the code works as designed, but I believe it is desirable
if glibc exhibits the same externally observable behaviour for both x86 and
x86_64 versions.

512 - 400 leaves little room for common DNS query responses like
"www.google.com".

One could simply allocate a larger temporary buffer for x86_64 ( e.g. 512 *
sizeof(void*) / 4 ), but perhaps a better fix is to not use the temporary
buffer for the host_data struct at all (and e.g. use alloca instead, or simply
place it on the stack - although the code does explicitly align it in case the
buffer is unaligned, which it isn't btw)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]