From 06a398a0794be677ec7d74996f7aa32db80348b8 Mon Sep 17 00:00:00 2001 From: Ermal Date: Tue, 2 Aug 2011 20:49:01 +0000 Subject: More corrections --- config/snort/snort.inc | 58 +++++++++++++++++++++------------------ config/snort/snort_interfaces.php | 24 +++++++++------- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 66bbd8c5..40459984 100644 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -117,35 +117,41 @@ function build_base_whitelist($build_netlist, $wanip, $wangw, $wandns, $vips, $v */ foreach ($int_array as $int) { /* calculate interface subnet information */ - $ifcfg = $config['interfaces'][$int]; - switch ($ifcfg['ipaddr']) { - case "pppoe": - case "pptp": - case "l2tp": - if (function_exists('get_interface_ip')) - $subnet = get_interface_ip($int); - else - $subnet = find_interface_ip("ng0"); - - if (is_ipaddr($subnet)) - $home_net .= "{$subnet} "; - break; - case "dhcp": - $subnet = find_interface_ip(snort_get_real_interface($int)); - if (is_ipaddr($subnet)) - $home_net .= "{$subnet} "; - break; - default: - if (is_ipaddr($ifcfg['ipaddr'])) { - $subnet = gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']); - if ($ifcfg['subnet']) - $home_net .= "{$subnet}/{$ifcfg['subnet']} "; + if (function_exists('get_interface_ip')) { + $subnet = get_interface_ip($int); + $sn = get_interface_subnet($int); + $home_net .= "{$subnet}/{$sn} "; + } else { + $ifcfg = $config['interfaces'][$int]; + switch ($ifcfg['ipaddr']) { + case "pppoe": + case "pptp": + case "l2tp": + if (function_exists('get_interface_ip')) + $subnet = get_interface_ip($int); + else + $subnet = find_interface_ip("ng0"); + + if (is_ipaddr($subnet)) + $home_net .= "{$subnet} "; + break; + case "dhcp": + $subnet = find_interface_ip(snort_get_real_interface($int)); + if (is_ipaddr($subnet)) + $home_net .= "{$subnet} "; + break; + default: + if (is_ipaddr($ifcfg['ipaddr'])) { + $subnet = gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']); + if ($ifcfg['subnet']) + $home_net .= "{$subnet}/{$ifcfg['subnet']} "; + } + break; } - break; } } - if($wanip == 'yes') { + if ($snort_pfsense_basever == 'yes' && $wanip == 'yes') { /* add all WAN ips to the whitelist */ $wan_if = get_real_wan_interface(); $ip = find_interface_ip($wan_if); @@ -153,7 +159,7 @@ function build_base_whitelist($build_netlist, $wanip, $wangw, $wandns, $vips, $v $home_net .= "{$ip} "; } - if($wangw == 'yes') { + if ($wangw == 'yes') { /* Add Gateway on WAN interface to whitelist (For RRD graphs) */ $gw = get_interface_gateway('wan'); if($gw) diff --git a/config/snort/snort_interfaces.php b/config/snort/snort_interfaces.php index 6b19c0a4..a0581d4f 100644 --- a/config/snort/snort_interfaces.php +++ b/config/snort/snort_interfaces.php @@ -317,16 +317,20 @@ enable JavaScript to view this content id="frd" ondblclick="document.location='snort_interfaces_edit.php?id=';">