|
|
When a peer goes down, all the routes stored in a RibIn need to be deleted. However, this can take some time, so it cannot occur in one atomic operation, so it must be done route-by-route as a background task. This is complicated by the fact that the peering may come back up while this background deletion is occuring, and new routes may appear. To handle the background deletion while keeping the RibIn simple, we simply create a new DeletionTable route table, plumb it in directly after the RibIn, and pass the RibIn's entire route trie to the DeletionTable. RibIn can now forget these routes ever existed, and DeletionTable can get on with the background deletion task, unplumbing and deleting itself when no routes remain.
Care must be taken to ensure that the downstream routing tables see consistent information. For example, if there is a route for subnet X in the DeletionTable that has not yet been deleted, and an add_route for X comes downstream from rthe RibIn, then this would need to be propagated downstream as a replace_route.
Note that if a peering flaps multiple times, multiple DeletionTables may be plumbed in, one after another, behind a RibInTable.
DeletionTable (string tablename,
Safi safi,
BgpTrie<A>* route_table,
const PeerHandler *peer,
uint32_t genid,
BGPRouteTable<A> *parent)
| DeletionTable |
~DeletionTable ()
| ~DeletionTable |
int add_route (const InternalMessage<A> &rtmsg,
BGPRouteTable<A> *caller)
| add_route |
Reimplemented from BGPRouteTable.
int replace_route (const InternalMessage<A> &old_rtmsg,
const InternalMessage<A> &new_rtmsg,
BGPRouteTable<A> *caller)
| replace_route |
Reimplemented from BGPRouteTable.
int delete_route (const InternalMessage<A> &rtmsg,
BGPRouteTable<A> *caller)
| delete_route |
Reimplemented from BGPRouteTable.
int route_dump (const InternalMessage<A> &rtmsg,
BGPRouteTable<A> *caller,
const PeerHandler *dump_peer)
| route_dump |
Reimplemented from BGPRouteTable.
int push (BGPRouteTable<A> *caller)
| push |
Reimplemented from BGPRouteTable.
const SubnetRoute<A> * lookup_route (const IPNet<A> &net,
uint32_t& genid)
| lookup_route |
[const]
Reimplemented from BGPRouteTable.
void route_used (const SubnetRoute<A>* route, bool in_use)
| route_used |
Reimplemented from BGPRouteTable.
RouteTableType type ()
| type |
[const]
Reimplemented from BGPRouteTable.
string str ()
| str |
[const]
Reimplemented from BGPRouteTable.
void output_state (bool , BGPRouteTable<A> *)
| output_state |
bool get_next_message (BGPRouteTable<A> *)
| get_next_message |
Reimplemented from BGPRouteTable.
void initiate_background_deletion ()
| initiate_background_deletion |
uint32_t genid ()
| genid |
[const]
Returns: the generation id.