summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-12-17 00:30:54 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-12-17 00:30:54 +0000
commit979cd6db9c6a81493498660f7205faabf25ed6ec (patch)
treee5c249e3c3ab0edc377b2222db58df954f8eea29 /etc/inc/util.inc
parente4f12d21fff0aa68637300dcbee69b4705e9d91c (diff)
downloadpfsense-979cd6db9c6a81493498660f7205faabf25ed6ec.zip
pfsense-979cd6db9c6a81493498660f7205faabf25ed6ec.tar.gz
Adding dnswatch support.
Obtained-from: m0n0wall
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc19
1 files changed, 19 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 487efed..7c46eac 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -555,4 +555,23 @@ function mac_format($clientmac) {
}
}
+function resolve_retry($hostname, $retries = 5) {
+
+ if (is_ipaddr($hostname))
+ return $hostname;
+
+ for ($i = 0; $i < $retries; $i++) {
+ $ip = gethostbyname($hostname);
+
+ if ($ip && $ip != $hostname) {
+ /* success */
+ return $ip;
+ }
+
+ sleep(1);
+ }
+
+ return false;
+}
+
?> \ No newline at end of file
OpenPOWER on IntegriCloud