]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_intra.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / ospf6d / ospf6_intra.c
index b234b10d511a8fb6f21166c46ef6805e1a775e8c..7ae7d682bd90bcab8398d05b5b0c42864799c375 100644 (file)
@@ -1323,6 +1323,8 @@ static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route)
        g_route = ospf6_route_lookup(&oa_route->prefix,
                                     ospf6->route_table);
 
+       assert(g_route);
+
        for (ospf6_route_lock(g_route); g_route &&
             ospf6_route_is_prefix(&oa_route->prefix, g_route);
             g_route = nroute) {
@@ -1698,7 +1700,8 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
                memset(&route->prefix, 0, sizeof(struct prefix));
                route->prefix.family = AF_INET6;
                route->prefix.prefixlen = op->prefix_length;
-               ospf6_prefix_in6_addr(&route->prefix.u.prefix6, op);
+               ospf6_prefix_in6_addr(&route->prefix.u.prefix6,
+                                     intra_prefix_lsa, op);
 
                route->type = OSPF6_DEST_TYPE_NETWORK;
                route->path.origin.type = lsa->header->type;
@@ -1726,7 +1729,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
                listnode_add_sort(route->paths, path);
 
                old = ospf6_route_lookup(&route->prefix, oa->route_table);
-               if (old && (ospf6_route_cmp(route, old) == 0)) {
+               if (old) {
                        if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
                                prefix2str(&route->prefix, buf, sizeof(buf));
                                zlog_debug("%s Update route: %s old cost %u new cost %u paths %u nh %u",
@@ -1880,7 +1883,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
                memset(&prefix, 0, sizeof(struct prefix));
                prefix.family = AF_INET6;
                prefix.prefixlen = op->prefix_length;
-               ospf6_prefix_in6_addr(&prefix.u.prefix6, op);
+               ospf6_prefix_in6_addr(&prefix.u.prefix6, intra_prefix_lsa, op);
 
                route = ospf6_route_lookup(&prefix, oa->route_table);
                if (route == NULL)
@@ -2037,6 +2040,8 @@ static void ospf6_brouter_debug_print(struct ospf6_route *brouter)
        zlog_info("  options: %s router-bits: %s metric-type: %d metric: %d/%d",
                  options, capa, brouter->path.metric_type, brouter->path.cost,
                  brouter->path.u.cost_e2);
+       zlog_info(" paths %u nh %u", listcount(brouter->paths),
+                  listcount(brouter->nh_list));
 }
 
 void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
@@ -2047,8 +2052,10 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
        uint32_t brouter_id;
        char brouter_name[16];
 
-       if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id))
-               zlog_info("border-router calculation for area %s", oa->name);
+       if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id) ||
+           IS_OSPF6_DEBUG_ROUTE(MEMORY))
+               zlog_info("%s: border-router calculation for area %s",
+                         __PRETTY_FUNCTION__, oa->name);
 
        hook_add = oa->ospf6->brouter_table->hook_add;
        hook_remove = oa->ospf6->brouter_table->hook_remove;
@@ -2114,6 +2121,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
 
        for (brouter = ospf6_route_head(oa->ospf6->brouter_table); brouter;
             brouter = nbrouter) {
+
                /*
                 * brouter may have been "deleted" in the last loop iteration.
                 * If this is the case there is still 1 final refcount lock
@@ -2122,6 +2130,8 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
                 * skip processing the deleted route.
                 */
                if (brouter->lock == 1) {
+                       if (IS_OSPF6_DEBUG_ROUTE(MEMORY))
+                               ospf6_brouter_debug_print(brouter);
                        nbrouter = ospf6_route_next(brouter);
                        continue;
                } else {
@@ -2173,8 +2183,14 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
                                       brouter_id)
                            || IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(
                                       oa->area_id))
-                               zlog_info("brouter %s disappears via area %s",
-                                         brouter_name, oa->name);
+                               zlog_info("%s: brouter %s disappears via area %s",
+                                         __PRETTY_FUNCTION__, brouter_name,
+                                         oa->name);
+                       /* This is used to protect nbrouter from removed from
+                        * the table. For an example, ospf6_abr_examin_summary,
+                        * removes brouters which are marked for remove.
+                        */
+                       oa->intra_brouter_calc = 1;
                        ospf6_route_remove(brouter, oa->ospf6->brouter_table);
                        brouter = NULL;
                } else if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_ADD)
@@ -2184,8 +2200,9 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
                                       brouter_id)
                            || IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(
                                       oa->area_id))
-                               zlog_info("brouter %s appears via area %s",
-                                         brouter_name, oa->name);
+                               zlog_info("%s: brouter %s appears via area %s",
+                                         __PRETTY_FUNCTION__, brouter_name,
+                                         oa->name);
 
                        /* newly added */
                        if (hook_add)
@@ -2205,11 +2222,14 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
                        UNSET_FLAG(brouter->flag, OSPF6_ROUTE_ADD);
                        UNSET_FLAG(brouter->flag, OSPF6_ROUTE_CHANGE);
                }
+               /* Reset for nbrouter */
+               oa->intra_brouter_calc = 0;
        }
 
-       if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id))
-               zlog_info("border-router calculation for area %s: done",
-                         oa->name);
+       if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(oa->area_id) ||
+           IS_OSPF6_DEBUG_ROUTE(MEMORY))
+               zlog_info("%s: border-router calculation for area %s: done",
+                         __PRETTY_FUNCTION__, oa->name);
 }
 
 struct ospf6_lsa_handler router_handler = {.lh_type = OSPF6_LSTYPE_ROUTER,