NAME

Net::BGPdump - Perl extension for libBGPdump

SYNOPSIS

use Net::BGPdump qw( :all );

my $io = bgp_open($file, msgtype => BGP_MSG_UPDATE);

while (<$io>) {
  print "TIME: $_->{time}\n";
  print "TYPE: $_->{type}\n";
  printf("FROM: %s AS%d\n", $_->{from_addr}, $_->{from_as});
  printf("TO: %s AS%d\n", $_->{to_addr}, $_->{to_as});
  print "ORIGIN: $_->{origin}\n";
  print "ASPATH: $_->{as_path}\n";
  print "NEXT_HOP: $_->{next_hop}\n";
  if ($_->{announce}) {
    print "ANNOUNCE\n";
    for my $cidr (@{$_->{announce}}) {
      print "  $cidr\n";
    }
  }
  if ($_->{withdraw}) {
    print "WITHDRAW\n";
    for my $cidr (@{$_->{withdraw}}) {
      print "  $cidr\n";
    }
  }
}

DESCRIPTION

Net::PGPDump is a perl extension for libBGPdump, a C library designed to help with analyzing dump files produced by Zebra/Quagga or MRT.

The bgpdump library can be found here:

EXPORTS

The following are available via the :const, :func, or :all, export tags, or individually. They can be used with Net::BGPdump::IO objects to filter records.

CONSTANTS

    BGPDUMP_TYPE_MRTD_TABLE_DUMP
    BGPDUMP_TYPE_TABLE_DUMP_V2
    BGPDUMP_TYPE_ZEBRA_BGP
    
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6_32BIT_AS
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP_32BIT_AS
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6_32BIT_AS
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP
    BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP_32BIT_AS
    
    BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE
    BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_AS4
    BGPDUMP_SUBTYPE_ZEBRA_BGP_STATE_CHANGE
    BGPDUMP_SUBTYPE_ZEBRA_BGP_STATE_CHANGE_AS4
    
    BGP_MSG_UPDATE
    BGP_MSG_OPEN
    BGP_MSG_NOTIFY
    BGP_MSG_KEEPALIVE

FUNCTIONS

bgp_open($filename, %opt)

This is a shortcut for invoking Net::BGPdump::IO->open().

Opens a bgpdump file produced by Zebra/Quagga or MRT and returns a Net::BGPdump::IO object. Files can be uncompressed, gzip or bzip2. Use a filename of '-' for reading STDIN.

The following keyword filtering options are accepted.

type
exclude_type

Include or exclude records of the following types:

BGPDUMP_TYPE_MRTD_TABLE_DUMP
BGPDUMP_TYPE_TABLE_DUMP_V2
BGPDUMP_TYPE_ZEBRA_BGP
subtype
exclude_subtype

Include or exclude records of the following subtypes:

BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6
BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6_32BIT_AS
BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP
BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP_32BIT_AS
BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6
BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP6_32BIT_AS
BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP
BGPDUMP_SUBTYPE_MRTD_TABLE_DUMP_AFI_IP_32BIT_AS

BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE
BGPDUMP_SUBTYPE_ZEBRA_BGP_MESSAGE_AS4
BGPDUMP_SUBTYPE_ZEBRA_BGP_STATE_CHANGE
BGPDUMP_SUBTYPE_ZEBRA_BGP_STATE_CHANGE_AS4
msgtype
exclude_msgtype

Include or exclude messages of the following types:

BGP_MSG_UPDATE
BGP_MSG_OPEN
BGP_MSG_NOTIFY
BGP_MSG_KEEPALIVE
ipv6

Include or exclude records involving IPv6 using 1 or 0, respectively.

SEE ALSO

Net::BGPdump::IO

COPYRIGHT & LICENSE

Copyright (C) 2015 by Carnegie Mellon University

Use of the Net-BGPdump library and related source code is subject to the terms of the following licenses:

GNU Public License (GPL) Rights pursuant to Version 2, June 1991 Government Purpose License Rights (GPLR) pursuant to DFARS 252.227.7013

NO WARRANTY

See GPL.txt and LICENSE.txt for more details.