From dc1f46ac2e06f157660ca9155a8c82f901ae2016 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Fri, 26 Nov 2010 17:56:13 +0000 Subject: [PATCH] parsing of ipv6 afi on junos bgp poll/discovery git-svn-id: http://www.observium.org/svn/observer/trunk@1743 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/bgp-peers.inc.php | 5 ++++- includes/polling/bgp-peers.inc.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/discovery/bgp-peers.inc.php b/includes/discovery/bgp-peers.inc.php index 2ac1b117d0..d3b4894a4d 100755 --- a/includes/discovery/bgp-peers.inc.php +++ b/includes/discovery/bgp-peers.inc.php @@ -129,7 +129,10 @@ if (isset($peerlist)) $j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex']; break; case 'ipv6': - # FIXME not implemented yet + $ip6 = trim(str_replace(' ','',$entry['jnxBgpM2PeerRemoteAddr']),'"'); + $ip6 = substr($ip6,0,4) . ':' . substr($ip6,4,4) . ':' . substr($ip6,8,4) . ':' . substr($ip6,12,4) . ':' . substr($ip6,16,4) . ':' . substr($ip6,20,4) . ':' . substr($ip6,24,4) . ':' . substr($ip6,28,4); + $ip6 = Net_IPv6::compress($ip6); + $j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex']; break; default: echo("PANIC: Don't know RemoteAddrType " . $entry['jnxBgpM2PeerRemoteAddrType'] . "!\n"); diff --git a/includes/polling/bgp-peers.inc.php b/includes/polling/bgp-peers.inc.php index 84aeb73835..00e3993e3b 100755 --- a/includes/polling/bgp-peers.inc.php +++ b/includes/polling/bgp-peers.inc.php @@ -170,7 +170,10 @@ if ($device['os'] == "junos") $j_peerIndexes[$ip] = $entry['jnxBgpM2PeerIndex']; break; case 'ipv6': - # FIXME not implemented yet + $ip6 = trim(str_replace(' ','',$entry['jnxBgpM2PeerRemoteAddr']),'"'); + $ip6 = substr($ip6,0,4) . ':' . substr($ip6,4,4) . ':' . substr($ip6,8,4) . ':' . substr($ip6,12,4) . ':' . substr($ip6,16,4) . ':' . substr($ip6,20,4) . ':' . substr($ip6,24,4) . ':' . substr($ip6,28,4); + $ip6 = Net_IPv6::compress($ip6); + $j_peerIndexes[$ip6] = $entry['jnxBgpM2PeerIndex']; break; default: echo("PANIC: Don't know RemoteAddrType " . $entry['jnxBgpM2PeerRemoteAddrType'] . "!\n");