diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-04-25 18:10:03 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-04-25 18:10:03 +0000 |
commit | 5928bd75d7c7cd31ab8fd06a111bc1805204e51a (patch) | |
tree | fc6af7a5de51f2d54f8646da1a95b599c893ec19 /etc | |
parent | 975a40ccc31962ff51b9215353f9227d4f3ade09 (diff) | |
download | pfsense-5928bd75d7c7cd31ab8fd06a111bc1805204e51a.zip pfsense-5928bd75d7c7cd31ab8fd06a111bc1805204e51a.tar.gz |
Add is_private_ip function which will return true if an ip address falls within a private subnet range.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 0c4f17f..f84beb0 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -33,6 +33,29 @@ * */ +/****f* pfsense-utils/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", + "172.16.0.0/12", + "192.168.0.0/16", + "99.0.0.0/8" + ); + foreach($ip_private_list as $private) { + if(ip_in_subnet($iptocheck,$private)==true) + $isprivate = true; + } + return $isprivate; +} + /****f* pfsense-utils/get_tmp_file * NAME * get_tmp_file |