# check against new subnet $error = VerifyIpAddress(transform2long($ip['ip_addr']), transform2long($subnetOld['subnet']) . "/" . $_POST['newMask']); if (!$error) { } else { $errors[] = $error; } } /* ask must be > 8 */ if ($_POST['newMask'] < 8) { die('<div class="alert alert-danger">' . _('New mask must be at least /8') . '!</div>'); } /* * if strict mode is enabled check that is is still inside master subnet! */ if ($section['strictMode'] == 1) { if (!($overlap = verifySubnetNesting($subnetOld['masterSubnetId'], transform2long($subnetOld['subnet']) . "/" . $_POST['newMask'])) && $subnetOld['masterSubnetId'] != 0) { # get master details $master = getSubnetDetailsById($subnetOld['masterSubnetId']); $master = Transform2long($master['subnet']) . "/" . $master['mask'] . " - " . $master['description']; $errors[] = _("New subnet not in master subnet") . "!<br>({$master})"; } } /* * If subnet has slaves make sure all slaves are still inside! */ if ($section['strictMode'] == 1) { $slaves = getAllSlaveSubnetsBySubnetId($_POST['subnetId']); if (sizeof($slaves) > 0) { foreach ($slaves as $slave) { if (!isSubnetInsideSubnet(transform2long($slave['subnet']) . "/" . $slave['mask'], transform2long($subnetOld['subnet']) . "/" . $_POST['newMask'])) { $errors[] = _("Nested subnet out of new subnet") . "!<br>(" . transform2long($slave['subnet']) . "/{$slave['mask']} - {$slave['description']})";
if ($section['strictMode'] == 1 && !$isFolder) { if (!($overlap = verifySubnetNesting($_POST['masterSubnetId'], $_POST['subnet']))) { $errors[] = _('Nested subnet not in root subnet!'); } } /* verify that no overlapping occurs if we are adding nested subnet */ if ($section['strictMode'] == 1 && !$isFolder) { if ($overlap = verifyNestedSubnetOverlapping($_POST['sectionId'], $_POST['subnet'], $_POST['vrfId'], $_POST['masterSubnetId'])) { $errors[] = $overlap; } } } else { if ($_POST['action'] == "edit") { if ($section['strictMode'] == 1 && !$isFolder) { /* verify that nested subnet is inside root subnet */ if (!($overlap = verifySubnetNesting($_POST['masterSubnetId'], $_POST['subnet'])) && $_POST['masterSubnetId'] != 0) { $errors[] = _('Nested subnet not in root subnet!'); } } /* for nesting - MasterId cannot be the same as subnetId! */ if ($_POST['masterSubnetId'] == $_POST['subnetId']) { $errors[] = _('Subnet cannot nest behind itself!'); } } else { } } } } /* but always verify vlan! */ $vlancheck = validateVlan($_POST['VLAN']); if ($vlancheck != 'ok') {