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/ospf_vty.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ospfd/ospf_vty.c') diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 97c8e8d6..a8807141 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -7020,6 +7020,10 @@ DEFUN (ospf_max_metric_router_lsa_admin, if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) ospf_router_lsa_update_area (area); } + + /* Allows for areas configured later to get the property */ + ospf->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_SET; + return CMD_SUCCESS; } @@ -7047,6 +7051,7 @@ DEFUN (no_ospf_max_metric_router_lsa_admin, ospf_router_lsa_update_area (area); } } + ospf->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET; return CMD_SUCCESS; } -- 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/ospf_vty.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'ospfd/ospf_vty.c') diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index a8807141..3655cfe1 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -4035,21 +4035,26 @@ show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) static void show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) { - struct listnode *node; + struct route_node *rn; struct ospf_lsa *lsa; vty_out (vty, "%s MaxAge Link States:%s%s", VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) + for (rn = route_top (ospf->maxage_lsa); rn; rn = route_next (rn)) { - vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); - vty_out (vty, "Link State ID: %s%s", - inet_ntoa (lsa->data->id), VTY_NEWLINE); - vty_out (vty, "Advertising Router: %s%s", - inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); - vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); - vty_out (vty, "%s", VTY_NEWLINE); + struct ospf_lsa *lsa; + + if ((lsa = rn->info) != NULL) + { + vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); + vty_out (vty, "Link State ID: %s%s", + inet_ntoa (lsa->data->id), VTY_NEWLINE); + vty_out (vty, "Advertising Router: %s%s", + inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); + vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); + vty_out (vty, "%s", VTY_NEWLINE); + } } } -- cgit v1.2.1 From bda3c326a3fe843417726bfe1bc8d4bafbb51fa9 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Tue, 4 Dec 2012 11:31:16 -0800 Subject: ospfd: fix argument parsing for distribute-list Use the correct argument for the protocol lookup in ospf distribute-list commands. Signed-off-by: Christian Franke Signed-off-by: Scott Feldman --- ospfd/ospf_vty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ospfd/ospf_vty.c') diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 3655cfe1..862ef95a 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6042,7 +6042,7 @@ DEFUN (ospf_distribute_list_out, int source; /* Get distribute source. */ - source = proto_redistnum(AFI_IP, argv[0]); + source = proto_redistnum(AFI_IP, argv[1]); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; @@ -6061,7 +6061,7 @@ DEFUN (no_ospf_distribute_list_out, struct ospf *ospf = vty->index; int source; - source = proto_redistnum(AFI_IP, argv[0]); + source = proto_redistnum(AFI_IP, argv[1]); if (source < 0 || source == ZEBRA_ROUTE_OSPF) return CMD_WARNING; -- cgit v1.2.1 From 1a61ad1011c498c4ae66cc145db673e53ef02962 Mon Sep 17 00:00:00 2001 From: Andrew Certain Date: Tue, 4 Dec 2012 12:50:23 -0800 Subject: ospfd: Fixed typo bug in ospf_vty.h:ospf_neighbor Typo bug. ospf_nbr_nbma_poll_interval_set() was being sent priority instead of interval. Signed-off-by: Scott Feldman --- ospfd/ospf_vty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ospfd/ospf_vty.c') diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 862ef95a..45ddc5c4 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -2322,7 +2322,7 @@ DEFUN (ospf_neighbor, if (argc > 1) ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); if (argc > 2) - ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority); + ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); return CMD_SUCCESS; } -- 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/ospf_vty.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'ospfd/ospf_vty.c') diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 45ddc5c4..2ba8188c 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -1742,12 +1742,11 @@ DEFUN (no_ospf_area_default_cost, struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; - u_int32_t cost; int format; struct prefix_ipv4 p; VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); - VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); + VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[1], 0, OSPF_LS_INFINITY); area = ospf_area_lookup_by_area_id (ospf, area_id); if (area == NULL) @@ -1933,7 +1932,6 @@ DEFUN (no_ospf_area_filter_list, struct ospf *ospf = vty->index; struct ospf_area *area; struct in_addr area_id; - struct prefix_list *plist; int format; VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); @@ -1941,7 +1939,6 @@ DEFUN (no_ospf_area_filter_list, if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) return CMD_SUCCESS; - plist = prefix_list_lookup (AFI_IP, argv[1]); if (strncmp (argv[2], "in", 2) == 0) { if (PREFIX_NAME_IN (area)) @@ -2394,11 +2391,10 @@ DEFUN (no_ospf_neighbor, { struct ospf *ospf = vty->index; struct in_addr nbr_addr; - int ret; VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); - ret = ospf_nbr_nbma_unset (ospf, nbr_addr); + (void)ospf_nbr_nbma_unset (ospf, nbr_addr); return CMD_SUCCESS; } @@ -5408,7 +5404,7 @@ DEFUN (ip_ospf_priority, "Address of interface") { struct interface *ifp = vty->index; - u_int32_t priority; + long priority; struct route_node *rn; struct in_addr addr; int ret; -- cgit v1.2.1