summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2007-05-07 17:23:21 +0000
committerSeth Mos <seth.mos@xs4all.nl>2007-05-07 17:23:21 +0000
commitfe80446f3b058d9a3ed4361975724f6ea9297777 (patch)
treeb660a924c82c262371d5081d04eab6b22dfffe1b
parentf9927473c4000fdbc3e586d313b49d7a6e2c2038 (diff)
downloadpfsense-fe80446f3b058d9a3ed4361975724f6ea9297777.zip
pfsense-fe80446f3b058d9a3ed4361975724f6ea9297777.tar.gz
Add is_wan_interface_up($interface)
Can be optional interface as well.
-rw-r--r--etc/inc/pfsense-utils.inc19
1 files changed, 19 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 6c681af..bf53caa 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -3682,4 +3682,23 @@ function get_cpu_speed() {
return exec("sysctl hw.clockrate | awk '{ print $2 }'");
}
+/* check if the wan interface is up
+ * Wait for a maximum of 10 seconds
+ * If the interface is up before then continue
+ */
+function is_wan_interface_up($interface) {
+ global $g;
+ global $config;
+ $i = 0;
+ while($i < 10) {
+ if(get_interface_gateway($interface)) {
+ return true;
+ } else {
+ sleep(1);
+ }
+ $i++;
+ }
+ return false;
+}
+
?>
OpenPOWER on IntegriCloud