From a6726cf24d445af12a7a483576e33afb2f8948c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Thu, 1 Oct 2009 15:41:01 +0000 Subject: Write the rules with php provided tools to avoid forking unecessary. Suggested-by: billm@ --- etc/inc/interfaces.inc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 9dcf6e3..d291171 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1007,10 +1007,15 @@ function interfaces_carp_setup() { /* install rules to alllow pfsync to sync up during boot * carp interfaces will remain down until the bootup sequence finishes */ - exec("echo pass quick proto carp all keep state > {$g['tmp_path']}/rules.boot"); - exec("echo pass quick proto pfsync all >> {$g['tmp_path']}/rules.boot"); - exec("echo pass out quick from any to any keep state >> {$g['tmp_path']}/rules.boot"); - exec("/sbin/pfctl -f {$g['tmp_path']}/rules.boot"); + $fd = fopen("{$g['tmp_path']}/rules.boot", "w"); + if ($fd) { + fwrite($fd, "echo pass quick proto carp all keep state\n"); + fwrite($fd, "echo pass quick proto pfsync all\n"); + fwrite($fd, "echo pass out quick from any to any keep state\n"); + fclose($fd); + mwexec("/sbin/pfctl -f {$g['tmp_path']}/rules.boot"); + } else + log_error("Could not create rules.boot file!"); } /* setup pfsync interface */ -- cgit v1.1