xorp

BGPMain Class Reference

Inheritance diagram for BGPMain:
ServiceBase IfMgrHintObserver ServiceChangeObserverBase BugCatcher

List of all members.

Classes

class  RoutingTableToken
 Token generator to map between unicast and multicast. More...
struct  Server
 Store the socket descriptor and iptuple together. More...

Public Types

typedef XorpCallback2< void,
const string &, bool >::RefPtr 
InterfaceStatusCb
typedef XorpCallback3< void,
const string &, const string
&, bool >::RefPtr 
VifStatusCb
typedef XorpCallback5< void,
const string &, const string
&, const IPv4 &, uint32_t,
bool >::RefPtr 
AddressStatus4Cb

Public Member Functions

 BGPMain (EventLoop &eventloop)
ProcessStatus status (string &reason)
 Get the process status.
int startup ()
 Startup operation.
int shutdown ()
 Shutdown operation.
void component_up (const string &component_name)
 A method that should be called when an internal subsystem comes up.
void component_down (const string &component_name)
 A method that should be called when an internal subsystem goes down.
bool is_interface_enabled (const string &interface) const
 Test whether an interface is enabled.
bool is_vif_enabled (const string &interface, const string &vif) const
 Test whether an interface/vif is enabled.
bool is_address_enabled (const string &interface, const string &vif, const IPv4 &address) const
 Test whether an IPv4 interface/vif/address is enabled.
void register_interface_status (InterfaceStatusCb cb)
 Add a callback for tracking the interface status.
void register_vif_status (VifStatusCb cb)
 Add a callback for tracking the interface/vif status.
void register_address_status (AddressStatus4Cb cb)
 Add a callback for tracking the IPv4 interface/vif/address status.
uint32_t get_prefix_length (const string &interface, const string &vif, const IPv4 &address)
 Obtain the subnet prefix length for an IPv4 interface/vif/address.
uint32_t get_mtu (const string &interface)
 Obtain the MTU for an interface.
bool interface_address4 (const IPv4 &address) const
 Is the address one of this routers interface addresses?
bool interface_address_prefix_len4 (const IPv4 &address, uint32_t &prefix_len) const
 Obtain the prefix length for a particular IPv4 address.
void local_config (const uint32_t &as, const IPv4 &id, bool use_4byte_asnums)
 Set the local configuration.
void set_confederation_identifier (const uint32_t &as, bool disable)
 Set or disable the confederation identifier.
void set_cluster_id (const IPv4 &cluster_id, bool disable)
 Set the cluster ID and enable or disable route reflection.
void set_damping (uint32_t half_life, uint32_t max_suppress, uint32_t reuse, uint32_t suppress, bool disable)
 Set the route flap damping parameters.
void attach_peer (BGPPeer *p)
 attach peer to peerlist
void detach_peer (BGPPeer *p)
 detach peer from the peerlist.
void attach_deleted_peer (BGPPeer *p)
 attach peer to deleted peerlist
void detach_deleted_peer (BGPPeer *p)
 detach peer from the deleted peerlist.
BGPPeerfind_peer (const Iptuple &search, list< BGPPeer * > &peers)
 Find peer with this iptuple from the list provided.
BGPPeerfind_peer (const Iptuple &search)
 Find peer with this iptuple.
BGPPeerfind_deleted_peer (const Iptuple &search)
 Find peer with this iptuple on the deleted peer list.
bool create_peer (BGPPeerData *pd)
 create a new peer and attach it to the peerlist.
bool delete_peer (const Iptuple &iptuple)
 delete peer tear down connection and remove for peerlist.
bool enable_peer (const Iptuple &iptuple)
 enable peer
bool disable_peer (const Iptuple &iptuple)
 disable peer
bool bounce_peer (const Iptuple &iptuple)
 Drop this peering and if it was configured up allow it attempt a new peering.
void local_ip_changed (string local_address)
 One of the local IP addresses of this router has changed.
bool change_tuple (const Iptuple &iptuple, const Iptuple &nptuple)
 Change one of the tuple settings of this peering.
