Martin Damgaard Lorensen


Net::BGP::RIBEntry - Class representing an entry in a BGP RIB


    use Net::BGP::RIBEntry;

    # Constructor
    $entry = new Net::BGP::RIBEntry(
        Prefix          => ''

    # Object Copy
    $clone = $entry->clone();

    # Accessor Methods

    $entry           = $entry->update_in($peer,$nlri);
    $has_changed     = $entry->update_local($policy);
    $changes_hashref = $entry->update_out($policy);

    $has_changed     = $entry->handle_changes($policy)

    $prefix          = $entry->prefix($prefix);

    $nlri            = $entry->local;
    $nlri_hashref    = $entry->in;
    $nlri_hashref    = $entry->out;

    $string          = $entry->asstring;


This module implement a class representing an entry in a BGP Routing Information Base. It stores the prefix that the entry represents as well as 3 categories of network layer reachability information (NLRI). Each NLRI is represented as an Net::BGP::NLRI object:

IN - An NLRI object for each peer that has sent an UPDATE regarding this prefix.
Local - The preferred of the policy processed available NLRIs from the IN RIB.
OUT - An NLRI object for each outgoing peer representing the processed Local NLRI.


new() - create a new Net::BGP::RIBEntry object
    $entry = new Net::BGP::RIBEntry(
        Prefix          => ''

This is the constructor for Net::BGP::RIBEntry object. It returns a reference to the newly created object. The following named parameter may be passed to the constructor:


This parameter corresponds to the prefix the RIB Entry represents.


clone() - clone a Net::BGP::RIBEntry object
    $clone = $nlri->clone();

This method creates an exact copy of the Net::BGP::RIBEntry object.



Both add_peer() and remove_peer() takes two arguments: The peer object and the direction of the peer (in or out).


This method updates the RIB IN part of the object. The first argument is the peer object that received the BGP UPDATE message and the second argument is an NLRI object corresponding the received UPDATE message.

The method returns the RIBEntry object.


This method applies the incoming policy and executes the route selection process of BGP. If no arguments (or a undefined value), no policy will be used. Otherwise the argument should be a Net::BGP::Policy object - or something inherited from that.

After applying the given policy, the selection process updates the Local RIB with the best available NLRI.

The return value is true if the Local RIB is changed, otherwise false.


This method applies the outgoing policy to the Local RIB and updates the OUT RIB accordingly. If no arguments (or a undefined value), no policy will be used. Otherwise the argument should be a Net::BGP::Policy object - or something inherited from that.


This method combines the update_local() and update_out() methods and generates UPDATE messages for each change and sends them to the peers. It takes a optional policy as first argument which are used in the calls to update_local() and update_out().

It returns -1 if no changes has happend. Otherwise it returns the number of changes send.


This mothod returns the prefix the RIB Entry represent. It an argument is given, the prefix will be replaced with that value.


This method returns the currently selected NLRI or undefined if no NLRIs are available.


Both the in() and out() method returns a reference to a hash indexed on peers containing Net::BGP::NLRI objects coresponding the the incoming or outgoing UPDATE message data.


This method returns a print-friendly string describing the RIB entry.


Net::BGP, Net::BGP::RIB, Net::BGP::NLRI, Net::BGP::Update, Net::BGP::Policy


Martin Lorensen <>