From fe80446f3b058d9a3ed4361975724f6ea9297777 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 7 May 2007 17:23:21 +0000 Subject: Add is_wan_interface_up($interface) Can be optional interface as well. --- etc/inc/pfsense-utils.inc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'etc/inc/pfsense-utils.inc') 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; +} + ?> -- cgit v1.1