Merge remote-tracking branch 'origin/ipv6-prefixlen'

This commit is contained in:
Oliver Gorwits
2018-02-12 19:27:59 +00:00

View File

@@ -335,30 +335,25 @@ sub ipv6_addr_prefix {
sub ipv6_addr_prefixlength { sub ipv6_addr_prefixlength {
my $info = shift; my $info = shift;
my $return; my $return;
my $index = $info->ipv6_index or return; my $ipv6_addr_prefix = &_test_methods( $info, {
my $ipv6_addr_prefixlength = &_test_methods( $info, { ip_addr6_pfx => IPMIB,
ip_addr6_pfxlen => IPMIB, c_addr6_pfx => CISCO,
c_addr6_pfxlen => CISCO,
i6_addr_pfxlen => IPV6MIB,
}); });
return unless defined $ipv6_addr_prefixlength; return unless defined $ipv6_addr_prefix;
# might be returned with ipv6_index value at the start instead foreach my $row (keys %$ipv6_addr_prefix) {
# of type+bits, so we need to map via ipv6_index if ($row =~ /^(\d+)\.[\d\.]+$/) {
foreach my $row (keys %$ipv6_addr_prefixlength){ my $type = $1;
my $new_row = undef; if (($type == 2) or ($type == 4)) { # IPv6
# only if ipv6_index value at the start # Remove interface specific part from vrf interfaces
if ($row =~ m/^(\d+)\.((?:\d+\.){15}\d+)/) { if ($row =~ /^((\d+\.){17}\d+)/) { $row = $1 }
my ($iid, $addr) = ($1, $2); # Remove the OID part from the value
foreach my $i (keys %$index) { my $val = $ipv6_addr_prefix->{$row};
if ($index->{$i} eq $iid and $i =~ m/\.${addr}$/) { if ( $val =~ /^.+?((?:\d+\.){19}(\d+))$/ ) {
$new_row = $i; $val = $2;
last; $return->{$row} = $val;
} }
} }
next unless $new_row;
} }
# this should alow IPMIB and CISCO to pass through unmunged
$return->{$new_row || $row} = $ipv6_addr_prefixlength->{$row};
} }
printf("%s: data comes from %s.\n", &_my_sub_name, $info->_method_used() ) if $info->debug(); printf("%s: data comes from %s.\n", &_my_sub_name, $info->_method_used() ) if $info->debug();
return $return; return $return;