Skip to content

Commit

Permalink
add option to skip paths from an AS to itself
Browse files Browse the repository at this point in the history
can be used to suppress self-references when an AS prepends itself
to pathes to lower their importance
  • Loading branch information
mmitch committed Apr 6, 2015
1 parent 24dff2d commit 2a04b57
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vtysh_scanner
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#
# vtysh_scanner - print a network graph of routing information
#
# Copyright (C) 2011,2014 Christian Garbs <mitch@cgarbs.de>
# Copyright (C) 2011,2014,2015 Christian Garbs <mitch@cgarbs.de>
# Licensed under GNU GPL 3 or later.
#
use strict;
use warnings;

### global configuration
my $SSH = '';
my $ALLOW_SELF = 1; # set to 0 to remove self-references, eg. in lines like AS1 AS2 AS2 AS2 AS3 skip the 'AS2 AS2' pairs

### subroutines

Expand Down Expand Up @@ -143,7 +144,11 @@ foreach my $neighbor (@neighbors)
if (defined $last_as)
{
my ($from, $to) = sort ($as, $last_as);
$peering{"$from:$to"}++;
# skip self-references (eg. prepended paths to downgrade a route)
if ($ALLOW_SELF or $from ne $to)
{
$peering{"$from:$to"}++;
}
}
$as{$as}++;
$last_as = $as;
Expand Down

0 comments on commit 2a04b57

Please sign in to comment.