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 #5 from Jeroen van Bemmel <jvb127 at gmail dot com> 2012-06-30 05:35:43 UTC ---
Created attachment 6498
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6498
Proposed patch for /sysdeps/posix/getaddrinfo.c

The current code initially allocates a buffer of 512 bytes for the query
response, and repeatedly increases the buffer size (*2) until the call
succeeds.

Out of this 512 bytes, sizeof(host_name_struct) is used for alias pointers. The
size of this struct is 208 bytes on x86 and 400 bytes on x86_64, creating a
difference in network behaviour for these targets. Furthermore, 512-400 leaves
only 112 bytes for the answer, which is too small for common DNS lookups such
as "www.google.com"

The 512 value was probably based on the maximum response size limit imposed by
DNS. This patch adds the size of the host_name_struct, such that 512 bytes
remain for the DNS response, for both the x86 and x86_64 platforms.

Note that there should be a cleaner way for linking the size of the struct to
the code in resolv/nss_dns/dns-host.c; the constant of 48 for MAX_NR_ALIASES
might be changed in the future.

Also, I noticed that there is no limit imposed on the size of the temp buffer.
Not sure what the effect would be of receiving a UDP jumbogram over IPv6 in
response to a DNS query?

-- 
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]