bugzilla-daemon at bugzilla.mindrot.org
2009-Oct-26 11:07 UTC
[Bug 1665] New: prefix_pton is inefficient
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.
Reasonably Related Threads
- [PATCH] Patches to rsync-2.5.5 for Stratus VOS (update)
- [PATCH] Patches to rsync-2.5.5 for Stratus VOS
- [PATCH] Patches to rsync-2.5.5 for Stratus VOS (resend)
- Patch for 2.5.1 on Tru64 UNIX 5.x
- [PATCH 04/10] Use AC_CONFIG_LIBOBJ_DIR and AC_REPLACE_FUNCS to adhere to autoconf standards