Fix regression from PR #680

Hi @ollyg! Unfortunately I have found some issues with the code we
finally released in #680:

* get_port_macs expects an array ref but values() returns array,
  so the code was never called due to the return unless... check
* When fw_mac_list had exactly two entries, only the second value
  was bound as a scalar to the parameter. This is probably due
  to the shorthand bind formats described in
  https://metacpan.org/pod/DBIx::Class::ResultSet#DBIC-BIND-VALUES,
  but I'm not a 100% on this.
* return unless now checks for an entry in the list, with the old
  check the statement was also executed for empty lists

In cases where only the device(_port)?.mac lookup worked for uplink
detection, users of 02.044005 - 010 might get a lot of uplinks not
labeled as such.
This commit is contained in:
Christian Ramseyer
2020-01-26 22:08:49 +01:00
parent ae0f711682
commit f2f5d908bb
2 changed files with 7 additions and 4 deletions

View File

@@ -278,7 +278,8 @@ sub walk_fwtable {
? {} : $snmp->qb_fw_vlan;
my $bp_index = $snmp->bp_index || {};
my $port_macs = get_port_macs( values %$fw_mac );
my @fw_mac_list = values %$fw_mac;
my $port_macs = get_port_macs(\@fw_mac_list);
# to map forwarding table port to device port we have
# fw_port -> bp_index -> interfaces