mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Populate ipv6_network_id in ipv6_addresses where empty (#10548)
* Populate ipv6_network_id in ipv6_addresses where empty * Update functions.inc.php
This commit is contained in:
committed by
Neil Lathwood
parent
e0a33021da
commit
c089f3bae4
@@ -838,6 +838,15 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen
|
||||
'context_name' => $context_name
|
||||
), 'ipv6_addresses');
|
||||
echo '+';
|
||||
} else if (dbFetchCell('SELECT COUNT(*) FROM `ipv6_addresses` WHERE `ipv6_address` = ? AND `ipv6_prefixlen` = ? AND `port_id` = ? AND `ipv6_network_id` = ""', [$ipv6_address, $ipv6_prefixlen, $port_id]) == '1') {
|
||||
// Update IPv6 network ID if not set
|
||||
if ($context_name == null) {
|
||||
$ipv6_network_id = dbFetchCell('SELECT `ipv6_network_id` FROM `ipv6_networks` WHERE `ipv6_network` = ? AND `context_name` IS NULL', [$ipv6_network]);
|
||||
} else {
|
||||
$ipv6_network_id = dbFetchCell('SELECT `ipv6_network_id` FROM `ipv6_networks` WHERE `ipv6_network` = ? AND `context_name` = ?', [$ipv6_network, $context_name]);
|
||||
}
|
||||
dbUpdate(['ipv6_network_id' => $ipv6_network_id], 'ipv6_addresses', '`ipv6_address` = ? AND `ipv6_prefixlen` = ? AND `port_id` = ?', [$ipv6_address, $ipv6_prefixlen, $port_id]);
|
||||
echo 'u';
|
||||
} else {
|
||||
//Update Context
|
||||
dbUpdate(array('context_name' => $device['context_name']), 'ipv6_addresses', '`ipv6_address` = ? AND `ipv6_prefixlen` = ? AND `port_id` = ?', array($ipv6_address, $ipv6_prefixlen, $port_id));
|
||||
|
Reference in New Issue
Block a user