</tr> </thead> <tbody> <?php if (is_array($config['virtualip']['vip'])) { $carpint = 0; foreach ($config['virtualip']['vip'] as $carp) { if ($carp['mode'] != "carp") { continue; } $ipaddress = $carp['subnet']; $password = $carp['password']; $netmask = $carp['subnet_bits']; $vhid = $carp['vhid']; $advskew = $carp['advskew']; $status = get_carp_interface_status("_vip{$carp['uniqid']}"); ?> <tr> <td> <a href="/system_hasync.php"> <?php echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($carp['interface']) . "@{$vhid}"); ?> </a> </td> <?php if ($carp_enabled == false) { $icon = 'times-circle'; $status = "DISABLED"; } else { if ($status == "MASTER") {
$carp_enabled = get_carp_status(); ?> <table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0" summary="carp status"> <?php if (is_array($config['virtualip']['vip'])) { $carpint = 0; foreach ($config['virtualip']['vip'] as $carp) { if ($carp['mode'] != "carp") { continue; } $ipaddress = $carp['subnet']; $password = $carp['password']; $netmask = $carp['subnet_bits']; $vhid = $carp['vhid']; $advskew = $carp['advskew']; $status = get_carp_interface_status("{$carp['interface']}_vip{$vhid}"); ?> <tr> <td class="vncellt" width="35%"> <img src="./themes/<?php echo $g['theme']; ?> /images/icons/icon_cablenic.gif" alt="cablenic" /> <strong><a href="/system_hasync.php"> <span style="color:#000000"><?php echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($carp['interface']) . "@{$vhid}"); ?> </span></a></strong> </td> <td width="65%" class="listr"> <?php
if ($carpcount == 0) { ?> <tr> <td colspan="3"><?php echo gettext("Could not locate any defined CARP interfaces."); ?> </td> </tr> <?php } else { foreach ($a_vip as $carp) { if ($carp['mode'] != "carp") { continue; } $icon = ""; $intf_status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}"); if ($carpcount > 0 && $status) { $icon = "glyphicon glyphicon-remove text-danger"; $intf_status = "DISABLED"; } elseif ($intf_status == "MASTER") { $icon = "glyphicon glyphicon-play text-success"; } elseif ($intf_status == "BACKUP") { $icon = "glyphicon glyphicon-play text-muted"; } elseif ($intf_status == "INIT") { $icon = "glyphicon glyphicon-info-sign"; } ?> <tr> <td><?php echo convert_friendly_interface_to_friendly_descr($carp['interface']) . "@{$carp['vhid']}"; ?>
function get_carp_stats() { global $g; global $config; if (is_array($config['virtualip']['vip'])) { $carpint = 0; $initcount = 0; $mastercount = 0; $backupcount = 0; foreach ($config['virtualip']['vip'] as $carp) { if ($carp['mode'] != "carp") { continue; } $ipaddress = $carp['subnet']; $password = $carp['password']; $netmask = $carp['subnet_bits']; $vhid = $carp['vhid']; $advskew = $carp['advskew']; $carp_int = find_carp_interface($ipaddress); $status = get_carp_interface_status($carp_int); switch ($status) { case "MASTER": $mastercount++; break; case "BACKUP": $backupcount++; break; case "INIT": $initcount++; break; } } $status = "M/B/I {$mastercount}/{$backupcount}/{$initcount}"; } else { $status = "CARP Disabled"; } return $status; }
echo "</body></html>"; exit; } if (is_array($config['virtualip']['vip'])) { foreach ($config['virtualip']['vip'] as $carp) { if ($carp['mode'] != "carp") { continue; } $ipaddress = $carp['subnet']; $password = $carp['password']; $netmask = $carp['subnet_bits']; $vhid = $carp['vhid']; $advskew = $carp['advskew']; $advbase = $carp['advbase']; $carp_int = "{$carp['interface']}_vip{$vhid}"; $status = get_carp_interface_status($carp_int); echo "<tr>"; $align = "valign='middle'"; if ($carp_enabled == false) { $icon = "<img {$align} src='/themes/" . $g['theme'] . "/images/icons/icon_block.gif'>"; $status = "DISABLED"; } else { if ($status == "MASTER") { $icon = "<img {$align} src='/themes/" . $g['theme'] . "/images/icons/icon_pass.gif'>"; } else { if ($status == "BACKUP") { $icon = "<img {$align} src='/themes/" . $g['theme'] . "/images/icons/icon_pass_d.gif'>"; } else { if ($status == "INIT") { $icon = "<img {$align} src='/themes/" . $g['theme'] . "/images/icons/icon_log.gif'>"; }
function outputled_carp() { /* Returns the status of CARP for the box. Assumes ALL CARP status are the same for all the intefaces. -1 = CARP Disabled 0 = CARP on Backup 1 = CARP on Master */ global $g; global $config; if (is_array($config['virtualip']['vip'])) { $carpint = 0; foreach ($config['virtualip']['vip'] as $carp) { if ($carp['mode'] != "carp") { continue; } $carp_int = find_carp_interface($carp['subnet']); $status = get_carp_interface_status($carp_int); switch ($status) { case "MASTER": return 1; break; case "BACKUP": return 0; break; } } } else { return -1; } }