summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-10-23 14:16:37 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-10-23 14:16:37 -0400
commit58ebf6bbbcb952e1ae3108e455f4705e7f9f9311 (patch)
treedcea3ab33dbc2e1e7d9621407680b6f72394bafd /etc
parent00380613e89b0be2ad2b15a02003196eff7ea4d1 (diff)
downloadpfsense-58ebf6bbbcb952e1ae3108e455f4705e7f9f9311.zip
pfsense-58ebf6bbbcb952e1ae3108e455f4705e7f9f9311.tar.gz
Setting the VIP to the VHID ID has to be the
single most brain-headed decision in the history of man-kind. Do this correctly by finding the first available vip interface.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/interfaces.inc37
1 files changed, 26 insertions, 11 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 5d93228..bdb8752 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1127,12 +1127,21 @@ function interface_reload_carps($cif) {
}
}
+// Returns the first available vhid interface
+function find_next_available_vip() {
+ for($x=0; $x<9999; $x++) {
+ if(!does_interface_exist("vip{$x}"))
+ return "vip{$x}";
+ }
+ return false;
+}
+
function interface_carp_configure(&$vip) {
global $config, $g;
if(isset($config['system']['developerspew'])) {
- $mt = microtime();
- echo "interfaces_carp_configure() being called $mt\n";
- }
+ $mt = microtime();
+ echo "interfaces_carp_configure() being called $mt\n";
+ }
if ($vip['mode'] != "carp")
return;
@@ -1141,17 +1150,23 @@ function interface_carp_configure(&$vip) {
$vip_password = str_replace(" ", "", $vip_password);
if ($vip['password'] != "")
$password = " pass \"" . $vip_password . "\"";
- $vipif = "vip" . $vip['vhid'];
+
+ // Setting the VIP to the VHID ID has to be the
+ // single most brain-headed decision in the history
+ // of man-kind. Do this correctly by finding the first
+ // available vip interface.
+ $vipif = find_next_available_vip();
+
$interface = interface_translate_type_to_real($vip['interface']);
/*
* ensure the interface containing the VIP really exists
- * prevents a panic if the interface is missing or invalid
- */
- $realif = get_real_interface($vip['interface']);
- if (!does_interface_exist($realif)) {
- file_notice("CARP", "Interface specified for the virtual IP address {$vip['subnet']} does not exist. Skipping this VIP.", "Firewall: Virtual IP", "");
- return;
- }
+ * prevents a panic if the interface is missing or invalid
+ */
+ $realif = get_real_interface($vip['interface']);
+ if (!does_interface_exist($realif)) {
+ file_notice("CARP", "Interface specified for the virtual IP address {$vip['subnet']} does not exist. Skipping this VIP.", "Firewall: Virtual IP", "");
+ return;
+ }
/* ensure CARP IP really exists prior to loading up */
/* XXX: this can be bound to only the interface choosen in the carp creation. Not yet since upgrade is needed! */
OpenPOWER on IntegriCloud