Correct macsuck for Q-BRIDGE-MIB based devices
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
* Correct is_discoverable check in Undiscovered Neighbors report
|
* Correct is_discoverable check in Undiscovered Neighbors report
|
||||||
|
* Correct macsuck for Q-BRIDGE-MIB based devices
|
||||||
|
|
||||||
2.021000 - 2014-01-08
|
2.021000 - 2014-01-08
|
||||||
|
|
||||||
|
|||||||
@@ -72,13 +72,14 @@ sub do_macsuck {
|
|||||||
my $interfaces = $snmp->interfaces;
|
my $interfaces = $snmp->interfaces;
|
||||||
|
|
||||||
# get forwarding table data via basic snmp connection
|
# get forwarding table data via basic snmp connection
|
||||||
my $fwtable = { 0 => _walk_fwtable($device, $snmp, $interfaces, $port_macs, $device_ports) };
|
my $fwtable = _walk_fwtable($device, $snmp, $interfaces, $port_macs, $device_ports);
|
||||||
|
|
||||||
# ...then per-vlan if supported
|
# ...then per-vlan if supported
|
||||||
my @vlan_list = _get_vlan_list($device, $snmp);
|
my @vlan_list = _get_vlan_list($device, $snmp);
|
||||||
foreach my $vlan (@vlan_list) {
|
foreach my $vlan (@vlan_list) {
|
||||||
snmp_comm_reindex($snmp, $device, $vlan);
|
snmp_comm_reindex($snmp, $device, $vlan);
|
||||||
$fwtable->{$vlan} = _walk_fwtable($device, $snmp, $interfaces, $port_macs, $device_ports);
|
my $pv_fwtable = _walk_fwtable($device, $snmp, $interfaces, $port_macs, $device_ports, $vlan);
|
||||||
|
$fwtable = {%$fwtable, %$pv_fwtable};
|
||||||
}
|
}
|
||||||
|
|
||||||
# now it's time to call store_node for every node discovered
|
# now it's time to call store_node for every node discovered
|
||||||
@@ -102,10 +103,6 @@ sub do_macsuck {
|
|||||||
|
|
||||||
foreach my $mac (keys %{ $fwtable->{$vlan}->{$port} }) {
|
foreach my $mac (keys %{ $fwtable->{$vlan}->{$port} }) {
|
||||||
|
|
||||||
# get VLAN from Q-BRIDGE if available
|
|
||||||
$vlan = $fwtable->{$vlan}->{$port}->{$mac}
|
|
||||||
if $vlan == 0;
|
|
||||||
|
|
||||||
# remove vlan 0 entry for this MAC addr
|
# remove vlan 0 entry for this MAC addr
|
||||||
delete $fwtable->{0}->{$_}->{$mac}
|
delete $fwtable->{0}->{$_}->{$mac}
|
||||||
for keys %{ $fwtable->{0} };
|
for keys %{ $fwtable->{0} };
|
||||||
@@ -287,7 +284,7 @@ sub _get_vlan_list {
|
|||||||
# walks the forwarding table (BRIDGE-MIB) for the device and returns a
|
# walks the forwarding table (BRIDGE-MIB) for the device and returns a
|
||||||
# table of node entries.
|
# table of node entries.
|
||||||
sub _walk_fwtable {
|
sub _walk_fwtable {
|
||||||
my ($device, $snmp, $interfaces, $port_macs, $device_ports) = @_;
|
my ($device, $snmp, $interfaces, $port_macs, $device_ports, $comm_vlan) = @_;
|
||||||
my $cache = {};
|
my $cache = {};
|
||||||
|
|
||||||
my $fw_mac = $snmp->fw_mac;
|
my $fw_mac = $snmp->fw_mac;
|
||||||
@@ -392,7 +389,9 @@ sub _walk_fwtable {
|
|||||||
next unless setting('macsuck_bleed');
|
next unless setting('macsuck_bleed');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->{$port}->{$mac} = ($fw_vlan->{$idx} || '0');
|
my $vlan = $fw_vlan->{$idx} || $comm_vlan || '0';
|
||||||
|
|
||||||
|
++$cache->{$vlan}->{$port}->{$mac};
|
||||||
}
|
}
|
||||||
|
|
||||||
return $cache;
|
return $cache;
|
||||||
|
|||||||
Reference in New Issue
Block a user