Mercurial > hg > anonet-resdb
annotate doc/ucis.ano/bgp_graph/bgp_path_list_bird.php @ 937:dfb7ded25d66 draft
updated ns1.wakawaka.ano ip
author | wakawaka <nobody@nowhere> |
---|---|
date | Tue, 13 Mar 2012 22:31:30 +0000 |
parents | d44b9afb4a25 |
children |
rev | line source |
---|---|
28 | 1 #!/usr/bin/php |
2 <?php | |
32
d44b9afb4a25
fixed last two of UFO's scripts to take local ASN from env
Nick <nick@somerandomnick.ano>
parents:
28
diff
changeset
|
3 $mynode = array_key_exists('LOCALNODE',$_SERVER)?$_SERVER['LOCALNODE']:0; |
28 | 4 |
5 $fds = NULL; | |
6 $proc = proc_open('birdc', array(0 => array('pipe','r'), 1 => array('pipe','w'), 2 => STDERR), $fds); | |
7 fwrite($fds[0], "show route all\n"); | |
8 fclose($fds[0]); | |
9 $paths = array(); | |
10 | |
11 while (!feof($fds[1])) { | |
12 $line = stream_get_line($fds[1], 1024, "\n"); | |
13 if ($line === NULL || $line === FALSE) break; | |
14 if (!strlen($line) || $line[0] != "\t") continue; | |
15 if (substr($line, 0, 14) != "\tBGP.as_path: ") continue; | |
16 $path = substr($line, 14); | |
17 if (in_array($path, $paths)) continue; | |
18 $paths[] = $path; | |
19 print($mynode.' '.$path."\n"); | |
20 } |