summaryrefslogtreecommitdiffstats
path: root/etc/inc/filter.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2014-03-20 15:56:04 +0000
committerErmal <eri@pfsense.org>2014-03-20 15:59:12 +0000
commitbd53b624d4ff3d82b7cd88a3acf94071feb611e0 (patch)
tree53afe0ea9886557439e3830a1e2311b00899cb0d /etc/inc/filter.inc
parent7a433db2f19207e1ad2a2467d9a6918417d3bc93 (diff)
downloadpfsense-bd53b624d4ff3d82b7cd88a3acf94071feb611e0.zip
pfsense-bd53b624d4ff3d82b7cd88a3acf94071feb611e0.tar.gz
Try to restore last working ruleset rather than staying without configuration at all
Diffstat (limited to 'etc/inc/filter.inc')
-rw-r--r--etc/inc/filter.inc17
1 files changed, 11 insertions, 6 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index bcbf6a4..f9cea72 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -329,17 +329,22 @@ function filter_configure_sync($delete_states_if_needed = true) {
if(is_array($line_split))
$line_error = sprintf(gettext('The line in question reads [%1$d]: %2$s'), $line_number, $line_split[$line_number-1]);
unset($line_split);
- if ($line_error and $line_number) {
- file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error[0], $line_error), "Filter Reload", "");
- update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error[0], $line_error));
- unlock($filterlck);
- return;
- }
+
/* Brutal ugly hack but required -- PF is stuck, unwedge */
if (strstr("$rules_error[0]", "busy")) {
exec("/sbin/pfctl -d; /sbin/pfctl -e; /sbin/pfctl -f {$g['tmp_path']}/rules.debug");
$error_msg = gettext("PF was wedged/busy and has been reset.");
file_notice("pf_busy", $error_msg, "pf_busy", "");
+ } else {
+ $_grbg = exec("/sbin/pfctl -o basic -f {$g['tmp_path']}/rules.debug.old 2>&1", $rules_error, $rules_loading);
+ }
+ unset($rules_loading, $rules_error);
+
+ if ($line_error and $line_number) {
+ file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error[0], $line_error), "Filter Reload", "");
+ update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $rules_error[0], $line_error));
+ unlock($filterlck);
+ return;
}
}
OpenPOWER on IntegriCloud