diff options
author | Ermal <eri@pfsense.org> | 2010-05-07 10:05:59 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-05-07 10:05:59 +0000 |
commit | 28955fee05007f9a7f8aa4a189969f675c0690dc (patch) | |
tree | 6917d2e71e66e240b97bbd20a2770fe5b86215e7 /etc/inc | |
parent | fad4fae8da60daf10f439e186a0b40ceb8d41bd4 (diff) | |
download | pfsense-28955fee05007f9a7f8aa4a189969f675c0690dc.zip pfsense-28955fee05007f9a7f8aa4a189969f675c0690dc.tar.gz |
Use a global array to prevent errors on rulesets which have invalid gateways. If such are found do not use the gateway at all. Probably the rule should be skipped too?.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/filter.inc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index aef2b7a..a68094f 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -51,6 +51,9 @@ $time_based_rules = false; /* Used to hold the interface list that will be used on ruleset creation. */ $FilterIflist = array(); +/* Create a global array to avoid errors on rulesets. */ +$GatewaysList = array(); + /* Used for the hostname dns resolver */ $filterdns = ""; @@ -531,7 +534,7 @@ function filter_generate_aliases() { } function filter_generate_gateways() { - global $config, $g; + global $config, $g, $GatewaysList; $rules = "# Gateways\n"; @@ -588,6 +591,9 @@ function filter_generate_gateways() { } } + /* Create a global array to avoid errors on rulesets. */ + $GatewaysList = array_merge($GatewaysList, $GatewayGroupsList); + $rules .= "\n"; return $rules; @@ -1544,8 +1550,11 @@ function filter_generate_user_rule($rule) { } /* if user has selected a custom gateway, lets work with it */ else if($rule['gateway'] <> "") { - /* Add the load balanced gateways */ - $aline['route'] = " \$GW{$rule['gateway']} "; + if (isset($GatewaysList[$rule['gateway']])) + /* Add the load balanced gateways */ + $aline['route'] = " \$GW{$rule['gateway']} "; + else + log_error("The gateway: {$rule['gateway']} is invalid/unkown not using it."); } if(isset($rule['protocol'])) { |