diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-04-25 18:10:46 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-04-25 18:10:46 +0000 |
commit | 2f6fb323933e93ec74265a8b7f785e423144039b (patch) | |
tree | 381931968bb6b7904330a174754036b353c497f3 /etc/inc/pfsense-utils.inc | |
parent | 09662e45caeb190ba672458ce548df3121ff8d71 (diff) | |
download | pfsense-2f6fb323933e93ec74265a8b7f785e423144039b.zip pfsense-2f6fb323933e93ec74265a8b7f785e423144039b.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/inc/pfsense-utils.inc')
-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 587c247..39c4534 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 |