xDP - ifAlias should be last checked in function find_port_id (#12904)

ifAlias should be last
This commit is contained in:
PipoCanaja
2021-05-26 00:17:48 +02:00
committed by GitHub
parent 52f78b9ef7
commit b55e44a2b4

View File

@@ -1352,11 +1352,6 @@ function find_port_id($description, $identifier = '', $device_id = 0, $mac_addre
$params[] = $device_id;
$params[] = $description;
$params[] = $description;
// we check ifAlias last because this is a user editable field, but some bad LLDP implementations use it
$statements[] = 'SELECT `port_id` FROM `ports` WHERE `device_id`=? AND `ifAlias`=?';
$params[] = $device_id;
$params[] = $description;
}
if ($identifier) {
@@ -1369,6 +1364,13 @@ function find_port_id($description, $identifier = '', $device_id = 0, $mac_addre
$params[] = $identifier;
$params[] = $identifier;
}
if ($description) {
// we check ifAlias last because this is a user editable field, but some bad LLDP implementations use it
$statements[] = 'SELECT `port_id` FROM `ports` WHERE `device_id`=? AND `ifAlias`=?';
$params[] = $device_id;
$params[] = $description;
}
}
if ($mac_address) {