Workaround for IPv6 neighbor cache on Cisco Nexus, check data before returning. Also minor PoD fix in CiscoConfig.pm.

This commit is contained in:
Jeroen van Ingen
2012-10-29 13:34:47 +01:00
parent 1e37bfa8ce
commit 6cfce1916d
3 changed files with 14 additions and 4 deletions

View File

@@ -22,7 +22,8 @@ version 2.09
* Fixed logic to return cached data for table methods when available and
not a partial fetch
* Fix typo in PoD for Bridge.pm (William Bulley)
* Fix typo in PoD for Bridge.pm and CiscoConfig.pm (William Bulley)
* Fix/improve IPv6 neighbor cache handling, especially for Cisco Nexus
version 2.08 (2012-07-15)

View File

@@ -449,7 +449,7 @@ devices running older code revisions.
Example:
$ciscoconfig->copy_run_tftp('1.2.3.4', 'myconfig')
or die Couldn't save config. ",$ciscoconfig->error(1);
or die "Couldn't save config. ",$ciscoconfig->error(1);
=item $ciscoconfig->copy_run_start()

View File

@@ -137,8 +137,17 @@ sub ipv6_n2p_addr {
}
if ($addrtype == 2) { # IPv6
my $v6_packed = pack("C*", split(/\./, $v6addr));
$v6addr = join(':', map { sprintf("%04x", $_) } unpack("n*", $v6_packed) );
$return->{$row} = $v6addr;
if (length($v6_packed) == 15) {
# Workaround for some some IP-MIB implementations, eg on Cisco Nexus: no explicit addrsize,
# so what we've collected in that variable is actually the first byte of the address.
$v6_packed = pack('C', $addrsize) . $v6_packed;
}
if (length($v6_packed) == 16) {
$v6addr = join(':', map { sprintf("%04x", $_) } unpack("n*", $v6_packed) );
$return->{$row} = $v6addr;
} else {
printf("Invalid size for IPv6 address: expected 16 bytes, got %d (%s = %s)\n", length($v6_packed), $row, $net_addr->{$row});
}
}
}
}