[13011] in North American Network Operators' Group

home help back first fref pref prev next nref lref last post

something of interest to gated users

daemon@ATHENA.MIT.EDU (Paul A Vixie)
Thu Oct 23 15:18:39 1997

To: nanog@merit.edu
Date: Thu, 23 Oct 1997 12:07:32 -0700
From: Paul A Vixie <paul@vix.com>

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.

#!/usr/bin/perl

$us = "204.152.184.134";

while (<>) {
        chop;
        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;

home help back first fref pref prev next nref lref last post