aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-10-05 10:13:25 -0400
committerjim-p <jimp@pfsense.org>2010-10-05 10:13:25 -0400
commitdaa83f6912bee3857ab91a5158ba6ccec6f93362 (patch)
treec61d9d28b65cfeae8d17aca54d891d52a8a45832
parent2456629c6f172395dc7a0d32d4a622c6167da9ee (diff)
downloadpfsense-packages-daa83f6912bee3857ab91a5158ba6ccec6f93362.tar.gz
pfsense-packages-daa83f6912bee3857ab91a5158ba6ccec6f93362.tar.bz2
pfsense-packages-daa83f6912bee3857ab91a5158ba6ccec6f93362.zip
Test if variables are set before using them in certain cases, might avoid a condition where interfaces are being duplicated. (Several forum threads about it)
-rw-r--r--config/snort/snort.inc14
-rw-r--r--config/snort/snort_interfaces_edit.php2
2 files changed, 8 insertions, 8 deletions
diff --git a/config/snort/snort.inc b/config/snort/snort.inc
index 7fd6d6ff..c9f08b11 100644
--- a/config/snort/snort.inc
+++ b/config/snort/snort.inc
@@ -99,8 +99,8 @@ function build_base_whitelist($build_netlist, $wanip, $wangw, $wandns, $vips, $v
$int_array = array('lan');
for ($j = 1; isset ($config['interfaces']['opt' . $j]); $j++)
if(isset($config['interfaces']['opt' . $j]['enable']))
- if(!$config['interfaces']['opt' . $j]['gateway'])
- $int_array[] = "opt{$j}";
+ if(isset($config['interfaces']['opt' . $j]['gateway']))
+ $int_array[] = "opt{$j}";
/* iterate through interface list and write out whitelist items
* and also compile a home_net list for snort.
@@ -344,9 +344,9 @@ function convert_friendly_interface_to_real_interface_name2($interface)
foreach ($ifdescrs as $ifdescr => $ifname)
{
if(strtolower($ifname) == $lc_interface)
- return $config['interfaces'][$ifname]['if'];
- if(strtolower($config['interfaces'][$ifname]['descr']) == $lc_interface)
- return $config['interfaces'][$ifname]['if'];
+ return $config['interfaces'][$ifname]['if'];
+ if(isset($config['interfaces'][$ifname]['descr']) && (strtolower($config['interfaces'][$ifname]['descr']) == $lc_interface))
+ return $config['interfaces'][$ifname]['if'];
}
return $interface;
@@ -2318,8 +2318,8 @@ function generate_snort_conf($id, $if_real, $snort_uuid)
$automaticrulesupdate = $config['installedpackages']['snortglobal']['automaticrulesupdate7'];
/* if user is on pppoe, we really want to use ng0 interface */
- if($config['interfaces'][$snort_ext_int]['ipaddr'] == "pppoe")
- $snort_ext_int = "ng0";
+ if(isset($config['interfaces'][$snort_ext_int]['ipaddr']) && ($config['interfaces'][$snort_ext_int]['ipaddr'] == "pppoe"))
+ $snort_ext_int = "ng0";
/* set the snort performance model */
if($config['installedpackages']['snortglobal']['rule'][$id]['performance'])
diff --git a/config/snort/snort_interfaces_edit.php b/config/snort/snort_interfaces_edit.php
index e7df2243..6b3b3a55 100644
--- a/config/snort/snort_interfaces_edit.php
+++ b/config/snort/snort_interfaces_edit.php
@@ -484,7 +484,7 @@ echo "
foreach($if_array as $iface2) {
$if2 = convert_friendly_interface_to_real_interface_name2($iface2);
- if($config['interfaces'][$iface2]['ipaddr'] == "pppoe") {
+ if(isset($config['interfaces'][$iface2]['ipaddr']) && ($config['interfaces'][$iface2]['ipaddr'] == "pppoe")) {
$if2 = "ng0";
}