Merge branch 'ent-9282-13952-bug-en-filtrado-ipam' into 'develop'

fix errors ipam pandora_enterprise#9282

See merge request artica/pandorafms!5040
This commit is contained in:
Daniel Rodriguez 2022-08-09 11:40:59 +00:00
commit 994bc71f45
3 changed files with 26 additions and 2 deletions

View File

@ -38,6 +38,10 @@ ALTER TABLE `tautoconfig` ADD COLUMN `executed` TINYINT UNSIGNED NOT NULL DEFAUL
ALTER TABLE `tusuario` DROP COLUMN `metaconsole_assigned_server`;
ALTER TABLE `tipam_network` DROP FOREIGN KEY `tipam_network_ibfk_1`;
ALTER TABLE `tipam_network` MODIFY COLUMN `id_recon_task` INT UNSIGNED DEFAULT 0;
ALTER TABLE `tipam_network` ADD CONSTRAINT `tipam_network_ibfk_1` FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE `tevent_filter` ADD COLUMN `search_secondary_groups` INT NOT NULL DEFAULT 0;
COMMIT;

View File

@ -5996,6 +5996,26 @@ function send_test_email(
}
/**
* Check ip is valid into network
*
* @param string $ip Ip XXX.XXX.XXX.XXX.
* @param string $cidr Network XXX.XXX.XXX.XXX/XX.
*
* @return boolean
*/
function cidr_match($ip, $cidr)
{
list($subnet, $mask) = explode('/', $cidr);
if ((ip2long($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long($subnet)) {
return true;
}
return false;
}
/**
* Microtime float number.
*

View File

@ -3889,7 +3889,7 @@ CREATE TABLE IF NOT EXISTS `tipam_network` (
`name_network` VARCHAR(255) DEFAULT '',
`description` TEXT,
`location` INT UNSIGNED NULL,
`id_recon_task` INT UNSIGNED NOT NULL,
`id_recon_task` INT UNSIGNED DEFAULT 0,
`scan_interval` TINYINT DEFAULT 1,
`monitoring` TINYINT DEFAULT 0,
`id_group` MEDIUMINT UNSIGNED NULL DEFAULT 0,
@ -3898,7 +3898,7 @@ CREATE TABLE IF NOT EXISTS `tipam_network` (
`id_site` BIGINT UNSIGNED,
`vrf` INT UNSIGNED,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE,
FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE SET NULL ON UPDATE CASCADE,
FOREIGN KEY (`location`) REFERENCES `tipam_network_location`(`id`) ON DELETE CASCADE,
FOREIGN KEY (`id_site`) REFERENCES `tipam_sites`(`id`) ON DELETE SET NULL ON UPDATE CASCADE,
FOREIGN KEY (`vrf`) REFERENCES `tagente`(`id_agente`) ON DELETE SET NULL ON UPDATE CASCADE