Mercurial > hg > anonet-resdb
diff doc/ucis.ano/bgp_graph/bgp_path_list_quagga.php @ 28:4dbe5bf653bb draft
Added bgp graph scripts
author | ivo <ivo@UFO-Net.nl> |
---|---|
date | Thu, 10 Jun 2010 00:15:51 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/ucis.ano/bgp_graph/bgp_path_list_quagga.php Thu Jun 10 00:15:51 2010 +0200 @@ -0,0 +1,16 @@ +#!/usr/bin/php +<?php +$sock = fsockopen('localhost', 2605); +fread($sock, 1024); +fwrite($sock, "insecure\n"); +fwrite($sock, "show ip bgp paths\n"); +fwrite($sock, "quit\n"); +while (!feof($sock)) { + $line = stream_get_line($sock, 1024, "\r\n"); + if ($line === NULL || $line === FALSE) break; + if (!strlen($line) || $line[0] != '[') continue; + $pos = strpos($line, ') '); + if ($pos === FALSE) continue; + if ($pos == strlen($line) - 2) continue; + print(substr($line, $pos+2)."\n"); +}