This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug network/14307] getaddrinfo() sends superfluous DNS requests in x86_64 programs for certain hostnames
- From: "siddhesh at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Mon, 02 Jul 2012 02:21:46 +0000
- Subject: [Bug network/14307] getaddrinfo() sends superfluous DNS requests in x86_64 programs for certain hostnames
- Auto-submitted: auto-generated
- References: <bug-14307-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=14307
--- Comment #7 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2012-07-02 02:21:46 UTC ---
Here's a review of the patch. Please post the patch with modifications to the
libc-alpha mailing list for further review and approval and use the following
wiki link as a guideline for the submission:
http://sourceware.org/glibc/wiki/Contribution%20checklist
- size_t tmpbuflen = 512;
+ // MAX_NR_ALIASES=48 in resolv/nss_dns/dns-host.c
+ size_t host_data_size = 48 * sizeof(char*) + 16;
Put MAX_NR_ALIASES one of the headers and use it here.
+ size_t tmpbuflen = 512;
assert (tmpbuf == NULL);
- tmpbuf = alloca_account (tmpbuflen, alloca_used);
+ tmpbuf = alloca_account (tmpbuflen+host_data_size, alloca_used);
Adjust the tmpbuflen size instead of adding it separately here.
int rc;
struct hostent th;
struct hostent *h;
@@ -579,19 +581,19 @@ gaih_inet (const char *name, const struct gaih_service
*service,
while (1)
{
rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf,
- tmpbuflen, &h, &herrno);
+ tmpbuflen+host_data_size, &h, &herrno);
Likewise.
if (rc != ERANGE || herrno != NETDB_INTERNAL)
break;
if (!malloc_tmpbuf
- && __libc_use_alloca (alloca_used + 2 * tmpbuflen))
+ && __libc_use_alloca (alloca_used + 2 * tmpbuflen +
host_data_size))
Here too.
tmpbuf = extend_alloca_account (tmpbuf, tmpbuflen,
- 2 * tmpbuflen,
+ 2 * tmpbuflen+host_data_size,
And here.
alloca_used);
else
{
char *newp = realloc (malloc_tmpbuf ? tmpbuf : NULL,
- 2 * tmpbuflen);
+ 2 * tmpbuflen+host_data_size);
Here as well.
if (newp == NULL)
{
result = -EAI_MEMORY;
> 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?
The current implementation is broken for it, since it will keep blowing the
buffer up exponentially till it can fit the entire jumbogram into the buffer
and hope that the underlying memory supports it. This needs to be fixed in
future.
--
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.