]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: pre-fix coccinelle hang points
authorDavid Lamparter <equinox@diac24.net>
Fri, 27 Mar 2020 12:38:25 +0000 (13:38 +0100)
committerDavid Lamparter <equinox@diac24.net>
Tue, 14 Jul 2020 09:27:41 +0000 (11:27 +0200)
coccinelle gets stuck in a few locations in ospf6d...

Signed-off-by: David Lamparter <equinox@diac24.net>
ospf6d/ospf6_abr.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_intra.c

index 1f6cc9d52777e1da76fc4c154ef9d603afaefea8..b3397904925cf2396aeeb065b25bca658da417bc 100644 (file)
@@ -875,7 +875,6 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
        bool old_entry_updated = false;
        struct ospf6_path *path, *o_path, *ecmp_path;
        struct listnode *anode;
-       char adv_router[16];
 
        memset(&prefix, 0, sizeof(prefix));
 
@@ -940,10 +939,6 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
                        if (listcount(route->paths) > 1) {
                                for (ALL_LIST_ELEMENTS_RO(route->paths, anode,
                                                          o_path)) {
-                                       inet_ntop(AF_INET,
-                                                 &o_path->origin.adv_router,
-                                                 adv_router,
-                                                 sizeof(adv_router));
                                        if (o_path->origin.id == lsa->header->id
                                            && o_path->origin.adv_router ==
                                            lsa->header->adv_router) {
@@ -951,9 +946,9 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
 
                                                if (is_debug)
                                                        zlog_debug(
-                                                               "%s: old entry found in paths, adv_router %s",
+                                                               "%s: old entry found in paths, adv_router %pI4",
                                                                __func__,
-                                                               adv_router);
+                                                               &o_path->origin.adv_router);
 
                                                break;
                                        }
@@ -1185,14 +1180,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
                        listnode_add_sort(old_route->paths, ecmp_path);
 
                        if (is_debug) {
-                               prefix2str(&route->prefix, buf, sizeof(buf));
-                               inet_ntop(AF_INET,
-                                         &ecmp_path->origin.adv_router,
-                                         adv_router, sizeof(adv_router));
                                zlog_debug(
-                                       "%s: route %s cost %u another path %s added with nh %u, effective paths %u nh %u",
-                                       __func__, buf, old_route->path.cost,
-                                       adv_router,
+                                       "%s: route %pFX cost %u another path %pI4 added with nh %u, effective paths %u nh %u",
+                                       __func__, &route->prefix,
+                                       old_route->path.cost,
+                                       &ecmp_path->origin.adv_router,
                                        listcount(ecmp_path->nh_list),
                                        old_route->paths
                                                ? listcount(old_route->paths)
@@ -1239,12 +1231,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
 
        if (old_entry_updated == false) {
                if (is_debug) {
-                       inet_ntop(AF_INET, &route->path.origin.adv_router,
-                                 adv_router, sizeof(adv_router));
                        zlog_debug(
-                               "%s: Install route: %s cost %u nh %u adv_router %",
+                               "%s: Install route: %s cost %u nh %u adv_router %pI4",
                                __func__, buf, route->path.cost,
-                               listcount(route->nh_list), adv_router);
+                               listcount(route->nh_list),
+                               &route->path.origin.adv_router);
                }
 
                path = ospf6_path_dup(&route->path);
index cea4dd93e5161b69c58c38444d7337e6b056a990..5562529ea82ad679bfb2c9596f6f3ae78eac0d8a 100644 (file)
@@ -244,11 +244,9 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
                                continue;
 
                        if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                               prefix2str(&old_route->prefix, buf,
-                                          sizeof(buf));
                                zlog_debug(
-                                       "%s: route %s cost old %u new %u is not same, replace route",
-                                       __func__, buf, o_path->cost,
+                                       "%s: route %pFX cost old %u new %u is not same, replace route",
+                                       __func__, &old_route->prefix, o_path->cost,
                                        route->path.cost);
                        }
 
@@ -308,11 +306,9 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
                                }
                        } else {
                                if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                                       prefix2str(&old_route->prefix, buf,
-                                                  sizeof(buf));
                                        zlog_debug(
-                                               "%s: route %s old cost %u new cost %u, delete old entry.",
-                                               __func__, buf,
+                                               "%s: route %pFX old cost %u new cost %u, delete old entry.",
+                                               __func__, &old_route->prefix,
                                                old_route->path.cost,
                                                route->path.cost);
                                }
@@ -339,11 +335,10 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
                    && (old_route->path.u.cost_e2 == route->path.u.cost_e2)) {
 
                        if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                               prefix2str(&old_route->prefix, buf,
-                                          sizeof(buf));
                                zlog_debug(
-                                       "%s: old route %s path  cost %u e2 %u",
-                                       __func__, buf, old_route->path.cost,
+                                       "%s: old route %pFX path  cost %u e2 %u",
+                                       __func__, &old_route->prefix,
+                                       old_route->path.cost,
                                        old_route->path.u.cost_e2);
                        }
                        route_found = true;
@@ -562,7 +557,6 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
        struct ospf6_as_external_lsa *external;
        struct prefix prefix;
        struct ospf6_route *route, *nroute, *route_to_del;
-       char buf[PREFIX2STR_BUFFER];
 
        external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END(
                lsa->header);
@@ -612,8 +606,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
        route = ospf6_route_lookup(&prefix, ospf6->route_table);
        if (route == NULL) {
                if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                       prefix2str(&prefix, buf, sizeof(buf));
-                       zlog_debug("AS-External route %s not found", buf);
+                       zlog_debug("AS-External route %pFX not found", &prefix);
                }
 
                ospf6_route_delete(route_to_del);
