xorp

RouteManager Class Reference

Routing table manager. More...

#include <route_manager.hh>

List of all members.

Public Member Functions

 RouteManager (Olsr &olsr, EventLoop &eventloop, FaceManager *fm, Neighborhood *nh, TopologyManager *tm, ExternalRoutes *er)
void schedule_route_update ()
 Schedule a recalculation of the entire routing table.
void schedule_external_route_update ()
 Schedule a recalculation of external routes.
bool add_onehop_link (const LogicalLink *l, const Neighbor *n)
 Add a link to a one-hop neighbor to the SPT.
bool add_twohop_link (const Neighbor *n, const TwoHopLink *l2, const TwoHopNeighbor *n2)
 Add a two-hop link and neighbor to the SPT.
bool add_tc_link (const TopologyEntry *tc)
 Add a TC-derived link and neighbor to the SPT.
bool add_hna_route (const IPv4Net &dest, const IPv4 &lasthop, const uint16_t distance)
 Add an external route, possibly HNA derived, to the current trie.
void push_routes ()
 Backend method to: push all the routes through the policy filters whenever they are updated.

Protected Member Functions

void recompute_all_routes ()
 Recompute the OLSR domain portion of the routing table.
Vertex make_origin_vertex ()
void begin ()
 Begin the route computation transaction.
void end ()
 End the route computation transaction.
bool add_entry (const IPv4Net &net, const RouteEntry &rt)
 Internal method to: Add a route entry to the current internal trie.
bool delete_entry (const IPv4Net &net, const RouteEntry &rt)
 Internal method to: Delete a route entry from the current internal trie.
bool replace_entry (const IPv4Net &net, const RouteEntry &rt, const RouteEntry &previous_rt)
 Internal method to: Replace a route entry in the current internal trie.
bool add_route (IPv4Net net, IPv4 nexthop, uint32_t metric, RouteEntry &rt)
 Backend method to: add a route to the RIB with policy filtering.
bool delete_route (const IPv4Net &net, const RouteEntry &rt)
 Backend method to: withdraw a route from the RIB.
bool replace_route (IPv4Net net, IPv4 nexthop, uint32_t metric, RouteEntry &rt, RouteEntry &previous_rt)
 Backend method to: replace a route that has been sent to the RIB.
bool do_filtering (IPv4Net &net, IPv4 &nexthop, uint32_t &metric, RouteEntry &rt, PolicyTags &policytags)
 Backend method to: perform policy filtering when a route may be plumbed to the RIB.

Private Attributes

Olsr_olsr
EventLoop_eventloop
FaceManager_fm
Neighborhood_nh
TopologyManager_tm
ExternalRoutes_er
Spt< Vertex_spt
Vertex _origin
bool _in_transaction
XorpTask _route_update_task
Trie< IPv4, RouteEntry > * _current
Trie< IPv4, RouteEntry > * _previous

Detailed Description

Routing table manager.

Performs incremental and/or deferred update of the OLSR routing table for the domain which this routing process interacts with.

Whilst incremental updates are possible, the code does not currently do this because the incremental shortest-path-tree code does not yet support incremental updates. The interface is however written with this in mind as it may turn out to offer faster convergence for link-state MANET protocols like OLSR.

Classes which produce artifacts for RouteManager to turn into routes therefore call schedule_route_update() whenever their state changes. RouteManager will call them back. We do not use polymorphism for this as the relationships do not significantly change.


Member Function Documentation

bool RouteManager::add_entry ( const IPv4Net net,
const RouteEntry rt 
) [protected]

Internal method to: Add a route entry to the current internal trie.

Parameters:
netthe destination prefix.
rtthe entry to add.
Returns:
true if the entry was added OK.
bool RouteManager::add_hna_route ( const IPv4Net dest,
const IPv4 lasthop,
const uint16_t  distance 
)

Add an external route, possibly HNA derived, to the current trie.

Section 12: Non-OLSR Interfaces. The metric of an HNA route in RFC-compliant OLSR is identical to that of its last-hop. If the origin of the HNA route is not reachable in the OLSR SPT, the HNA route will be rejected; see NOTES.

Parameters:
destthe destination prefix.
lasthopthe last hop advertising
destNote: This is a main address, not an interface address.
distancethe number of OLSR hops to
lasthop
Returns:
true if the route was added OK.
bool RouteManager::add_onehop_link ( const LogicalLink l,
const Neighbor n 
)

Add a link to a one-hop neighbor to the SPT.

