From a02708b12becb467d2d1ce4a60802e1d804d670b Mon Sep 17 00:00:00 2001 From: Ermal Date: Thu, 30 Sep 2010 16:04:54 +0000 Subject: Make this code more readble and clear on what it does. --- etc/inc/system.inc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'etc/inc/system.inc') diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 10f785c..e728910 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -372,16 +372,15 @@ function system_routing_configure($interface = "") { foreach ($config['staticroutes']['route'] as $rtent) { $gatewayip = ""; - if (isset($gateways_arr[$rtent['gateway']])) { - if ($interface == $gateways_arr[$rtent['gateway']]['friendlyiface']) - continue; - $gatewayip = $gateways_arr[$rtent['gateway']]['gateway']; - $interfacegw = $gateways_arr[$rtent['gateway']]['interface']; - } else { + if (empty($gateways_arr[$rtent['gateway']])) { log_error("Static Routes: Gateway IP could not be found for {$rtent['network']}"); continue; } - + $gateway = $gateways_arr[$rtent['gateway']]; + if ($interface == $gateway['friendlyiface']) + continue; + $gatewayip = $gateway['gateway']; + $interfacegw = $gateway['interface']; $action = "add"; if (isset($route_arr[$rtent['network']])) $action = "change"; -- cgit v1.1