From 4ba4fc857685bfe31c7127826652012a750367c5 Mon Sep 17 00:00:00 2001 From: Ayan Banerjee Date: Mon, 3 Dec 2012 11:17:24 -0800 Subject: ospf: forward ref. of areas for "max-metric router-lsa administrative" cmd In the event areas are created at a later point of time with respect to the playback of the "max-metric router-lsa administrative" command, those areas do not get into indefinite max-metric mode. This patch is inteneded to store the configuration and apply it to all future areas that may be created. In the process, some other bugs that were there with respect to restart etc are fixed up. Tested locally to see that the fix works across multiple areas and across multiple restarts. Signed-off-by: Ayan Banerjee Reviewed-by: Scott Feldman Reviewed-by: JR Rivers Signed-off-by: Scott Feldman --- ospfd/ospfd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ospfd/ospfd.c') diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index e8405136..11a2dc5c 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -182,7 +182,8 @@ ospf_new (void) new->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED; new->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; - + new->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET; + /* Distribute parameter init. */ for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) { @@ -676,6 +677,10 @@ ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format) area->format = format; listnode_add_sort (ospf->areas, area); ospf_check_abr_status (ospf); + if (ospf->stub_router_admin_set == OSPF_STUB_ROUTER_ADMINISTRATIVE_SET) + { + SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); + } } return area; -- cgit v1.2.1 From 91e6a0e5ca973c7183f638987b67aa370e9b484c Mon Sep 17 00:00:00 2001 From: Dinesh Dutt Date: Tue, 4 Dec 2012 10:46:37 -0800 Subject: ospf: Convert MAX_AGE LSA list to tree Store the MaxAge LSA list in a tree instead of a linked list for efficient access. Walking the list can be quite inefficient in some large systems and under certain tests. ospfd maintains the list of LSA's that have been MaxAge'd out in a separate linked list for removal by a remover/walker thread. When a new LSA is to be installed, the old LSA is ejected and when it is ejected, the MaxAge LSA list is traversed to ensure that the old LSA is also removed from this list if it exists on this list. When a large number (> 5K) MaxAge LSAs are bombarding the system, walking this list takes a significant time causing timers to fire and actions to be taken such as expiring neighbors due to expiry of DeadInterval (especially when timer is really low, <= 12s), creating a spiral of instability. By making this MaxAge LSA list be a tree, this problem is mitigated. Signed-off-by: Dinesh Dutt Reviewed-by: Ayan Banerjee Reviewed-by: Scott Feldman Reviewed-by: Shrijeet Mukherjee Signed-off-by: Scott Feldman --- ospfd/ospfd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'ospfd/ospfd.c') diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 11a2dc5c..d1de29d5 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -201,7 +201,7 @@ ospf_new (void) /* MaxAge init. */ new->maxage_delay = OSFP_LSA_MAXAGE_REMOVE_DELAY_DEFAULT; - new->maxage_lsa = list_new (); + new->maxage_lsa = route_table_init(); new->t_maxage_walker = thread_add_timer (master, ospf_lsa_maxage_walker, new, OSPF_LSA_MAXAGE_CHECK_INTERVAL); @@ -502,10 +502,18 @@ ospf_finish_final (struct ospf *ospf) ospf_lsdb_delete_all (ospf->lsdb); ospf_lsdb_free (ospf->lsdb); - for (ALL_LIST_ELEMENTS (ospf->maxage_lsa, node, nnode, lsa)) - ospf_lsa_unlock (&lsa); /* maxage_lsa */ + for (rn = route_top (ospf->maxage_lsa); rn; rn = route_next (rn)) + { + struct ospf_lsa *lsa; - list_delete (ospf->maxage_lsa); + if ((lsa = rn->info) != NULL) + { + ospf_lsa_unlock (&lsa); + rn->info = NULL; + } + route_unlock_node (rn); + } + route_table_finish (ospf->maxage_lsa); if (ospf->old_table) ospf_route_table_free (ospf->old_table); -- cgit v1.2.1 From 0798cee34f5c436cd2a4b6e1d9a1ca90eee94292 Mon Sep 17 00:00:00 2001 From: Andrew Certain Date: Tue, 4 Dec 2012 13:43:42 -0800 Subject: ospfd: compile warning cleanups A set of patches to clarify some comments as well as cleanup code that was causing warnings. After these patches, the code can be compiled with -Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual -Wextra -Wno-unused-parameter -Wno-missing-field-initializers (what is current in trunk plus -Wextra -Wno-unused-parameter -Wno-missing-field-initializers). Signed-off-by: Scott Feldman --- ospfd/ospfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ospfd/ospfd.c') diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index d1de29d5..3e2b2348 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -223,7 +223,7 @@ ospf_new (void) } new->maxsndbuflen = getsockopt_so_sendbuf (new->fd); if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) - zlog_debug ("%s: starting with OSPF send buffer size %d", + zlog_debug ("%s: starting with OSPF send buffer size %u", __func__, new->maxsndbuflen); if ((new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE+1)) == NULL) { -- cgit v1.2.1