public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvb127 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug network/14307] getaddrinfo() sends superfluous DNS requests in x86_64 programs for certain hostnames
Date: Sat, 30 Jun 2012 05:35:00 -0000	[thread overview]
Message-ID: <bug-14307-131-mwWG03se3V@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14307-131@http.sourceware.org/bugzilla/>

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.


  parent reply	other threads:[~2012-06-30  5:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29  0:04 [Bug network/14307] New: getaddrinfo() triggers duplicate DNS requests when answer contains CNAME jvb127 at gmail dot com
2012-06-29  6:05 ` [Bug network/14307] " jvb127 at gmail dot com
2012-06-29  6:10 ` [Bug network/14307] getaddrinfo() sends superfluous DNS requests in x86_64 programs " jvb127 at gmail dot com
2012-06-29 11:10 ` siddhesh at redhat dot com
2012-06-29 12:30 ` siddhesh at redhat dot com
2012-06-29 16:06 ` [Bug network/14307] getaddrinfo() sends superfluous DNS requests in x86_64 programs for certain hostnames jvb127 at gmail dot com
2012-06-30  2:23 ` jvb127 at gmail dot com
2012-06-30  3:16 ` jvb127 at gmail dot com
2012-06-30  5:35 ` jvb127 at gmail dot com [this message]
2012-06-30 15:09 ` jvb127 at gmail dot com
2012-07-02  2:22 ` siddhesh at redhat dot com
2012-07-12  6:05 ` siddhesh at redhat dot com
2014-02-16 19:32 ` jackie.rosen at hushmail dot com
2014-05-28 19:42 ` schwab at sourceware dot org
2014-06-18  4:31 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14307-131-mwWG03se3V@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).