bool find_tuple_179 (string peer_addr, Iptuple &otuple)
 Find the tuple that has this peer address and both ports are 179.
bool change_local_ip (const Iptuple &iptuple, const string &local_ip, const string &local_dev)
 Change the local IP address of this peering.
bool change_local_port (const Iptuple &iptuple, uint32_t local_port)
 Change the local IP port of this peering.
bool change_peer_port (const Iptuple &iptuple, uint32_t peer_port)
 Change the peer IP port of this peering.
bool set_peer_as (const Iptuple &iptuple, uint32_t peer_as)
 set peer as
bool set_holdtime (const Iptuple &iptuple, uint32_t holdtime)
 set holdtime
bool set_delay_open_time (const Iptuple &iptuple, uint32_t delay_open_time)
 set delay open time
bool set_route_reflector_client (const Iptuple &iptuple, bool rr)
 set route reflector client
bool set_confederation_member (const Iptuple &iptuple, bool conf)
 set route confederation member
bool set_prefix_limit (const Iptuple &iptuple, uint32_t maximum, bool state)
 set prefix limit
bool set_nexthop4 (const Iptuple &iptuple, const IPv4 &next_hop)
 set IPv4 next-hop.
bool set_peer_state (const Iptuple &iptuple, bool state)
 Set peer state.
bool activate (const Iptuple &iptuple)
 Activate peer.
bool activate_all_peers ()
 Activate all peers.
bool set_peer_md5_password (const Iptuple &iptuple, const string &password)
 Set peer TCP-MD5 password.
bool next_hop_rewrite_filter (const Iptuple &iptuple, const IPv4 &next_hop)
bool get_peer_list_start (uint32_t &token)
bool get_peer_list_next (const uint32_t &token, string &local_ip, uint32_t &local_port, string &peer_ip, uint32_t &peer_port)
bool get_peer_id (const Iptuple &iptuple, IPv4 &peer_id)
bool get_peer_status (const Iptuple &iptuple, uint32_t &peer_state, uint32_t &admin_status)
bool get_peer_negotiated_version (const Iptuple &iptuple, int32_t &neg_version)
bool get_peer_as (const Iptuple &iptuple, uint32_t &peer_as)
bool get_peer_msg_stats (const Iptuple &iptuple, uint32_t &in_updates, uint32_t &out_updates, uint32_t &in_msgs, uint32_t &out_msgs, uint16_t &last_error, uint32_t &in_update_elapsed)
bool get_peer_established_stats (const Iptuple &iptuple, uint32_t &transitions, uint32_t &established_time)
bool get_peer_timer_config (const Iptuple &iptuple, uint32_t &retry_interval, uint32_t &hold_time, uint32_t &keep_alive, uint32_t &hold_time_configured, uint32_t &keep_alive_configured, uint32_t &min_as_origination_interval, uint32_t &min_route_adv_interval)
bool register_ribname (const string &name)
void main_loop ()
void terminate ()
XorpFd create_listener (const Iptuple &iptuple)
LocalDataget_local_data ()
void start_server (const Iptuple &iptuple)
void stop_server (const Iptuple &iptuple)
void stop_all_servers ()
 Stop listening for incoming connections.
bool originate_route (const IPv4Net &nlri, const IPv4 &next_hop, const bool &unicast, const bool &multicast, const PolicyTags &policytags)
 Originate an IPv4 route.
bool withdraw_route (const IPv4Net &nlri, const bool &unicast, const bool &multicast) const
 Withdraw an IPv4 route.
template<typename A >
bool get_route_list_start (uint32_t &token, const IPNet< A > &prefix, const bool &unicast, const bool &multicast)
template<typename A >
bool get_route_list_next (const uint32_t &token, IPv4 &peer_id, IPNet< A > &net, uint32_t &origin, vector< uint8_t > &aspath, A &nexthop, int32_t &med, int32_t &localpref, int32_t &atomic_agg, vector< uint8_t > &aggregator, int32_t &calc_localpref, vector< uint8_t > &attr_unknown, bool &best, bool &unicast, bool &multicast)
bool rib_client_route_info_changed4 (const IPv4 &addr, const uint32_t &prefix_len, const IPv4 &nexthop, const uint32_t &metric)
bool rib_client_route_info_invalid4 (const IPv4 &addr, const uint32_t &prefix_len)
bool set_parameter (const Iptuple &iptuple, const string &parameter, const bool toggle)
 set parameter
