Commit 382a3d3b authored by Franco Fichtner's avatar Franco Fichtner

unbound: move get_dns_servers()

parent 0b486cd1
...@@ -51,26 +51,6 @@ function is_private_ip($iptocheck) ...@@ -51,26 +51,6 @@ function is_private_ip($iptocheck)
return $isprivate; return $isprivate;
} }
/****f* legacy/get_dns_servers
* NAME
* get_dns_servers - get system dns servers
* INPUTS
* $dns_servers - an array of the dns servers
* RESULT
* null
******/
function get_dns_servers() {
$dns_servers = array();
$dns_s = file("/etc/resolv.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($dns_s as $dns) {
$matches = "";
if (preg_match("/nameserver (.*)/", $dns, $matches)) {
$dns_servers[] = $matches[1];
}
}
return array_unique($dns_servers);
}
/* /*
* get_carp_interface_status($carpinterface): returns the status of a carp ip * get_carp_interface_status($carpinterface): returns the status of a carp ip
*/ */
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/* /*
Copyright (C) 2015 Manuel Faux <mfaux@conf.at> Copyright (C) 2015 Manuel Faux <mfaux@conf.at>
Copyright (C) 2014 Warren Baker <warren@decoy.co.za> Copyright (C) 2014 Warren Baker <warren@decoy.co.za>
Copyright (C) 2004-2007 Scott Ullrich <sullrich@gmail.com>
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -27,6 +28,26 @@ ...@@ -27,6 +28,26 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/****f* legacy/get_dns_servers
* NAME
* get_dns_servers - get system dns servers
* INPUTS
* $dns_servers - an array of the dns servers
* RESULT
* null
******/
function get_dns_servers() {
$dns_servers = array();
$dns_s = file("/etc/resolv.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($dns_s as $dns) {
$matches = "";
if (preg_match("/nameserver (.*)/", $dns, $matches)) {
$dns_servers[] = $matches[1];
}
}
return array_unique($dns_servers);
}
/* Optimize Unbound for environment */ /* Optimize Unbound for environment */
function unbound_optimization() { function unbound_optimization() {
global $config; global $config;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment