[uClibc-cvs] svn commit: trunk/uClibc/libc/inet

andersen at uclibc.org andersen at uclibc.org
Tue May 10 08:22:56 UTC 2005


Author: andersen
Date: 2005-05-10 02:22:56 -0600 (Tue, 10 May 2005)
New Revision: 10283

Log:
The default static buffer sizes are too small to handle the 8 entries returned
by 'nslookup www.yahoo.com' and 'nslookup mail.hotmail.com', and thus we
currently return ERANGE when trying to lookup some of the most popular hosts on
the planet.  Whether these sites deserve to be popular is a question I'll leave
for someone else to worry about.

This change makes certain we have enough static buffer space to handle about 21
IPv4 IP address replies per DNS query.  Far more than enough to handle common
cases such as www.yahoo.com and mail.hotmail.com.


Modified:
   trunk/uClibc/libc/inet/resolv.c


Changeset:
Modified: trunk/uClibc/libc/inet/resolv.c
===================================================================
--- trunk/uClibc/libc/inet/resolv.c	2005-05-10 03:02:11 UTC (rev 10282)
+++ trunk/uClibc/libc/inet/resolv.c	2005-05-10 08:22:56 UTC (rev 10283)
@@ -1064,7 +1064,7 @@
 	static struct hostent h;
 	static char buf[sizeof(struct in_addr) +
 			sizeof(struct in_addr *)*2 +
-			sizeof(char *)*(ALIAS_DIM) + 256/*namebuffer*/ + 32/* margin */];
+			sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */];
 	struct hostent *hp;
 
 	gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno);
@@ -1083,7 +1083,7 @@
 	static struct hostent h;
 	static char buf[sizeof(struct in6_addr) +
 			sizeof(struct in6_addr *)*2 +
-			sizeof(char *)*(ALIAS_DIM) + 256/*namebuffer*/ + 32/* margin */];
+			sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */];
 	struct hostent *hp;
 
 	gethostbyname2_r(name, family, &h, buf, sizeof(buf), &hp, &h_errno);
@@ -1404,7 +1404,7 @@
 #else
 		sizeof(struct in6_addr) + sizeof(struct in6_addr *)*2 +
 #endif /* __UCLIBC_HAS_IPV6__ */
-		sizeof(char *)*(ALIAS_DIM) + 256/*namebuffer*/ + 32/* margin */];
+		sizeof(char *)*(ALIAS_DIM) + 384/*namebuffer*/ + 32/* margin */];
 	struct hostent *hp;
 
 	gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno);
@@ -1711,7 +1711,7 @@
 	int serrno = errno;
 	int ok = 0;
 	struct hostent *h = NULL;
-    char domain[256];
+	char domain[256];
 
 	if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM))
 		return EAI_BADFLAGS;
@@ -2003,7 +2003,7 @@
 		free(a.dotted);
 		free(packet);
 		*h_errnop = NETDB_INTERNAL;
-		DPRINTF("buffer to small(multiple addresses)\n");
+		DPRINTF("buffer too small for all addresses\n");
 		return ERANGE;
 	    }
 	    else if(a.add_count > 0)




More information about the uClibc-cvs mailing list