diff --git a/html/pages/device/bgp.inc.php b/html/pages/device/bgp.inc.php index 69504db52..338701968 100644 --- a/html/pages/device/bgp.inc.php +++ b/html/pages/device/bgp.inc.php @@ -24,7 +24,6 @@ print_optionbar_end(); $i = "1"; $peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier"); while($peer = mysql_fetch_array($peer_query)) { - if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } #if($peer['bgpPeerAdminStatus'] == "start") { $img = "images/16/accept.png"; } else { $img = "images/16/delete.png"; } if($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; $bg_colour = "#ffcccc"; } @@ -32,9 +31,13 @@ print_optionbar_end(); if($peer['bgpPeerRemoteAs'] == $device['bgpLocalAs']) { $peer_type = "iBGP"; } else { $peer_type = "eBGP"; } - $peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); + $query = "SELECT * FROM ipv4_addresses AS A, ipv6_addresses AS S, interfaces AS I, devices AS D WHERE "; + $query .= "(A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)"; + $query .= " OR (S.ipv6_compressed = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = S.interface_id)"; + $query .= " AND D.device_id = I.device_id"; + $peerhost = mysql_fetch_array(mysql_query($query)); - if($peerhost) { $peername = generatedevicelink($peerhost); } else { unset($peername); } + if($peerhost) { $peername = generatedevicelink($peerhost); } else { $peername = '' . gethostbyaddr($peer['bgpPeerIdentifier']) . ''; if ($peername == ''.$peer['bgpPeerIdentifier'].'') $peername = "";} $af_query = mysql_query("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '".$peer['bgpPeerIdentifier']."'"); unset($peer_af); @@ -50,7 +53,7 @@ print_optionbar_end(); $i " . $peer['bgpPeerIdentifier'] . "
".$peername." $peer_type - $peer_af + " . (isset($peer_af) ? $peer_af : '') . " AS" . $peer['bgpPeerRemoteAs'] . "
" . $peer['astext'] . " " . $peer['bgpPeerAdminStatus'] . "
" . $peer['bgpPeerState'] . "
" .formatUptime($peer['bgpPeerFsmEstablishedTime']). "
@@ -58,7 +61,7 @@ print_optionbar_end(); " . $peer['bgpPeerOutUpdates'] . ""); - if ($_GET['opta'] && $_GET['opta'] != "macaccounting") { + if (isset($_GET['opta']) && $_GET['opta'] != "macaccounting") { foreach(explode(" ", $_GET['opta']) as $graph_type) { if($graph_type == "cbgp_prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; } if($graph_type == "bgp_updates" || $valid_afi_safi[$afi][$safi]) {