summaryrefslogtreecommitdiffstats
path: root/etc/inc/interfaces.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-06-14 11:36:20 +0000
committerErmal <eri@pfsense.org>2011-06-14 11:36:20 +0000
commit2708a5cf1648c6d776588e0e4b9be1b6aad65994 (patch)
tree51d639572598ff1b11655e6b186b0973341cf93a /etc/inc/interfaces.inc
parent7905df983103f1288fb22f6db192f3de64a0daa2 (diff)
downloadpfsense-2708a5cf1648c6d776588e0e4b9be1b6aad65994.zip
pfsense-2708a5cf1648c6d776588e0e4b9be1b6aad65994.tar.gz
NEw functiong does_vip_exist() which works for carp and ipalias type vips to help in carp sync issues. Fixes #1598
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r--etc/inc/interfaces.inc35
1 files changed, 35 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 22a88a8..ee171af 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -84,6 +84,41 @@ function does_interface_exist($interface) {
return false;
}
+/*
+ * does_vip_exist($vip): return true or false if a vip is
+ * configured.
+ */
+function does_vip_exist($vip) {
+ global $config;
+
+ if(!$vip)
+ return false;
+
+ $realif = get_real_interface($vip['interface']);
+ $ints = get_interface_arr(true);
+ if (in_array($realif, $ints))
+ return true;
+ else
+ return false;
+
+ switch ($vip['type']) {
+ case "carp":
+ case "carpdev":
+ case "ipalias":
+ $ifacedata = pfSense_getall_interface_addresses($realif);
+ foreach ($ifacedata as $vipips) {
+ if ($vipips == "{$vip['subnet']}/{$vip['subnet_bits']}")
+ return true;
+ }
+ break;
+ case "proxyarp":
+ /* XXX: Implement this */
+ break;
+ }
+
+ return false;
+}
+
function interface_netgraph_needed($interface = "wan") {
global $config;
OpenPOWER on IntegriCloud