From 9c27ef9b9c26db0af507869c2866c4a8463f4ae7 Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Thu, 4 May 2006 07:32:57 +0000 Subject: [ospfd] Fix SPF of virtual-links 2006-04-24 Paul Jakma * (general) More Virtual-link fixes, again with much help in testing / debug from Juergen Kammer. Primarily in SPF. * ospf_spf.h: Add guard. ospf_interface.h will include this header. * ospf_interface.h: Modify ospf_vl_lookup definition to take struct ospf as argument, so as to allow for NULL area argument. (struct ospf_vl_data) Remove out_oi, instead add a struct vertex_nexthop, to use as initial nexthop for backbone paths through a vlink. * ospf_interface.c: (ospf_vl_lookup) Modified to allow NULL area to be passed to indicate "any" (first) area. Add extra debug. (ospf_vl_set_params) vl_oi -> nexthop. Add extra debug. (ospf_vl_up_check) Fix debug, inet_ntoa returns a static buffer.. * ospf_route.c: (ospf_intra_add_router) Vlinks dont go through backbone, don't bother checking. * ospf_spf.c: (static struct list vertex_list) Record vertices that will need to be freed. (cmp) Order network before router vertices, as required, wasn't implemented. (vertex_nexthop_free) Mild additional robustness check. (vertex_parent_free) Take void argument, as this function is passed as list deconstructor for vertex parent list. (ospf_vertex_new) More debug. Set deconstructor for parent list. Track allocated vertices on the vertex_list. (ospf_vertex_free) Get rid of the tricky recursive cleanup of vertices. Now frees only the given vertex. (ospf_vertex_add_parent) Fix assert. (ospf_nexthop_calculation) Fix calculation of nexthop for VLink vertices, lookup the vl_data and use its previously recorded nexthop information. (ospf_spf_calculate) Vertices are freed simply by deleting vertex_list nodes and letting ospf_vertex_free as deconstructor work per-node. (ospf_spf_calculate_timer) Trivial optimisation, leave backbone SPF calculation till last to reduce SPF churn on VLink updates. * ospf_vty.c: (ospf_find_vl_data) update call to ospf_vl_lookup (no_ospf_area_vlink_cmd) ditto. (show_ip_ospf_interface_sub) For Vlinks, the peer address is more interesting than the output interface. --- ospfd/ospf_route.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ospfd/ospf_route.c') diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index 5eedbd82..646b625f 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -343,8 +343,9 @@ ospf_intra_add_router (struct route_table *rt, struct vertex *v, if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_intra_add_router: LS ID: %s", inet_ntoa (lsa->header.id)); - - ospf_vl_up_check (area, lsa->header.id, v); + + if (!OSPF_IS_AREA_BACKBONE(area)) + ospf_vl_up_check (area, lsa->header.id, v); if (!CHECK_FLAG (lsa->flags, ROUTER_LSA_SHORTCUT)) area->shortcut_capability = 0; -- cgit v1.2.3 From 894f8b6602f786db42da58c48b1338df5fa98732 Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Fri, 12 May 2006 22:50:40 +0000 Subject: [ospfd] CID #49, fix dereference before NULL check 2006-05-11 Paul Jakma * ospf_route.c: (ospf_route_delete_same_ext) Fix deref before NULL check by moving into check-protected block, fix CID #49. --- ospfd/ospf_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ospfd/ospf_route.c') diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index 646b625f..e0f2565f 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -195,9 +195,9 @@ ospf_route_delete_same_ext(struct route_table *external_routes, struct prefix_ipv4 *p = (struct prefix_ipv4 *)(&rn->p); if ( (ext_rn = route_node_lookup (external_routes, (struct prefix *)p)) ) { - ospf_zebra_delete (p, ext_rn->info); if (ext_rn->info) { + ospf_zebra_delete (p, ext_rn->info); ospf_route_free( ext_rn->info); ext_rn->info = NULL; } -- cgit v1.2.3 From 2518efd15b75687d4791a5eb4b0d7febc36cffbc Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Sun, 27 Aug 2006 06:49:29 +0000 Subject: [ospfd] Bug #134, ospfd should be more robust to backward time change 2006-08-25 Paul Jakma * (general) Bug #134. Be more robust to backward time changes, use the newly added libzebra time functions. In most cases: recent_time -> recent_relative_time() gettimeofday -> quagga_gettime (QUAGGA_CLK_MONOTONIC, ..) time -> quagga_time. (ospf_make_md5_digest) time() call deliberately not changed. (ospf_external_lsa_refresh) remove useless gettimeofday, LSA tv_orig time was already set in ospf_lsa_new, called via ospf_external_lsa_new. --- ospfd/ospf_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ospfd/ospf_route.c') diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index e0f2565f..3a1fa999 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -47,7 +47,7 @@ ospf_route_new () new = XCALLOC (MTYPE_OSPF_ROUTE, sizeof (struct ospf_route)); - new->ctime = time (NULL); + new->ctime = quagga_time (NULL); new->mtime = new->ctime; new->paths = list_new (); new->paths->del = (void (*) (void *))ospf_path_free; -- cgit v1.2.3 From b3bc68e5a4eecd85138463ae5742c2ccaa1db4bb Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Thu, 4 Sep 2008 13:52:07 +0100 Subject: [ospfd] Minor enhancements to recent self-host-routes suppression patch * ospf_spf.c: (ospf_spf_process_stubs) Track whether parent router vertex is the root, so that the host-route suppression logic need only be activated for such vertices. Move the actual logic to ospf_intra_add_stub. * ospf_route.c: (ospf_intra_add_stub) Main test of link moved here, notionally more appropriate. --- ospfd/ospf_route.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'ospfd/ospf_route.c') diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index 3a1fa999..50fba750 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -481,7 +481,8 @@ ospf_intra_add_transit (struct route_table *rt, struct vertex *v, /* RFC2328 16.1. second stage. */ void ospf_intra_add_stub (struct route_table *rt, struct router_lsa_link *link, - struct vertex *v, struct ospf_area *area) + struct vertex *v, struct ospf_area *area, + int parent_is_root) { u_int32_t cost; struct route_node *rn; @@ -514,7 +515,20 @@ ospf_intra_add_stub (struct route_table *rt, struct router_lsa_link *link, if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_intra_add_stub(): calculated cost is %d + %d = %d", v->distance, ntohs(link->m[0].metric), cost); - + + /* PtP links with /32 masks adds host routes to remote, directly + * connected hosts, see RFC 2328, 12.4.1.1, Option 1. + * Such routes can just be ignored for the sake of tidyness. + */ + if (parent_is_root && link->link_data.s_addr == 0xffffffff && + ospf_if_lookup_by_local_addr (area->ospf, NULL, link->link_id)) + { + if (IS_DEBUG_OSPF_EVENT) + zlog_debug ("%s: ignoring host route %s/32 to self.", + __func__, inet_ntoa (link->link_id)); + return; + } + rn = route_node_get (rt, (struct prefix *) &p); /* Lookup current routing table. */ -- cgit v1.2.3