From 5b9b67f23c52be2cc0254dc45a226a94f22b7301 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 20 Feb 2007 04:05:25 +0000 Subject: Do not enumerate variable unless it is a variable. --- packages/bandwidthd/bandwidthd.inc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/bandwidthd/bandwidthd.inc b/packages/bandwidthd/bandwidthd.inc index 67a251e7..262530ce 100644 --- a/packages/bandwidthd/bandwidthd.inc +++ b/packages/bandwidthd/bandwidthd.inc @@ -83,18 +83,20 @@ function bandwidthd_install_config() { //for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { //$ifdescrs['opt' . $j] = "opt" . $j; //} - foreach($ifdescrs as $int) { - /* calculate interface subnet information */ - $ifcfg = &$config['interfaces'][$int]; - $subnet = gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']); - $subnetmask = gen_subnet_mask($ifcfg['subnet']); - if($subnet == "pppoe") { - $subnet = find_interface_ip("ng0"); - if($subnet) - $subnets .= "subnet {$subnet}/32\n"; - } else { - if($subnet) - $subnets .= "subnet {$subnet}/{$ifcfg['subnet']}\n"; + if(is_array($ifdescrs)) { + foreach($ifdescrs as $int) { + /* calculate interface subnet information */ + $ifcfg = &$config['interfaces'][$int]; + $subnet = gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']); + $subnetmask = gen_subnet_mask($ifcfg['subnet']); + if($subnet == "pppoe") { + $subnet = find_interface_ip("ng0"); + if($subnet) + $subnets .= "subnet {$subnet}/32\n"; + } else { + if($subnet) + $subnets .= "subnet {$subnet}/{$ifcfg['subnet']}\n"; + } } } -- cgit v1.2.3