Discussion:
[rancid] ipv6 compatible ip address sort
Nick Hilliard
2015-02-01 18:14:25 UTC
Permalink
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

Loading...