[Bug 1665] New: prefix_pton is inefficient

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Mon Oct 26 22:07:30 EST 2009


https://bugzilla.mindrot.org/show_bug.cgi?id=1665

           Summary: prefix_pton is inefficient
           Product: py-radix
           Version: -current
          Platform: ix86
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Default
        AssignedTo: unassigned-bugs at mindrot.org
        ReportedBy: weinholt at csbnet.se


Created an attachment (id=1710)
 --> (https://bugzilla.mindrot.org/attachment.cgi?id=1710)
change prefix_pton to use inet_pton()

py-radix 0.5 uses getaddrinfo() to parse IPv4/IPv6 addresses. On
GNU/Linux this procedure creates a socket and performs a few syscalls
on it. It would be better to parse addresses without performing
syscalls.

I noticed this when writing a program that generates DHCP configuration
for ~15k hosts. When running the program on the server running the DHCP
daemon it ran out of some sort of kernel memory (NFS stopped working,
neighbor table filled, new TCP connections failed). For some reason the
development machine didn't have the same problem. I traced it down to
the getaddrinfo() call.

To solve this problem I patched py-radix to use inet_pton instead.
Please review the attached patch. Also, the testbed runs in 3.1 seconds
when it previously took 4.3s.

The patch also fixes the error messages. Previously invalid prefix
lengths would result in a garbage error message, and a failed call to
getaddrinfo() would return a pointer to inside the function's stack.

-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list