]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: retain inter area border router type-4 1958/head
authorChirag Shah <chirag@cumulusnetworks.com>
Mon, 12 Mar 2018 23:37:06 +0000 (16:37 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Thu, 22 Mar 2018 18:45:19 +0000 (11:45 -0700)
During Intra area border router calculation, all
border routers are  marked for remove from brouter table.
Once SPF calculation is done, retain inter area
border router if the adv. intra border router (abr)
is present in SPF table.

Ticket:CM-20171
Testing Done:
Validated inter area ASBR (L1) is retained at
R1 and R2 post intra border router calculation.

L1 -- (area 1)-- L2 -- (area 0) -- R1 --- R2

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
ospf6d/ospf6_abr.c
ospf6d/ospf6_intra.c
ospf6d/ospf6_route.c

index 67d18566ae510a7a9b3a80324335d0a0e034713d..7ffb80724b89d11d855989e125c09f88804660d5 100644 (file)
@@ -912,8 +912,9 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
                ospf6_route_merge_nexthops(old, route);
 
                if (is_debug)
-                       zlog_debug("%s: Update route: %s nh count %u",
-                                  __PRETTY_FUNCTION__, buf,
+                       zlog_debug("%s: Update route: %s old cost %u new cost %u nh count %u",
+                                  __PRETTY_FUNCTION__,
+                                  buf, old->path.cost, route->path.cost,
                                   listcount(route->nh_list));
 
                /* Update RIB/FIB */
@@ -924,7 +925,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
                ospf6_route_delete(route);
        } else {
                if (is_debug)
-                       zlog_debug("Install route: %s nh count %u", buf,
+                       zlog_debug("%s: Install route: %s cost %u nh count %u",
+                                  __PRETTY_FUNCTION__, buf, route->path.cost,
                                   listcount(route->nh_list));
                /* ospf6_ia_add_nw_route (table, &prefix, route); */
                ospf6_route_add(route, table);
index c9e2ff9eb5cc0e5242aceb9fc7ea1fb6bf924d8f..0b7755a3f4300ca43a68302ea56cdb6a6c21f390 100644 (file)
@@ -1631,8 +1631,10 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
                brouter_id = ADV_ROUTER_IN_PREFIX(&brouter->prefix);
                inet_ntop(AF_INET, &brouter_id, brouter_name,
                          sizeof(brouter_name));
+
                if (brouter->path.area_id != oa->area_id)
                        continue;
+
                SET_FLAG(brouter->flag, OSPF6_ROUTE_REMOVE);
 
                if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(brouter_id)
@@ -1651,8 +1653,10 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
 
                if (brouter->type != OSPF6_DEST_TYPE_LINKSTATE)
                        continue;
+
                if (ospf6_linkstate_prefix_id(&brouter->prefix) != htonl(0))
                        continue;
+
                if (!CHECK_FLAG(brouter->path.router_bits, OSPF6_ROUTER_BIT_E)
                    && !CHECK_FLAG(brouter->path.router_bits,
                                   OSPF6_ROUTER_BIT_B))
@@ -1704,10 +1708,36 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
                if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_WAS_REMOVED))
                        continue;
 
+               /* After iterating spf_table for all routers including
+                * intra brouter, clear mark for remove flag for
+                * inter border router if its adv router present in
+                * SPF table.
+                */
+               if (brouter->path.type == OSPF6_PATH_TYPE_INTER) {
+                       struct prefix adv_prefix;
+
+                       ospf6_linkstate_prefix(brouter->path.origin.adv_router,
+                                              htonl(0), &adv_prefix);
+
+                       if (ospf6_route_lookup(&adv_prefix, oa->spf_table)) {
+                               if (IS_OSPF6_DEBUG_BROUTER) {
+                                       zlog_debug("%s: keep inter brouter %s as adv router 0x%x found in spf",
+                                                  __PRETTY_FUNCTION__,
+                                                  brouter_name,
+                                       brouter->path.origin.adv_router);
+                                       ospf6_brouter_debug_print(brouter);
+                               }
+                               UNSET_FLAG(brouter->flag, OSPF6_ROUTE_REMOVE);
+                       }
+               }
+
                if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_REMOVE)
                    && CHECK_FLAG(brouter->flag, OSPF6_ROUTE_ADD)) {
                        UNSET_FLAG(brouter->flag, OSPF6_ROUTE_REMOVE);
                        UNSET_FLAG(brouter->flag, OSPF6_ROUTE_ADD);
+                       zlog_debug("%s: EVENT unset REOUTE_REMOVE and ROUTE_ADD brouter %s",
+                                  __PRETTY_FUNCTION__, brouter_name);
+                       ospf6_brouter_debug_print(brouter);
                }
 
                if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_REMOVE)) {
index 5b36f6300a7bd3b7ac7112f51f407b1f628c5d8e..87f3f6edcaa5c65ddf98c13d787d32cd22ff09b0 100644 (file)
@@ -719,10 +719,11 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
                        SET_FLAG(route->flag, OSPF6_ROUTE_BEST);
                        if (IS_OSPF6_DEBUG_ROUTE(MEMORY))
                                zlog_info(
-                                       "%s %p: route add %p: replacing previous best: %p",
+                                       "%s %p: route add %p cost %u: replacing previous best: %p cost %u",
                                        ospf6_route_table_name(table),
                                        (void *)table, (void *)route,
-                                       (void *)next);
+                                       route->path.cost,
+                                       (void *)next, next->path.cost);
                }
 
                route->installed = now;
@@ -743,9 +744,9 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
 
        /* Else, this is the brand new route regarding to the prefix */
        if (IS_OSPF6_DEBUG_ROUTE(MEMORY))
-               zlog_debug("%s %p: route add %p %s : brand new route",
+               zlog_debug("%s %p: route add %p %s cost %u: brand new route",
                           ospf6_route_table_name(table), (void *)table,
-                          (void *)route, buf);
+                          (void *)route, buf, route->path.cost);
        else if (IS_OSPF6_DEBUG_ROUTE(TABLE))
                zlog_debug("%s: route add: brand new route",
                           ospf6_route_table_name(table));