Don't overwrite real port ids with zeros in the FDB (#11041)

Avoid writing "0" as port id when the data came back incomplete from the snmp poll, and when the existing data in the DB already contains a port. Keep the existing port id instead.
This commit is contained in:
cjwbath
2020-01-19 21:30:13 +00:00
committed by PipoCanaja
parent cd85976ed8
commit 0c16f21a2e

View File

@@ -41,7 +41,9 @@ if (!empty($insert)) {
$new_port = $entry['port_id'];
$port_fdb_id = $existing_fdbs[$vlan_id][$mac_address_entry]['ports_fdb_id'];
if ($existing_fdbs[$vlan_id][$mac_address_entry]['port_id'] != $new_port) {
// Sometimes new_port ends up as 0 if we didn't get a complete dot1dBasePort
// dictionary from BRIDGE-MIB - don't write a 0 over a previously known port
if ($existing_fdbs[$vlan_id][$mac_address_entry]['port_id'] != $new_port && $new_port != 0) {
DB::table('ports_fdb')
->where('ports_fdb_id', $port_fdb_id)
->update([