summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-07-31 05:38:03 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-07-31 05:38:03 +0000
commitab8caecc9199465184d5c07603d7b1e6f6632fa5 (patch)
tree8ef6d90be8569d439182201aef122d5fd7b40219 /etc/inc/pfsense-utils.inc
parentc46a4d2ef0827938fbc142d55b977ad52a18ecee (diff)
downloadpfsense-ab8caecc9199465184d5c07603d7b1e6f6632fa5.zip
pfsense-ab8caecc9199465184d5c07603d7b1e6f6632fa5.tar.gz
Add get_dns_servers()
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-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 b62ed66..75fbd6b 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -37,6 +37,25 @@ function get_tmp_file() {
return "/tmp/tmp-" . time();
}
+/****f* pfsense-utils/get_dns_servers
+ * NAME
+ * get_dns_servres - get system dns servers
+ * INPUTS
+ * $dns_servers - an array of the dns servers
+ * RESULT
+ * null
+ ******/
+function get_dns_servers() {
+ $dns_servers = array();
+ $dns = `cat /etc/resolv.conf`;
+ $dns_s = split("\n", $dns);
+ foreach($dns_s as $dns) {
+ if (preg_match("/nameserver (.*)/", $dns, $matches))
+ $dns_servers[] = $matches[1];
+ }
+ return $dns_servers;
+}
+
/****f* pfsense-utils/log_error
* NAME
* log_error - Sends a string to syslog.
OpenPOWER on IntegriCloud