xorp

ExtIntTable< A > Class Template Reference

Make two route RouteTables behave like one, while resolving nexthops that are not immediate neighbors. More...

#include <rt_tab_extint.hh>

Inheritance diagram for ExtIntTable< A >:
RouteTable< A >

List of all members.

Public Member Functions

 ExtIntTable (RouteTable< A > *ext_table, RouteTable< A > *int_table)
 ExtIntTable Constructor.
int add_route (const IPRouteEntry< A > &route, RouteTable< A > *caller)
 An add_route request from a parent table causes a lookup on the other parent table.
int delete_route (const IPRouteEntry< A > *route, RouteTable< A > *caller)
 An delete_route request from a parent table also causes a lookup on the other parent table.
const IPRouteEntry< A > * lookup_route (const IPNet< A > &net) const
 Lookup a specific subnet.
const IPRouteEntry< A > * lookup_route (const A &addr) const
 Lookup an IP address to get the most specific (longest prefix length) route that matches this address.
RouteRange< A > * lookup_route_range (const A &addr) const
 Lookup an IP address to get the most specific (longest prefix length) route that matches this address, along with the RouteRange information for this address and route.
TableType type () const
void replumb (RouteTable< A > *old_parent, RouteTable< A > *new_parent)
 replumb the parent tables, so that new_parent replaces old_parent
string str () const
 Render this ExtIntTable as a string for debugging purposes.

Private Types

typedef ResolvedIPRouteEntry
< A >::RouteBackLink 
ResolvedRouteBackLink
typedef UnresolvedIPRouteEntry
< A >::RouteBackLink 
UnresolvedRouteBackLink

Private Member Functions

int delete_ext_route (const IPRouteEntry< A > *route, bool &is_delete_propagated)
const ResolvedIPRouteEntry< A > * lookup_in_resolved_table (const IPNet< A > &ipv4net)
void resolve_unresolved_nexthops (const IPRouteEntry< A > &route)
const ResolvedIPRouteEntry< A > * resolve_and_store_route (const IPRouteEntry< A > &route, const IPRouteEntry< A > *nexthop_route)
bool delete_unresolved_nexthop (const IPRouteEntry< A > *route)
void recalculate_nexthops (const IPRouteEntry< A > &route)
const ResolvedIPRouteEntry< A > * lookup_by_igp_parent (const IPRouteEntry< A > *route)
const ResolvedIPRouteEntry< A > * lookup_next_by_igp_parent (const IPRouteEntry< A > *route, const ResolvedIPRouteEntry< A > *previous)
const IPRouteEntry< A > * lookup_route_in_igp_parent (const IPNet< A > &subnet) const
const IPRouteEntry< A > * lookup_route_in_igp_parent (const A &addr) const
const IPRouteEntry< A > * lookup_route_in_egp_parent (const IPNet< A > &subnet) const
const IPRouteEntry< A > * lookup_route_in_egp_parent (const A &addr) const

Private Attributes

RouteTable< A > * _ext_table
RouteTable< A > * _int_table
Trie< A, const
ResolvedIPRouteEntry< A > * > 
_ip_route_table
multimap< A,
UnresolvedIPRouteEntry< A > * > 
_ip_unresolved_nexthops
map< IPNet< A >
, UnresolvedIPRouteEntry< A > * > 
_ip_unresolved_table
multimap< const IPRouteEntry
< A > *, ResolvedIPRouteEntry
< A > * > 
_ip_igp_parents
Trie< A, const IPRouteEntry< A > * > _resolving_routes

Detailed Description

template<class A>
class ExtIntTable< A >

Make two route RouteTables behave like one, while resolving nexthops that are not immediate neighbors.

ExtIntTable takes two routing tables and combines them together to form a single table, where routes for the same subnet with a lower admin distance override those with a higher admin distance. The two parent tables are different: the Internal table takes routes only from IGP protocols, and so the nexthops of routes it provides are always immediate neighbors. The External table takes routes from EGP protocols, and so the nexthops of routes it provides may not be immediate neighbors. The ExtIntTable resolves the nexthops of all routes it propagates downstream. If a nexthop cannot be resolved, it is not propagated downstream, but is stored pending the arrival of a route that would permit the nexthop to be resolved.