BGPPlumbingplumbing_unicast () const
 Originally inserted for testing.
BGPPlumbingplumbing_multicast () const
XrlStdRouterget_router ()
EventLoopeventloop ()
XrlBgpTargetget_xrl_target ()
void notify_birth (const string &target_class, const string &target_instance)
 Call via XrlBgpTarget when the finder reports that a process has started.
void notify_death (const string &target_class, const string &target_instance)
 Call via XrlBgpTarget when the finder reports that a process has terminated.
bool processes_ready ()
string bgp_mib_name () const
bool do_snmp_trap () const
 Check to see if the bgp snmp entity is running.
void finder_death (const char *file, const int lineno)
 To be called when the finder dies.
void configure_filter (const uint32_t &filter, const string &conf)
 Configure a policy filter.
void reset_filter (const uint32_t &filter)
 Reset a policy filter.
void push_routes ()
 Push routes through policy filters for re-filtering.
Profileprofile ()
 IPv6 stuff.

Private Member Functions

void status_change (ServiceBase *service, ServiceStatus old_status, ServiceStatus new_status)
 A method invoked when the status of a service changes.
const ServiceBaseifmgr_mirror_service_base () const
 Obtain a pointer to the interface manager service base.
const IfMgrIfTreeifmgr_iftree () const
 Obtain a reference to the interface manager's interface tree.
void tree_complete ()
 An IfMgrHintObserver method invoked when the initial interface tree information has been received.
void updates_made ()
 An IfMgrHintObserver method invoked whenever the interface tree information has been changed.
void address_status_change4 (const string &interface, const string &vif, const IPv4 &source, uint32_t prefix_len, bool state)
 Callback method that is invoked when the status of an address changes.
void connect_attempt (XorpFd fd, IoEventType type, string laddr, uint16_t lport)
 Callback method called when a connection attempt is made.
template<typename A >
void extract_attributes (PAListRef< A > attributes, uint32_t &origin, vector< uint8_t > &aspath, A &nexthop, int32_t &med, int32_t &localpref, int32_t &atomic_agg, vector< uint8_t > &aggregator, int32_t &calc_localpref, vector< uint8_t > &attr_unknown)
template<typename A >
RoutingTableToken< A > & get_token_table ()

Private Attributes

list< Server_serverfds
EventLoop_eventloop
bool _exit_loop
BGPPeerList_peerlist
BGPPeerList_deleted_peerlist
BGPPlumbing_plumbing_unicast
 Unicast Routing Table.
NextHopResolver< IPv4 > * _next_hop_resolver_ipv4
BGPPlumbing_plumbing_multicast
 Multicast Routing Table.
RoutingTableToken< IPv4_table_ipv4
XrlBgpTarget_xrl_target
RibIpcHandler_rib_ipc_handler
AggregationHandler_aggregation_handler
LocalData_local_data
XrlStdRouter_xrl_router
ProcessWatch_process_watch
VersionFilters _policy_filters
Profile _profile
size_t _component_count
IfMgrXrlMirror_ifmgr
bool _is_ifmgr_ready
IfMgrIfTree _iftree
InterfaceStatusCb _interface_status_cb
VifStatusCb _vif_status_cb
AddressStatus4Cb _address_status4_cb
map< IPv4, uint32_t > _interfaces_ipv4
bool _first_policy_push

Member Function Documentation

bool BGPMain::activate ( const Iptuple iptuple)

Activate peer.

Enable the peering based on the peer state.

Parameters:
iptupleiptuple.

@ return true on success.

bool BGPMain::activate_all_peers ( )

Activate all peers.

Returns:
true on success
void BGPMain::attach_deleted_peer ( BGPPeer p)

