diff options
author | jim-p <jimp@pfsense.org> | 2011-06-14 16:41:15 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-06-14 16:41:15 -0400 |
commit | e49d4564dbf6be680e4d3c91c00a798e390fa358 (patch) | |
tree | cec495f96af3d202a02ee8c4522b076142158424 /etc/inc/interfaces.inc | |
parent | 424be584c34531d52ac0da8a5e954847e158c6cf (diff) | |
parent | 144fbff2a146d9eb3921e763f6bcc7bde39bf5f9 (diff) | |
download | pfsense-e49d4564dbf6be680e4d3c91c00a798e390fa358.zip pfsense-e49d4564dbf6be680e4d3c91c00a798e390fa358.tar.gz |
Merge remote branch 'upstream/master'
Conflicts:
etc/inc/globals.inc
etc/inc/upgrade_config.inc
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 3867c09..ecbb504 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -85,6 +85,46 @@ 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; + + + switch ($vip['mode']) { + case "carp": + case "carpdev": + $realif = "vip{$vip['vhid']}"; + if (!does_interface_exist($realif)) { + return false; + } + break; + case "ipalias": + $realif = get_real_interface($vip['interface']); + if (!does_interface_exist($realif)) { + return false; + } + break; + case "proxyarp": + /* XXX: Implement this */ + default: + return false; + } + + $ifacedata = pfSense_getall_interface_addresses($realif); + foreach ($ifacedata as $vipips) { + if ($vipips == "{$vip['subnet']}/{$vip['subnet_bits']}") + return true; + } + + return false; +} + function interface_netgraph_needed($interface = "wan") { global $config; |