<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Not speaking for anyone but myself.<br>
<br>
FWIW, this is code from spamassassin:<br>
<br>
my $ip6 = eval {<br>
require Socket;<br>
Socket->VERSION(1.95);<br>
Socket->import( 'inet_pton' );<br>
1;<br>
} || eval {<br>
require Socket6;<br>
Socket6->import( 'inet_pton' );<br>
1;<br>
};<br>
<br>
Normally I would say use NetAddr::IP or another library to avoid the
inet_pton call, but I found this note:<br>
<br>
# ipaddrval(IPaddr) converts and IPv4/v6 address to a string for
comparison.<br>
# Some may ask why not use Net::IP; performance. We tried and it
was horribly<br>
# slow.<br>
<br>
If performance is a major concern I would make minor changes to the
existing code (sorry for the formatting):<br>
<br>
if ($a =~ /:/) {<br>
my($l);<br>
($a, $l) = split(/\//, $a); # this split works even if the
slash isn't there<br>
$l ||= 128; # if !defined is faster than if (/\//)<br>
<br>
$norder = inet_pton(AF_INET6, $a);<br>
return unpack('H128', $norder) . unpack('H', pack('C', $l));<br>
}<br>
<br>
I don't think this sacrifices readability but it improves the
performance (by about 30-40k calls/s). The regex and split string
operations are almost always the most expensive aspect and if there
were ways to get rid of them then the speed would go way up.
Honestly inet_pton is low level but it's the best way to get speed
out of IP operations (because it's just wrapping a C function).<br>
<br>
Drawbacks: RHEL6 (or anything older than 2009 running perl5.10.x)
don't have inet_pton. Socket.pm also doesn't support MSWin32 until
2.019, which hasn't been shipped yet with any version of perl (so
inet_pton isn't available on any windows systems without
workarounds. I have no idea if anyone runs rancid on windows
though, or if that would be possible)<br>
<br>
Suggested workarounds: It's a minor change. I'm not sure if Redhat
uses a system like Debian's quilt for maintaining downstream
patches, but I would just put together a changeset for the 3 lines
and repackage it rather than forcing the change upstream. The
reason being that although this is minor, changing it causes
documentation headaches (well.. a comment saying why it is the way
it is) and doesn't give a sunset clause to it. If it's maintained
in downstream then as soon as RHEL6 support is dropped the packages
stop being produced and that is the sunset of the changes.<br>
<br>
Yeah, I've probably spent more time whining in this email than it
would take for whoever to fix it, but what if there are other 5.12
features they turn on later and then need to turn off because
someone still runs 5.10?<br>
<br>
Robert<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 6/1/2015 4:50 PM, Brown, David M JR
wrote:<br>
</div>
<blockquote cite="mid:D19213A5.4AC96%25david.brown@pnnl.gov"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div>We’ve had several requests to get the updated version of
rancid on RHEL 6. However, there seems to be some issues getting
that to work with the older version of the Socket module.</div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="https://bugzilla.redhat.com/show_bug.cgi?id=1224143">https://bugzilla.redhat.com/show_bug.cgi?id=1224143</a></div>
<div><br>
</div>
<div>The patch <a moz-do-not-send="true"
href="ftp://ftp.shrubbery.net/pub/rancid/rancid-3.2.p3.gz">ftp://ftp.shrubbery.net/pub/rancid/rancid-3.2.p3.gz</a> seems
to be the supported resolution though it does prevent rancid 3.2
from running on RHEL 6, out of the box.</div>
<div><br>
</div>
<div>The patch in the bug suggests using the Socket6 module and
pulling the relevant names which seems to have a working
version. Would it be possible to use Socket6 instead of Socket
for inet_pton()?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>- David Brown</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Rancid-discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rancid-discuss@shrubbery.net">Rancid-discuss@shrubbery.net</a>
<a class="moz-txt-link-freetext" href="http://www.shrubbery.net/mailman/listinfo/rancid-discuss">http://www.shrubbery.net/mailman/listinfo/rancid-discuss</a></pre>
</blockquote>
<br>
</body>
</html>