[rancid] ipv6 compatible ip address sort

Nick Hilliard nick at foobar.org
Sun Feb 1 18:14:25 UTC 2015


This patch fixes the ipv6 prefix-list sorting problems which affect perl
5.18 and later.

The sorting problems happen because ipaddrval() returns undef, so the sort
function attempts to sort on the same index key.  Before perl5.18, the
default behaviour was to return hash keys in a consistent order.  On 5.18+,
this order is deliberately randomised.

The patch changes sortbyipaddr to use a lexical sort on the hex value of
the key because numerical sort breaks for 128 bit keys.  It should be
plug-in compatible with all the locally defined ipaddrval()/sortbyipaddr()
implementations in each function.

Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipaddrval.pl
Type: text/x-perl-script
Size: 568 bytes
Desc: not available
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20150201/fbfcb97b/attachment.bin>


More information about the Rancid-discuss mailing list