summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/captiveportal.inc8
-rw-r--r--etc/inc/filter.inc20
-rw-r--r--etc/inc/vpn.inc9
3 files changed, 22 insertions, 15 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index 02cc8c2..4f6fb3e 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1028,8 +1028,12 @@ function setup_dnsfilter_entries() {
}
}
file_put_contents($cp_filterdns_filename, $cp_filterdns_conf);
- killbypid("{$g['tmp_path']}/filterdns-cpah.pid");
- mwexec("/usr/local/sbin/filterdns -p {$g['tmp_path']}/filterdns-cpah.pid -i 300 -c {$cp_filterdns_filename} -d 1");
+ if (isvalidpid("{$g['tmp_path']}/filterdns-cpah.pid"))
+ sigkillbypid("{$g['tmp_path']}/filterdns-cpah.pid", "HUP");
+ else {
+ killbypid("{$g['tmp_path']}/filterdns-cpah.pid");
+ mwexec("/usr/local/sbin/filterdns -p {$g['tmp_path']}/filterdns-cpah.pid -i 300 -c {$cp_filterdns_filename} -d 1");
+ }
}
function captiveportal_allowedhostname_configure() {
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index ece6b04..6075091 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -349,17 +349,17 @@ function filter_configure_sync($delete_states_if_needed = true) {
layer7_start_l7daemon();
if(!empty($filterdns)) {
- $filterdnsfd = fopen("{$g['varetc_path']}/filterdns.conf", "w");
- if($filterdnsfd) {
- fwrite($filterdnsfd, $filterdns);
- fclose($filterdnsfd);
+ @file_put_contents("{$g['varetc_path']}/filterdns.conf", $filterdns);
+ if (isvalidpid("{$g['tmp_path']}/filterdns.pid"))
+ sigkillbypid("{$g['tmp_path']}/filterdns.pid", "HUP");
+ else {
+ killbypid("{$g['tmp_path']}/filterdns.pid");
+ /*
+ * FilterDNS has three debugging levels. The default choosen is 1.
+ * Availabe are level 2 and greater then 2.
+ */
+ mwexec("/usr/local/sbin/filterdns -p {$g['tmp_path']}/filterdns.pid -i 300 -c {$g['varetc_path']}/filterdns.conf -d 1");
}
- killbypid("{$g['tmp_path']}/filterdns.pid");
- /*
- * FilterDNS has three debugging levels. The default choosen is 1.
- * Availabe are level 2 and greater then 2.
- */
- mwexec("/usr/local/sbin/filterdns -p {$g['tmp_path']}/filterdns.pid -i 300 -c {$g['varetc_path']}/filterdns.conf -d 1");
}
/* run items scheduled for after filter configure run */
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc
index 1445da6..3edeb31 100644
--- a/etc/inc/vpn.inc
+++ b/etc/inc/vpn.inc
@@ -915,9 +915,12 @@ EOD;
$hostnames .= "cmd {$hostname} '/usr/local/sbin/pfSctl -c \"service reload ipsecdns\"'\n";
file_put_contents("{$g['varetc_path']}/filterdns-ipsec.hosts", $hostnames);
- killbypid("{$g['varrun_path']}/filterdns-ipsec.pid");
- sleep(1);
- mwexec("/usr/local/sbin/filterdns -p {$g['varrun_path']}/filterdns-ipsec.pid -i {$interval} -c {$g['varetc_path']}/filterdns-ipsec.hosts -d 1");
+ if (isvalidpid("{$g['varrun_path']}/filterdns-ipsec.pid"))
+ sigkillbypid("{$g['varrun_path']}/filterdns-ipsec.pid", "HUP");
+ else {
+ killbypid("{$g['varrun_path']}/filterdns-ipsec.pid");
+ mwexec("/usr/local/sbin/filterdns -p {$g['varrun_path']}/filterdns-ipsec.pid -i {$interval} -c {$g['varetc_path']}/filterdns-ipsec.hosts -d 1");
+ }
}
vpn_ipsec_failover_configure();
OpenPOWER on IntegriCloud