@@ -621,10 +614,9 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
        }
 
        if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-               prefix2str(&prefix, buf, sizeof(buf));
                zlog_debug(
-                       "%s: Current route %s cost %u e2 %u, route to del cost %u e2 %u",
-                       __func__, buf, route->path.cost, route->path.u.cost_e2,
+                       "%s: Current route %pFX cost %u e2 %u, route to del cost %u e2 %u",
+                       __func__, &prefix, route->path.cost, route->path.u.cost_e2,
                        route_to_del->path.cost, route_to_del->path.u.cost_e2);
        }
 
@@ -668,11 +660,9 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
                                                              .cost_e2)) {
                                        if (IS_OSPF6_DEBUG_EXAMIN(
                                                    AS_EXTERNAL)) {
-                                               prefix2str(&prefix, buf,
-                                                          sizeof(buf));
                                                zlog_debug(
-                                                       "%s: route %s to delete is not same, cost %u del cost %u. skip",
-                                                       __func__, buf,
+                                                       "%s: route %pFX to delete is not same, cost %u del cost %u. skip",
+                                                       __func__, &prefix,
                                                        route->path.cost,
                                                        route_to_del->path
                                                                .cost);
@@ -681,10 +671,9 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
                                }
 
                                if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                                       prefix2str(&prefix, buf, sizeof(buf));
                                        zlog_debug(
-                                               "%s: route %s path found with cost %u nh %u to remove.",
-                                               __func__, buf, route->path.cost,
+                                               "%s: route %pFX path found with cost %u nh %u to remove.",
+                                               __func__, &prefix, route->path.cost,
                                                listcount(o_path->nh_list));
                                }
 
@@ -723,16 +712,14 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
                                }
 
                                if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                                       prefix2str(&route->prefix, buf,
-                                                  sizeof(buf));
                                        zlog_debug(
-                                               "%s: AS-External %u route %s update paths %u nh %u",
+                                               "%s: AS-External %u route %pFX update paths %u nh %u",
                                                __func__,
                                                (route->path.type
                                                 == OSPF6_PATH_TYPE_EXTERNAL1)
                                                        ? 1
                                                        : 2,
-                                               buf, listcount(route->paths),
+                                               &route->prefix, listcount(route->paths),
                                                route->nh_list ? listcount(
                                                        route->nh_list)
                                                               : 0);
@@ -784,10 +771,9 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
                                || (route->path.u.cost_e2
                                    != route_to_del->path.u.cost_e2))) {
                                if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                                       prefix2str(&prefix, buf, sizeof(buf));
                                        zlog_debug(
-                                               "%s: route %s to delete is not same, cost %u del cost %u. skip",
-                                               __func__, buf, route->path.cost,
+                                               "%s: route %pFX to delete is not same, cost %u del cost %u. skip",
+                                               __func__, &prefix, route->path.cost,
                                                route_to_del->path.cost);
                                }
                                continue;
@@ -800,14 +786,13 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
                                continue;
                }
                if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                       prefix2str(&route->prefix, buf, sizeof(buf));
                        zlog_debug(
-                               "%s: AS-External %u route remove %s cost %u(%u) nh %u",
+                               "%s: AS-External %u route remove %pFX cost %u(%u) nh %u",
                                __func__,
                                route->path.type == OSPF6_PATH_TYPE_EXTERNAL1
                                        ? 1
                                        : 2,
-                               buf, route->path.cost, route->path.u.cost_e2,
+                               &route->prefix, route->path.cost, route->path.u.cost_e2,
                                listcount(route->nh_list));
                }
                ospf6_route_remove(route, ospf6->route_table);
index b700899ccf802f934d99f6078d210259627ac285..ef5d1d058356ba4a5cd37a63200485f21cb5d430 100644 (file)
@@ -1400,11 +1400,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
                                continue;
 
                        if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
-                               prefix2str(&old_route->prefix, buf,
-                                          sizeof(buf));
                                zlog_debug(
-                                       "%s: route %s cost old %u new %u is not same, replace route",
-                                       __func__, buf, o_path->cost,
+                                       "%s: route %pFX cost old %u new %u is not same, replace route",
+                                       __func__, &old_route->prefix, o_path->cost,
                                        route->path.cost);
                        }
 
@@ -1458,11 +1456,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
                                }
                        } else {
                                if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
-                                       prefix2str(&old_route->prefix, buf,
-                                                  sizeof(buf));
                                        zlog_debug(
-                                               "%s: route %s old cost %u new cost %u, delete old entry.",
-                                               __func__, buf,
+                                               "%s: route %pFX old cost %u new cost %u, delete old entry.",
+                                               __func__, &old_route->prefix,
                                                old_route->path.cost,
                                                route->path.cost);
                                }
@@ -1515,11 +1511,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
                                listnode_add_sort(old_route->paths, ecmp_path);
 
                                if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) {
-                                       prefix2str(&route->prefix, buf,
-                                                  sizeof(buf));
                                        zlog_debug(
-                                               "%s: route %s %p another path added with nh %u, effective paths %u nh %u",
-                                               __func__, buf,
+                                               "%s: route %pFX %p another path added with nh %u, effective paths %u nh %u",
+                                               __func__, &route->prefix,
                                                (void *)old_route,
                                                listcount(ecmp_path->nh_list),
                                                old_route->paths ? listcount(