]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_ase.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / ospfd / ospf_ase.c
index 0c2ddc96474b3f8b92d15fea5a3a2ea198be38a2..9492de544f6d792690d2cf254c82971401e17720 100644 (file)
@@ -77,7 +77,7 @@ struct ospf_route *ospf_find_asbr_route(struct ospf *ospf,
 
        /* If none is found -- look through all. */
        if (listcount(chosen) == 0) {
-               list_delete_and_null(&chosen);
+               list_delete(&chosen);
                chosen = rn->info;
        }
 
@@ -98,7 +98,7 @@ struct ospf_route *ospf_find_asbr_route(struct ospf *ospf,
                }
 
        if (chosen != rn->info)
-               list_delete_and_null(&chosen);
+               list_delete(&chosen);
 
        return best;
 }
@@ -241,7 +241,7 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf,
 
 static struct ospf_route *
 ospf_ase_calculate_new_route(struct ospf_lsa *lsa,
-                            struct ospf_route *asbr_route, u_int32_t metric)
+                            struct ospf_route *asbr_route, uint32_t metric)
 {
        struct as_external_lsa *al;
        struct ospf_route *new;
@@ -282,12 +282,13 @@ ospf_ase_calculate_new_route(struct ospf_lsa *lsa,
 
 int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
 {
-       u_int32_t metric;
+       uint32_t metric;
        struct as_external_lsa *al;
        struct ospf_route *asbr_route;
        struct prefix_ipv4 asbr, p;
        struct route_node *rn;
        struct ospf_route *new, * or ;
+       char buf1[INET_ADDRSTRLEN];
        int ret;
 
        assert(lsa);
@@ -304,10 +305,14 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
                return 0;
        }
 
-       if (IS_DEBUG_OSPF(lsa, LSA))
+       if (IS_DEBUG_OSPF(lsa, LSA)) {
+               snprintf(buf1, INET_ADDRSTRLEN, "%s",
+                        inet_ntoa(al->header.adv_router));
                zlog_debug(
-                       "Route[External]: Calculate AS-external-LSA to %s/%d",
-                       inet_ntoa(al->header.id), ip_masklen(al->mask));
+                       "Route[External]: Calculate AS-external-LSA to %s/%d adv_router %s",
+                       inet_ntoa(al->header.id), ip_masklen(al->mask), buf1);
+       }
+
        /* (1) If the cost specified by the LSA is LSInfinity, or if the
               LSA's LS age is equal to MaxAge, then examine the next LSA. */
        if ((metric = GET_METRIC(al->e[0].metric)) >= OSPF_LS_INFINITY) {
@@ -459,8 +464,9 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
 
        if (!rn || (or = rn->info) == NULL) {
                if (IS_DEBUG_OSPF(lsa, LSA))
-                       zlog_debug("Route[External]: Adding a new route %s/%d",
-                                  inet_ntoa(p.prefix), p.prefixlen);
+                       zlog_debug("Route[External]: Adding a new route %s/%d with paths %u",
+                                  inet_ntoa(p.prefix), p.prefixlen,
+                                  listcount(asbr_route->paths));
 
                ospf_route_add(ospf->new_external_route, &p, new, asbr_route);
 
@@ -543,7 +549,7 @@ static int ospf_ase_route_match_same(struct route_table *rt,
                                     struct ospf_route *newor)
 {
        struct route_node *rn;
-       struct ospf_route * or ;
+       struct ospf_route *or;
        struct ospf_path *op;
        struct ospf_path *newop;
        struct listnode *n1;
@@ -559,6 +565,9 @@ static int ospf_ase_route_match_same(struct route_table *rt,
        route_unlock_node(rn);
 
        or = rn->info;
+
+       assert(or);
+
        if (or->path_type != newor->path_type)
                return 0;
 
@@ -577,12 +586,14 @@ static int ospf_ase_route_match_same(struct route_table *rt,
                return 0;
        }
 
+       assert(or->paths);
+
        if (or->paths->count != newor->paths->count)
                return 0;
 
        /* Check each path. */
        for (n1 = listhead(or->paths), n2 = listhead(newor->paths); n1 && n2;
-            n1 = listnextnode(n1), n2 = listnextnode(n2)) {
+            n1 = listnextnode_unchecked(n1), n2 = listnextnode_unchecked(n2)) {
                op = listgetdata(n1);
                newop = listgetdata(n2);
 
@@ -764,7 +775,7 @@ void ospf_ase_external_lsas_finish(struct route_table *rt)
                if ((lst = rn->info) != NULL) {
                        for (ALL_LIST_ELEMENTS(lst, node, nnode, lsa))
                                ospf_lsa_unlock(&lsa); /* external_lsas lst */
-                       list_delete_and_null(&lst);
+                       list_delete(&lst);
                }
 
        route_table_finish(rt);