From d237fab6a674cd11cecf30a3aed3151e910bd8d2 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 28 Sep 2021 13:42:30 +0200 Subject: [PATCH 1/2] #8024 fixed router ip --- pandora_console/include/functions_netflow.php | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index 8007c19077..7d7d5bd131 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -910,17 +910,24 @@ function netflow_get_filter_arguments($filter, $safe_input=false) // Normal filter. if ($filter['ip_dst'] != '') { - $filter_args .= ' ('; + if ($filter_args != '') { + $filter_args .= ' AND ('; + } else { + $filter_args .= ' ('; + } + $val_ipdst = explode(',', io_safe_output($filter['ip_dst'])); for ($i = 0; $i < count($val_ipdst); $i++) { - if ($i > 0) { - $filter_args .= ' or '; - } + if (!empty($val_ipdst[$i])) { + if ($i > 0) { + $filter_args .= ' or '; + } - if (netflow_is_net($val_ipdst[$i]) == 0) { - $filter_args .= 'dst ip '.$val_ipdst[$i]; - } else { - $filter_args .= 'dst net '.$val_ipdst[$i]; + if (netflow_is_net($val_ipdst[$i]) == 0) { + $filter_args .= 'dst ip '.$val_ipdst[$i]; + } else { + $filter_args .= 'dst net '.$val_ipdst[$i]; + } } } @@ -1734,7 +1741,9 @@ function netflow_update_second_level_filter(&$filter, $aggregate, $sources) $filter[$extra_filter] .= ','; } - $filter[$extra_filter] = implode(',', $sources); + if (!empty($sources)) { + $filter[$extra_filter] = implode(',', $sources); + } } From 12d47cd1aa56d98fdcb7b8175be2c845203c736e Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 30 Sep 2021 16:09:08 +0200 Subject: [PATCH 2/2] #8024 fixed router ip --- pandora_console/include/functions_netflow.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index 7d7d5bd131..52994ee895 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -911,23 +911,21 @@ function netflow_get_filter_arguments($filter, $safe_input=false) // Normal filter. if ($filter['ip_dst'] != '') { if ($filter_args != '') { - $filter_args .= ' AND ('; + $filter_args .= ' and ('; } else { $filter_args .= ' ('; } $val_ipdst = explode(',', io_safe_output($filter['ip_dst'])); for ($i = 0; $i < count($val_ipdst); $i++) { - if (!empty($val_ipdst[$i])) { - if ($i > 0) { - $filter_args .= ' or '; - } + if ($i > 0) { + $filter_args .= ' or '; + } - if (netflow_is_net($val_ipdst[$i]) == 0) { - $filter_args .= 'dst ip '.$val_ipdst[$i]; - } else { - $filter_args .= 'dst net '.$val_ipdst[$i]; - } + if (netflow_is_net($val_ipdst[$i]) == 0) { + $filter_args .= 'dst ip '.$val_ipdst[$i]; + } else { + $filter_args .= 'dst net '.$val_ipdst[$i]; } }