From 474f36d1b277b3e0732496bf0ca8aa1659710809 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 25 May 2011 18:00:54 -0400 Subject: * Add is_ipaddr_configured() so that people do not need to reinvent the wheel for this task * Check to make sure the administrator is not entering the IP address of the same host preventing a issue where the firewall will sync the voucher database to itself and cause the webConfigurator to crash. --- etc/inc/interfaces.inc | 2 +- etc/inc/pfsense-utils.inc | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 393833f..63f380a 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3728,4 +3728,4 @@ function get_vip_descr($ipaddress) { return ""; } -?> +?> \ No newline at end of file diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index ca16634..a673685 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -2207,4 +2207,21 @@ function load_mac_manufacturer_table() { } -?> +/****f* pfsense-utils/is_ipaddr_configured + * NAME + * is_ipaddr_configured + * INPUTS + * IP Address to check. + * RESULT + * returns true if the IP Address is + * configured and present on this device. +*/ +function is_ipaddr_configured($ipaddr) { + $interface_list_ips = get_configured_ip_addresses(); + foreach($interface_list_ips as $ilips) { + if(strcasecmp($ipaddr, $ilips) == 0) + return true; + } +} + +?> \ No newline at end of file -- cgit v1.1