From afb226bebd8350f8f6523f4692658b944bc2997f Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Tue, 21 Feb 2006 01:09:01 +0000 Subject: [bgpd] Record afi/safi in bgp_table. Serialise peer clear with FSM. 2006-02-21 Paul Jakma * bgpd.h: move the clear_node_queue to be peer specific. Add a new peer status flag, PEER_STATUS_CLEARING. * bgp_table.h: (struct bgp_table) Add fields to record afi, safi of the table. (bgp_table_init) Take afi and safi to create table for. * bgp_table.c: (bgp_table_init) record the afi and safi. * bgp_nexthop.c: Update all calls to bgp_table_init. * bgp_vty.c: ditto. * bgpd.c: ditto. * bgp_fsm.c: (bgp_timer_set) dont bring up a session which is clearing. * bgp_route.c: (general) Update all bgp_table_init calls. (bgp_process_{rsclient,main}) clear_node is serialised via PEER_STATUS_CLEARING and fsm now. (struct bgp_clear_node_queue) can be removed. struct bgp_node can be the queue item data directly, as struct peer can be kept in the new wq global user data and afi/safi can be retrieved via bgp_node -> bgp_table. (bgp_clear_route_node) fix to get peer via wq->spec.data, afi/safi via bgp_node->bgp_table. (bgp_clear_node_queue_del) no more item data to delete, only unlock the bgp_node. (bgp_clear_node_complete) only need to unset CLEARING flag and unlock struct peer. (bgp_clear_node_queue_init) queue attaches to struct peer now. record peer name as queue name. (bgp_clear_route_table) If queue transitions to active, serialise clearing by setting PEER_STATUS_CLEARING rather than plugging process queue, and lock peer while queue active. Update to pass only bgp_node as per-queue-item specific data. --- bgpd/bgp_table.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bgpd/bgp_table.c') diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index a9199d64..a3b489d5 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -32,7 +32,7 @@ void bgp_node_delete (struct bgp_node *); void bgp_table_free (struct bgp_table *); struct bgp_table * -bgp_table_init (void) +bgp_table_init (afi_t afi, safi_t safi) { struct bgp_table *rt; @@ -40,7 +40,9 @@ bgp_table_init (void) memset (rt, 0, sizeof (struct bgp_table)); rt->type = BGP_TABLE_MAIN; - + rt->afi = afi; + rt->safi = safi; + return rt; } -- cgit v1.2.1