attach peer to deleted peerlist

Parameters:
pBGP peer.
void BGPMain::attach_peer ( BGPPeer p)

attach peer to peerlist

Parameters:
pBGP peer.
string BGPMain::bgp_mib_name ( ) const [inline]
Returns:
Return the bgp mib name.
bool BGPMain::bounce_peer ( const Iptuple iptuple)

Drop this peering and if it was configured up allow it attempt a new peering.

Parameters:
iptupleiptuple.
Returns:
true on success
bool BGPMain::change_local_ip ( const Iptuple iptuple,
const string &  local_ip,
const string &  local_dev 
)

Change the local IP address of this peering.

Parameters:
iptupleiptuple.
local_ipnew IP value
local_devnew Interface value.
Returns:
true on success
bool BGPMain::change_local_port ( const Iptuple iptuple,
uint32_t  local_port 
)

Change the local IP port of this peering.

Parameters:
iptupleiptuple.
local_portnew value.
Returns:
true on success
bool BGPMain::change_peer_port ( const Iptuple iptuple,
uint32_t  peer_port 
)

Change the peer IP port of this peering.

Parameters:
iptupleiptuple.
peer_portnew value.
Returns:
true on success
bool BGPMain::change_tuple ( const Iptuple iptuple,
const Iptuple nptuple 
)

Change one of the tuple settings of this peering.

Parameters:
iptupleoriginal tuple.
iptuplenew tuple.
Returns:
true on success
void BGPMain::component_down ( const string &  component_name)

A method that should be called when an internal subsystem goes down.

Parameters:
component_namethe name of the component.
void BGPMain::component_up ( const string &  component_name)

A method that should be called when an internal subsystem comes up.

Parameters:
component_namethe name of the component.
void BGPMain::configure_filter ( const uint32_t &  filter,
const string &  conf 
)

Configure a policy filter.

Parameters:
filterId of filter to configure.
confConfiguration of filter.
bool BGPMain::create_peer ( BGPPeerData pd)

create a new peer and attach it to the peerlist.

Parameters:
pdBGP peer data.
Returns:
true on success
bool BGPMain::delete_peer ( const Iptuple iptuple)

delete peer tear down connection and remove for peerlist.

XrlBgpTarget xbt(bgp.get_router(), bgp);

Parameters:
iptupleiptuple.
Returns:
true on success
void BGPMain::detach_deleted_peer ( BGPPeer p)

detach peer from the deleted peerlist.

Parameters:
pBGP peer.
void BGPMain::detach_peer ( BGPPeer p)

detach peer from the peerlist.

Parameters:
pBGP peer.
bool BGPMain::disable_peer ( const Iptuple iptuple)

disable peer

Parameters:
iptupleiptuple.
Returns:
true on success
bool BGPMain::enable_peer ( const Iptuple iptuple)

enable peer

Parameters:
iptupleiptuple.
Returns:
true on success
BGPPeer * BGPMain::find_deleted_peer ( const Iptuple search)

Find peer with this iptuple on the deleted peer list.

Parameters:
searchiptuple.
Returns:
A pointer to a peer if one is found NULL otherwise.
BGPPeer * BGPMain::find_peer ( const Iptuple search,
list< BGPPeer * > &  peers 
)

Find peer with this iptuple from the list provided.

Parameters:
searchiptuple.
peerslist to search.
Returns:
A pointer to a peer if one is found NULL otherwise.
BGPPeer * BGPMain::find_peer ( const Iptuple search)

Find peer with this iptuple.

Parameters:
searchiptuple.
Returns:
A pointer to a peer if one is found NULL otherwise.
bool BGPMain::find_tuple_179 ( string  peer_addr,
Iptuple otuple 
)

Find the tuple that has this peer address and both ports are 179.

This is a hack as at the moment of writing the rtrmgr can't send both the old and new state of a variable.

Parameters:
peer_addrof tuple.
otuplethe tuple if one is found.
Returns:
true if a tuple is matched.
uint32_t BGPMain::get_mtu ( const string &  interface)

Obtain the MTU for an interface.

