diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-11-10 12:38:56 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-11-10 12:38:56 +0000 |
commit | 564df7c2e1fe863c80c08a85b87edededfe52827 (patch) | |
tree | 37870ced4cb90e082b21fb6eaa906b1720542944 /etc/inc/interfaces.inc | |
parent | 9eb60dcc6f9ea2004ff491eb83db548cd593e900 (diff) | |
download | pfsense-564df7c2e1fe863c80c08a85b87edededfe52827.zip pfsense-564df7c2e1fe863c80c08a85b87edededfe52827.tar.gz |
Previous commit on carp was strange and breaking the distinction and usefulness of some functions.
Make sure that the behaviour returns to the previous architecture and to keep things right.
Carp needs some more work on handling the interface as all other interfaces, but that needs an upgrade path too.
Leave it for some other time.
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 605e44f..97ca071 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2177,6 +2177,16 @@ function convert_real_interface_to_friendly_interface_name($interface = "wan") { return "opt{$index}"; else return "wan"; + } else if (stristr($interface, "vip")) { + $index = substr($interface, 3); + $counter = 0; + foreach ($config['virtualip']['vip'] as $vip) { + if ($vip['mode'] == "carpdev-dhcp" || $vip['mode'] == "carp") { + if (intval($index) == $counter) + return $vip['interface']; + $counter++; + } + } } else if (stristr($interface, "carp")) { $index = substr($interface, 4); $counter = 0; @@ -2424,7 +2434,7 @@ function find_carp_interface($ip) { if (is_array($config['virtualip']['vip'])) { foreach ($config['virtualip']['vip'] as $vip) { if ($vip['mode'] == "carp" || $vip['mode'] == "carpdev") { - $carp_ip = find_interface_ip($vip['interface']); + $carp_ip = get_interface_ip($vip['interface']); $if = `ifconfig | grep '$ip' -B1 | head -n1 | cut -d: -f1`; if ($if) return $if; @@ -2439,7 +2449,7 @@ function link_carp_interface_to_parent($interface) { if ($interface == "") return; - $carp_ip = find_interface_ip($interface); + $carp_ip = get_interface_ip($interface); if (!is_ipaddr($carp_ip)) return; @@ -2533,9 +2543,6 @@ function find_interface_ip($interface, $flush = false) $interface = str_replace("\n", "", $interface); if (does_interface_exist($interface) == false) - $interface = convert_friendly_interface_to_real_interface_name($interface); - - if (does_interface_exist($interface) == false) return; /* Setup IP cache */ @@ -2569,6 +2576,8 @@ function get_interface_ip($interface = "wan") if (!$realif) { if (preg_match("/^carp/i", $interface)) $realif = $interface; + else if (preg_match("/^vip/i", $interface)) + $realif = $interface; else return null; } @@ -2590,6 +2599,8 @@ function get_interface_subnet($interface = "wan") if (!$realif) { if (preg_match("/^carp/i", $interface)) $realif = $interface; + else if (preg_match("/^vip/i", $interface)) + $realif = $interface; else return null; } @@ -2800,4 +2811,4 @@ function setup_pppoe_reset_file($interface, $status) { unlink_if_exists(CRON_PPPOE_CMD_FILE); } -?>
\ No newline at end of file +?> |