Commit 65aa0382 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) move is_private_ip() to util.inc

parent 1a7199cc
...@@ -26,31 +26,6 @@ ...@@ -26,31 +26,6 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/****f* legacy/is_private_ip
* NAME
* is_private_ip
* INPUTS
* none
* RESULT
* returns true if an ip address is in a private range
******/
function is_private_ip($iptocheck)
{
$isprivate = false;
$ip_private_list=array(
"10.0.0.0/8",
"100.64.0.0/10",
"172.16.0.0/12",
"192.168.0.0/16",
);
foreach($ip_private_list as $private) {
if (ip_in_subnet($iptocheck,$private)==true) {
$isprivate = true;
}
}
return $isprivate;
}
/* /*
* restore_config_section($section_name, new_contents): restore a configuration section, * restore_config_section($section_name, new_contents): restore a configuration section,
* and write the configuration out * and write the configuration out
......
...@@ -1126,6 +1126,17 @@ function ip_in_subnet($addr,$subnet) ...@@ -1126,6 +1126,17 @@ function ip_in_subnet($addr,$subnet)
} }
} }
function is_private_ip($iptocheck)
{
foreach(array("10.0.0.0/8", "100.64.0.0/10", "172.16.0.0/12", "192.168.0.0/16") as $private) {
if (ip_in_subnet($iptocheck,$private)==true) {
return true;
}
}
return false;
}
function resolve_retry($hostname, $retries = 5) function resolve_retry($hostname, $retries = 5)
{ {
if (is_ipaddr($hostname)) { if (is_ipaddr($hostname)) {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("filter.inc"); require_once("filter.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
/** /**
......
...@@ -38,6 +38,7 @@ require_once("system.inc"); ...@@ -38,6 +38,7 @@ require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("ipsec.inc"); require_once("ipsec.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("util.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("services.inc"); require_once("services.inc");
require_once("unbound.inc"); require_once("unbound.inc");
......
...@@ -36,6 +36,7 @@ require_once("interfaces.inc"); ...@@ -36,6 +36,7 @@ require_once("interfaces.inc");
require_once("ipsec.inc"); require_once("ipsec.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("services.inc"); require_once("services.inc");
require_once("unbound.inc"); require_once("unbound.inc");
......
...@@ -32,6 +32,7 @@ require_once("system.inc"); ...@@ -32,6 +32,7 @@ require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("unbound.inc"); require_once("unbound.inc");
require_once("services.inc"); require_once("services.inc");
......
...@@ -31,6 +31,7 @@ require_once("guiconfig.inc"); ...@@ -31,6 +31,7 @@ require_once("guiconfig.inc");
require_once("system.inc"); require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("unbound.inc"); require_once("unbound.inc");
require_once("services.inc"); require_once("services.inc");
......
...@@ -32,6 +32,7 @@ require_once("system.inc"); ...@@ -32,6 +32,7 @@ require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("unbound.inc"); require_once("unbound.inc");
require_once("services.inc"); require_once("services.inc");
......
...@@ -31,6 +31,7 @@ require_once("guiconfig.inc"); ...@@ -31,6 +31,7 @@ require_once("guiconfig.inc");
require_once("system.inc"); require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("unbound.inc"); require_once("unbound.inc");
require_once("services.inc"); require_once("services.inc");
......
...@@ -32,6 +32,7 @@ require_once("system.inc"); ...@@ -32,6 +32,7 @@ require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("unbound.inc"); require_once("unbound.inc");
require_once("services.inc"); require_once("services.inc");
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("services.inc") ; require_once("services.inc") ;
require_once("interfaces.inc"); require_once("interfaces.inc");
......
...@@ -33,6 +33,7 @@ require_once("system.inc"); ...@@ -33,6 +33,7 @@ require_once("system.inc");
require_once("services.inc"); require_once("services.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("unbound.inc"); require_once("unbound.inc");
require_once("services.inc"); require_once("services.inc");
......
...@@ -32,6 +32,7 @@ require_once("openvpn.inc"); ...@@ -32,6 +32,7 @@ require_once("openvpn.inc");
require_once("services.inc"); require_once("services.inc");
require_once("filter.inc"); require_once("filter.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("util.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("openvpn-client-export.inc"); require_once("openvpn-client-export.inc");
......
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