Parameters:
thename of the interface.
Returns:
the mtu for the interface.
uint32_t BGPMain::get_prefix_length ( const string &  interface,
const string &  vif,
const IPv4 address 
)

Obtain the subnet prefix length for an IPv4 interface/vif/address.

Parameters:
interfacethe name of the interface.
vifthe name of the vif.
addressthe address.
Returns:
the subnet prefix length for the address.
const IfMgrIfTree& BGPMain::ifmgr_iftree ( ) const [inline, private]

Obtain a reference to the interface manager's interface tree.

Returns:
a reference to the interface manager's interface tree.
const ServiceBase* BGPMain::ifmgr_mirror_service_base ( ) const [inline, private]

Obtain a pointer to the interface manager service base.

Returns:
a pointer to the interface manager service base.
bool BGPMain::interface_address_prefix_len4 ( const IPv4 address,
uint32_t &  prefix_len 
) const

Obtain the prefix length for a particular IPv4 address.

Parameters:
addressthe address to search for.
prefix_lenthe return-by-reference prefix length for address.
Returns:
true if the address belongs to this router, otherwise false.
bool BGPMain::is_address_enabled ( const string &  interface,
const string &  vif,
const IPv4 address 
) const

Test whether an IPv4 interface/vif/address is enabled.

Parameters:
interfacethe name of the interface to test.
vifthe name of the vif to test.
addressthe address to test.
Returns:
true if it exists and is enabled, otherwise false.
bool BGPMain::is_interface_enabled ( const string &  interface) const

Test whether an interface is enabled.

Parameters:
interfacethe name of the interface to test.
Returns:
true if it exists and is enabled, otherwise false.
bool BGPMain::is_vif_enabled ( const string &  interface,
const string &  vif 
) const

Test whether an interface/vif is enabled.

Parameters:
interfacethe name of the interface to test.
vifthe name of the vif to test.
Returns:
true if it exists and is enabled, otherwise false.
void BGPMain::local_config ( const uint32_t &  as,
const IPv4 id,
bool  use_4byte_asnums 
)

Set the local configuration.

Parameters:
asas number.
idrouter id.
use_4byte_asnumsindicates we should send 4 byte AS numbers to all peers that are 4byte capable.
void BGPMain::local_ip_changed ( string  local_address)

One of the local IP addresses of this router has changed.

Where a change can be an addition or removal or a change in the link status. If the provided address matches any of the local ip addresses of any of the peerings unconditionally bounce the peering. Unconditional bouncing of the peering is all that is required if a link has gone down the old session will be dropped and the new one will fail. If the link has just come up then a session will be made.

void BGPMain::notify_birth ( const string &  target_class,
const string &  target_instance 
) [inline]

Call via XrlBgpTarget when the finder reports that a process has started.

Parameters:
target_classClass of process that has started.
target_instanceInstance name of process that has started.
void BGPMain::notify_death ( const string &  target_class,
const string &  target_instance 
) [inline]

Call via XrlBgpTarget when the finder reports that a process has terminated.

Parameters:
target_classClass of process that has terminated.
target_instanceInstance name of process that has terminated.
bool BGPMain::originate_route ( const IPv4Net nlri,
const IPv4 next_hop,
const bool &  unicast,
const bool &  multicast,
const PolicyTags policytags 
)

Originate an IPv4 route.

Parameters:
nlrisubnet to announce
next_hopto forward to
unicastif true install in unicast routing table
multicastif true install in multicast routing table
policytagspolicy-tags associated with route.
Returns:
true on success
BGPPlumbing* BGPMain::plumbing_unicast ( ) const [inline]

Originally inserted for testing.

However, now used by all the "rib_client_route_info_*" methods.

bool BGPMain::processes_ready ( ) [inline]
Returns:
Return true when all the processes that BGP is dependent on are ready.
Profile& BGPMain::profile ( ) [inline]

IPv6 stuff.

Returns:
a reference to the profiler.
void BGPMain::register_address_status ( AddressStatus4Cb  cb) [inline]

Add a callback for tracking the IPv4 interface/vif/address status.