An add_route request from a parent tables causes a lookup on the other parent table. If the route is better than the one from the other table, or no route exists in the other table, then the new route is passed downstream.

An delete_route request from a parent table also causes a lookup on the other parent table. The delete_route is propagated downstream. If an alternative route is found, then that is then propagated downsteam as an add_route to replace the deleted route.

Lookups from downsteam cause lookups on both parent tables. The better response is given.

A RIB normally only has one ExtIntTable.


Constructor & Destructor Documentation

template<class A >
ExtIntTable< A >::ExtIntTable ( RouteTable< A > *  ext_table,
RouteTable< A > *  int_table 
)

ExtIntTable Constructor.

Parameters:
ext_tableparent RouteTables supplying EGP routes.
int_tableparent RouteTables supplying IGP routes.

Member Function Documentation

template<class A >
int ExtIntTable< A >::add_route ( const IPRouteEntry< A > &  route,
RouteTable< A > *  caller 
) [virtual]

An add_route request from a parent table causes a lookup on the other parent table.

If the route is better than the one from the other table, or no route exists in the other table then it is passed downstream if nexthop resolution is successful.

Parameters:
routethe new route.
callerthe parent table sending the new route.
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements RouteTable< A >.

template<class A >
int ExtIntTable< A >::delete_route ( const IPRouteEntry< A > *  route,
RouteTable< A > *  caller 
) [virtual]

An delete_route request from a parent table also causes a lookup on the other parent table.

The delete_route is propagated downstream. If an alternative route is found and nexthop resolution on it is successful, then it is then propagated downsteam as an add_route to replace the deleted route.

Parameters:
routethe route to be deleted.
callerthe parent table sending the delete_route.
Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements RouteTable< A >.

template<class A >
const IPRouteEntry< A > * ExtIntTable< A >::lookup_route ( const A &  addr) const [virtual]

Lookup an IP address to get the most specific (longest prefix length) route that matches this address.

The lookup will be sent to both parent tables and the ExtIntTable's internal table of resolved_routes. The most specific answer is returned, so long as the nexthop resolves. If more than one route has the same prefix length, then the route with the better admin_distance is returned.

Parameters:
addrthe IP address to look up.
Returns:
a pointer to the best most specific route entry if any entry matches and its nexthop resolves, NULL otherwise.

Implements RouteTable< A >.

template<class A >
const IPRouteEntry< A > * ExtIntTable< A >::lookup_route ( const IPNet< A > &  net) const [virtual]

Lookup a specific subnet.

The lookup will first look in the ExtIntTable 's table of resolved routes - if there is a route here, then this is returned. Otherwise the lookup will be sent to both parent tables. If both give an answer, then the route with the better admin_distance is returned, so long as it gives a nexthop that is resolvable.

Parameters:
netthe subnet to look up.
Returns:
a pointer to the route entry if it exists, NULL otherwise.

Implements RouteTable< A >.

template<class A >
RouteRange< A > * ExtIntTable< A >::lookup_route_range ( const A &  addr) const [virtual]

Lookup an IP address to get the most specific (longest prefix length) route that matches this address, along with the RouteRange information for this address and route.

As with lookup_route, this involves querying ExtIntTable's resolved_routes table and possibly both parent tables. The best, most specific route is returned if the nexthop is resolvable, and the tightest bounds on the answer are returned.

See also:
RouteRange
Parameters:
addrthe IP address to look up.
Returns:
a pointer to a RouteRange class instance containing the relevant answer. It is up to the recipient of this pointer to free the associated memory.

Implements RouteTable< A >.

template<class A >
void ExtIntTable< A >::replumb ( RouteTable< A > *  old_parent,
RouteTable< A > *  new_parent 
) [virtual]

replumb the parent tables, so that new_parent replaces old_parent

Parameters:
old_parentthe old parent table.
new_parentthe new parent table.

Implements RouteTable< A >.

template<class A >
TableType ExtIntTable< A >::type ( ) const [inline, virtual]
Returns:
the table type (TableType).

Implements RouteTable< A >.


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