#10118 changed CIDR input
This commit is contained in:
parent
5b263981c4
commit
ccb0cda305
|
@ -782,7 +782,9 @@ class NetworkMap
|
|||
if ($this->network) {
|
||||
// Network map, based on direct network.
|
||||
$nodes = networkmap_get_nodes_from_ip_mask(
|
||||
$this->network
|
||||
$this->network,
|
||||
false,
|
||||
'
'
|
||||
);
|
||||
} else if ($this->mapOptions['map_filter']['empty_map']) {
|
||||
// Empty map returns no data.
|
||||
|
|
|
@ -1356,9 +1356,10 @@ function networkmap_get_types($strict_user=false)
|
|||
*/
|
||||
function networkmap_get_nodes_from_ip_mask(
|
||||
$ip_mask,
|
||||
$return_ids_only=false
|
||||
$return_ids_only=false,
|
||||
$separator=',',
|
||||
) {
|
||||
$list_ip_masks = explode(',', $ip_mask);
|
||||
$list_ip_masks = explode($separator, $ip_mask);
|
||||
|
||||
if (empty($list_ip_masks) === true) {
|
||||
return [];
|
||||
|
@ -1375,14 +1376,14 @@ function networkmap_get_nodes_from_ip_mask(
|
|||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM `tagente`
|
||||
INNER JOIN
|
||||
(SELECT DISTINCT `id_agent` FROM
|
||||
INNER JOIN
|
||||
(SELECT DISTINCT `id_agent` FROM
|
||||
(SELECT `id_agente` AS "id_agent", `direccion` AS "ip"
|
||||
FROM `tagente`
|
||||
FROM `tagente`
|
||||
UNION
|
||||
SELECT ag.`id_agent`, a.`ip`
|
||||
FROM `taddress_agent` ag
|
||||
INNER JOIN `taddress` a
|
||||
FROM `taddress_agent` ag
|
||||
INNER JOIN `taddress` a
|
||||
ON ag.id_a=a.id_a
|
||||
) t_tmp
|
||||
WHERE (-1 << %d) & INET_ATON(t_tmp.ip) = INET_ATON("%s")
|
||||
|
|
|
@ -273,6 +273,21 @@ if (!empty($result)) {
|
|||
if ($not_found) {
|
||||
ui_print_error_message(__('Not found networkmap.'));
|
||||
} else {
|
||||
if ($disabled_source === false) {
|
||||
$info1 = __('To create a network map that visually recreates link-level (L2) relationships, you must first discover these relationships with Discovery Server. Network maps only reflect relationships that have already been discovered.');
|
||||
$separator = '<br>';
|
||||
$info2 = __('Discovery Server discovers relationships between interfaces (L2) through SNMP and relationships between hosts (L3) through route discovery.');
|
||||
$info3 = __('You can also create these relationships manually by editing nodes or re-passing a discovery task after adding new information (for example by adding new SNMP communities).');
|
||||
$info4 = __('See our documentation for more information.');
|
||||
ui_print_info_message(
|
||||
[
|
||||
'no_close' => false,
|
||||
'message' => $info1.$separator.$info2.$separator.$info3.$separator.$info4,
|
||||
],
|
||||
'style="width: 98%;"'
|
||||
);
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'form_editor';
|
||||
|
||||
|
@ -401,7 +416,16 @@ if ($not_found) {
|
|||
);
|
||||
|
||||
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
|
||||
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
|
||||
$table->data['source_data_ip_mask'][1] = html_print_textarea(
|
||||
'ip_mask',
|
||||
3,
|
||||
5,
|
||||
$ip_mask,
|
||||
'style="width: 238px"',
|
||||
true,
|
||||
'',
|
||||
$disabled_source
|
||||
);
|
||||
|
||||
$table->data['source_data_group'][0] = __('Source group');
|
||||
$table->data['source_data_group'][1] = '<div class="w250px">'.html_print_select_groups(
|
||||
|
|
|
@ -237,7 +237,16 @@ if (is_ajax() === true) {
|
|||
);
|
||||
|
||||
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
|
||||
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $map_info['source_data'], '', 20, 255, true);
|
||||
$table->data['source_data_ip_mask'][1] = html_print_textarea(
|
||||
'ip_mask',
|
||||
3,
|
||||
5,
|
||||
$map_info['source_data'],
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
$disabled_source
|
||||
);
|
||||
|
||||
$dont_show_subgroups = 0;
|
||||
if (isset($map_filter['dont_show_subgroups'])) {
|
||||
|
|
Loading…
Reference in New Issue