The callback will be invoked whenever the status of the tuple (interface, vif, address) is changed from disabled to enabled or vice-versa.

Parameters:
cbthe callback to register.
void BGPMain::register_interface_status ( InterfaceStatusCb  cb) [inline]

Add a callback for tracking the interface status.

The callback will be invoked whenever the status of the interface is changed from disabled to enabled or vice-versa.

Parameters:
cbthe callback to register.
void BGPMain::register_vif_status ( VifStatusCb  cb) [inline]

Add a callback for tracking the interface/vif status.

The callback will be invoked whenever the status of the interface/vif is changed from disabled to enabled or vice-versa.

Parameters:
cbthe callback to register.
void BGPMain::reset_filter ( const uint32_t &  filter)

Reset a policy filter.

Parameters:
filterId of filter to reset.
bool BGPMain::set_confederation_member ( const Iptuple iptuple,
bool  conf 
)

set route confederation member

Parameters:
iptupleiptuple.
conftrue if this peer is a confederation member.
Returns:
true on success
bool BGPMain::set_delay_open_time ( const Iptuple iptuple,
uint32_t  delay_open_time 
)

set delay open time

Parameters:
iptupleiptuple.
delay_open_timenew value.
Returns:
true on success
bool BGPMain::set_holdtime ( const Iptuple iptuple,
uint32_t  holdtime 
)

set holdtime

Parameters:
iptupleiptuple.
holdtimenew value.
Returns:
true on success
bool BGPMain::set_nexthop4 ( const Iptuple iptuple,
const IPv4 next_hop 
)

set IPv4 next-hop.

Parameters:
iptupleiptuple.
next-hop
Returns:
true on success
bool BGPMain::set_parameter ( const Iptuple iptuple,
const string &  parameter,
const bool  toggle 
)

set parameter

Typically called via XRL's to set which parameters we support per peer.

Parameters:
iptupleiptuple
parameter
toggleenable or disable parameter
bool BGPMain::set_peer_as ( const Iptuple iptuple,
uint32_t  peer_as 
)

set peer as

Parameters:
iptupleiptuple.
peer_asnew value.
Returns:
true on success
bool BGPMain::set_peer_md5_password ( const Iptuple iptuple,
const string &  password 
)

Set peer TCP-MD5 password.

Parameters:
iptupleiptuple.
passwordThe password to use for TCP-MD5 authentication; if this is the empty string, then authentication will be disabled.
Returns:
true on success.
bool BGPMain::set_peer_state ( const Iptuple iptuple,
bool  state 
)

Set peer state.

Parameters:
iptupleiptuple.
stateshould the peering be enable or disabled.

@ return true on success.

bool BGPMain::set_prefix_limit ( const Iptuple iptuple,
uint32_t  maximum,
bool  state 
)

set prefix limit

Parameters:
maximumnumber of prefixes
statetrue if the prefix limit is being enforced
Returns:
true on success
bool BGPMain::set_route_reflector_client ( const Iptuple iptuple,
bool  rr 
)

set route reflector client

Parameters:
iptupleiptuple.
rrtrue if this peer is a route reflector client.
Returns:
true on success
int BGPMain::shutdown ( ) [virtual]

Shutdown operation.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

int BGPMain::startup ( ) [virtual]

Startup operation.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

void BGPMain::status_change ( ServiceBase service,
ServiceStatus  old_status,
ServiceStatus  new_status 
) [private, virtual]

A method invoked when the status of a service changes.

Parameters:
servicethe service whose status has changed.
old_statusthe old status.
new_statusthe new status.

Implements ServiceChangeObserverBase.

bool BGPMain::withdraw_route ( const IPv4Net nlri,
const bool &  unicast,
const bool &  multicast 
) const

Withdraw an IPv4 route.

Parameters:
nlrisubnet to withdraw
unicastif true withdraw from unicast routing table
multicastif true withdraw from multicast routing table
Returns:
true on success

Member Data Documentation

Multicast Routing Table.

SAFI = 2.

Unicast Routing Table.

SAFI = 1.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations