This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12907] New: getaddrinfo() takes long time when lots of IP addresses are configured
- From: "david.hanisch at nsn dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Fri, 17 Jun 2011 12:52:28 +0000
- Subject: [Bug libc/12907] New: getaddrinfo() takes long time when lots of IP addresses are configured
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=12907
Summary: getaddrinfo() takes long time when lots of IP
addresses are configured
Product: glibc
Version: unspecified
Status: NEW
Severity: enhancement
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: david.hanisch@nsn.com
Created attachment 5800
--> http://sourceware.org/bugzilla/attachment.cgi?id=5800
Suggested patch
function getaddrinfo() retrieves all configured IP addresses using function
__check_pf() what takes ages when lots of addresses are configured (60000).
This is done even if not needed, e.g. when the address is given as literal
"1.2.3.4".
How to reproduce:
- configure lots of addresses
#!/usr/bin/perl
my $addrCount = 64000;
for (my $i=1; $i < $addrCount; $i++) {
my $w1 = ($i % 254) + 1;
my $w2 = ($i / 254) + 1;
my $s = sprintf("ip addr add 10.5.%d.%d dev eth0", $w2, $w1);
print "$s\n";
system ($s)
}
- resolve a literal address
struct addrinfo ai;
struct addrinfo *ailist = NULL;
memset(&ai, 0, sizeof(ai));
ai.ai_family = af;
ai.ai_flags = AI_PASSIVE;
getaddrinfo("10.5.1.1", "0", &ai, &ailist);
freeaddrinfo(ailist);
Suggested solution:
call __check_pf() only if needed, a patch for glibc 2.11.2 is attached.
--
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.