something of interest to gated users

Paul A Vixie paul at
Thu Oct 23 19:07:32 UTC 1997

i know that programming is passe, and i apologize for not being able to
think of any good political statements to make here, but if you're running
bgp via gated and you'd like to know which of your peers are misconfigured,
the following perl script may be of help.  change $us as appropriate.  note
that you need "traceoptions state detail send open recv open" in your bgp
declaration, and the script below wants your gated.log file as input.


$us = "";

while (<>) {
        next unless /^\w\w\w \d\d (\d\d\:\d\d\:\d\d)\s+/o;
        ($ts, $_) = ($1, $');
        if (/^BGP RECV /o) {
                $_ = $';
                if (/^((\d+\.){3}\d+)\+\d+ \-\> ((\d+\.){3}\d+)\+\d+$/) {
                        ($outer_ts, $their_ip, $our_ip) = ($ts, $1, $3);
                }elsif (/^version 4 as (\d+) holdtime \d+ id ((\d+\.){3}\d+)/){
                        if ($ts eq $outer_ts) {
                                ($as, $id) = ($1, $2);
        } elsif (/bgp_pp_recv\: no group for ((\d+\.){3}\d+)\+\d+/) {
                if ($ts eq $outer_ts && $our_ip eq $us) {
                        $_ = sprintf("as %5d ip %15s id %15s",
                                     $as, $their_ip, $id);
                        $result{$_} = $ts;

while (($key,$val) = each %result) {
        print "$val: $key\n";

exit 0;

More information about the NANOG mailing list