Given a link at radius 1 in the routing graph from this node, add its endpoint node and the edge to the SPT graph.

TODO: Bias for MPRs and willingness correctly.

Parameters:
lpointer to a link between the origin and the Neighbor n.
npointer to the Neighbor n.
Returns:
true if the link was added OK.
bool RouteManager::add_route ( IPv4Net  net,
IPv4  nexthop,
uint32_t  metric,
RouteEntry rt 
) [protected]

Backend method to: add a route to the RIB with policy filtering.

Parameters:
netthe destination prefix.
nexthopthe next-hop.
metricthe computed metric of the route.
rtthe route entry to add, containing all other fields.
Returns:
true if the route was added to the RIB OK, otherwise false.
bool RouteManager::add_tc_link ( const TopologyEntry tc)

Add a TC-derived link and neighbor to the SPT.

Given a link at radius > 2 in the routing graph from the origin, add its far endpoint nodes and the edge to the SPT graph. In the absence of ETX measurements, the only possible cost for a TC link which we can infer from link state is 1 (just the hop), and this is what we get from TopologyManager.

Parameters:
tcThe topology entry being considered for SPT add.
Returns:
true if a link and vertex for the far endpoint was added to the SPT, otherwise false.
bool RouteManager::add_twohop_link ( const Neighbor n,
const TwoHopLink l2,
const TwoHopNeighbor n2 
)

Add a two-hop link and neighbor to the SPT.

Given a link at radius 2 in the routing graph from the origin, add its endpoint nodes and the edge to the SPT graph.

In the absence of ETX measurements, the only possible cost for a 2-hop link which we can infer from link state is 1 (just the hop), and this is what we get from Neighborhood.

Parameters:
npointer to the Neighbor n, which must already have been added to the SPT graph.
l2pointer to a link between Neighbor n and TwoHopNeighbor n2.
n2pointer to a TwoHopNeighbor.
Returns:
true if the two-hop link was added OK.
void RouteManager::begin ( ) [protected]

Begin the route computation transaction.

This must be called before any routes are recomputed, to take snapshots of the state which is present in the RIB.

bool RouteManager::delete_entry ( const IPv4Net net,
const RouteEntry rt 
) [protected]

Internal method to: Delete a route entry from the current internal trie.

Parameters:
netthe destination prefix.
rtthe entry to delete.
Returns:
true if the entry was deleted OK.
bool RouteManager::delete_route ( const IPv4Net net,
const RouteEntry rt 
) [protected]

Backend method to: withdraw a route from the RIB.

Parameters:
netthe destination prefix.
rtthe route entry to delete, containing all other fields.
Returns:
true if the route was withdrawn from the RIB OK, otherwise false.
bool RouteManager::do_filtering ( IPv4Net net,
IPv4 nexthop,
uint32_t &  metric,
RouteEntry rt,
PolicyTags policytags 
) [protected]

Backend method to: perform policy filtering when a route may be plumbed to the RIB.

May not be declared const; policy may modify fields.

Parameters:
netthe destination prefix.
nexthopthe next-hop.
metricthe metric.
rtthe route entry to filter, containing all other fields.
policytagsthe tags presented to us by the policy engine.
Returns:
true if the route was accepted by the policy engine, otherwise false if any error occurred.
void RouteManager::end ( ) [protected]

End the route computation transaction.

This must be called after all routes are recomputed in order for them to propagate to the RIB.

void RouteManager::recompute_all_routes ( ) [protected]

Recompute the OLSR domain portion of the routing table.

Until incremental computation is implemented, we perform the SPT computation fully every time a recomputation is triggered. Producers of routes call us back to populate the graph.

bool RouteManager::replace_entry ( const IPv4Net net,
const RouteEntry rt,
const RouteEntry previous_rt 
) [protected]

Internal method to: Replace a route entry in the current internal trie.

Parameters:
netthe destination prefix.
rtthe new route entry which replaces
previous_rt
previous_rtthe entry to replace.
Returns:
true if the entry was replaced OK.
bool RouteManager::replace_route ( IPv4Net  net,
IPv4  nexthop,
uint32_t  metric,
RouteEntry rt,
RouteEntry previous_rt 
) [protected]

Backend method to: replace a route that has been sent to the RIB.

Parameters:
netthe destination prefix.
nexthopthe new next-hop.
metricthe new computed metric of the route.
rtthe route entry to add, containing all other fields.
previous_rtthe route entry to replace.
Returns:
true if the route was replaced in the RIB OK, otherwise false.

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