summaryrefslogtreecommitdiffstats
path: root/etc/inc/filter.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-12-24 17:13:27 -0500
committerScott Ullrich <sullrich@pfsense.org>2009-12-24 17:13:33 -0500
commite56e532528386113852bd26efdd80c5a203203d2 (patch)
tree46a24829b7f03005931de04266dedcbbfd29c2d4 /etc/inc/filter.inc
parent2f31946fd294ded8816b9d4c7d2e2033b5e6feb8 (diff)
downloadpfsense-e56e532528386113852bd26efdd80c5a203203d2.zip
pfsense-e56e532528386113852bd26efdd80c5a203203d2.tar.gz
Simplify logic a bit
Diffstat (limited to 'etc/inc/filter.inc')
-rw-r--r--etc/inc/filter.inc44
1 files changed, 22 insertions, 22 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index b21dc67..ca7cff5 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -2406,28 +2406,28 @@ EOD;
function discover_pkg_rules($ruletype) {
global $config, $g;
- if(is_dir("/usr/local/pkg")) {
- $files = split("\n", trim(`ls /usr/local/pkg/*.inc`));
- foreach($files as $pkg_inc) {
- if($pkg_inc == "ls: No match.")
- continue;
- update_filter_reload_status("Checking for {$ruletype} PF hooks in package {$pkg_inc}");
- require_once($pkg_inc);
- $pkg = basename($pkg_inc);
- $pkg_generate_rules = "{$pkg}_generate_rules";
- if(function_exists($pkg_generate_rules)) {
- update_filter_reload_status("Processing early {$ruletype} rules for package {$pkg_inc}");
- $rules .= $pkg_generate_rules("$ruletype");
- file_put_contents("{$g['tmp_path']}/rules.packages", $rules);
- $status = mwexec("/sbin/pfctl -nf {$g['tmp_path']}/rules.packages");
- if ($status <> 0) {
- $errorrules = "There was an error while parsing the package filter rules for {$pkg_inc}.\n";
- log_error($errorrules);
- file_put_contents("{$g['tmp_path']}/rules.packages.{$pkg_inc}", "#{$errorrules}\n");
- return "";
- } else {
- return $rules;
- }
+ if(!is_dir("/usr/local/pkg"))
+ return "";
+ $files = split("\n", trim(`ls /usr/local/pkg/*.inc`));
+ foreach($files as $pkg_inc) {
+ if($pkg_inc == "ls: No match.")
+ continue;
+ update_filter_reload_status("Checking for {$ruletype} PF hooks in package {$pkg_inc}");
+ require_once($pkg_inc);
+ $pkg = basename($pkg_inc);
+ $pkg_generate_rules = "{$pkg}_generate_rules";
+ if(function_exists($pkg_generate_rules)) {
+ update_filter_reload_status("Processing early {$ruletype} rules for package {$pkg_inc}");
+ $rules .= $pkg_generate_rules("$ruletype");
+ file_put_contents("{$g['tmp_path']}/rules.packages", $rules);
+ $status = mwexec("/sbin/pfctl -nf {$g['tmp_path']}/rules.packages");
+ if ($status <> 0) {
+ $errorrules = "There was an error while parsing the package filter rules for {$pkg_inc}.\n";
+ log_error($errorrules);
+ file_put_contents("{$g['tmp_path']}/rules.packages.{$pkg_inc}", "#{$errorrules}\n");
+ return "";
+ } else {
+ return $rules;
}
}
}
OpenPOWER on IntegriCloud