summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/filter.inc21
-rw-r--r--etc/inc/pfsense-utils.inc22
2 files changed, 23 insertions, 20 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index c6bc3ea..3a6268d 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -34,25 +34,6 @@
/* include all configuration functions */
require_once("functions.inc");
-function is_carp_defined() {
- /* is carp compiled into the kernel and userland? */
- $command = "/sbin/sysctl -a | grep carp";
- $fd = popen($command . " 2>&1 ", "r");
- if(!$fd) {
- log_error("Warning, could not execute command ");
- return 0;
- }
- while(!feof($fd)) {
- $tmp .= fread($fd,49);
- }
- fclose($fd);
-
- if($tmp == "")
- return 0;
- else
- return 1;
-}
-
function filter_resync() {
global $config, $g;
@@ -953,7 +934,7 @@ function filter_rules_generate() {
$log = "";
/* if carp is defined, lets pass the traffic */
- if(is_carp_defined() == 1) {
+ if(is_carp_defined() == true) {
$ipfrules .= "pass on " . $lanif . " proto carp keep state label \"carp\"\n";
$ipfrules .= "pass on " . $wanif . " proto carp keep state label \"carp\"\n";
}
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 73ecc3b..6ebe247 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -67,4 +67,26 @@ function return_filename_as_string($filename) {
return $tmp;
}
+/*
+ * is_carp_defined: returns true if carp is detected in kernel
+ */
+function is_carp_defined() {
+ /* is carp compiled into the kernel and userland? */
+ $command = "/sbin/sysctl -a | grep carp";
+ $fd = popen($command . " 2>&1 ", "r");
+ if(!$fd) {
+ log_error("Warning, could not execute command ");
+ return 0;
+ }
+ while(!feof($fd)) {
+ $tmp .= fread($fd,49);
+ }
+ fclose($fd);
+
+ if($tmp == "")
+ return false;
+ else
+ return true;
+}
+
?> \ No newline at end of file
OpenPOWER on IntegriCloud