]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: code cleanup.
authorManoj Naragund <mnaragund@vmware.com>
Thu, 30 Sep 2021 17:28:11 +0000 (10:28 -0700)
committerManoj Naragund <mnaragund@vmware.com>
Wed, 6 Oct 2021 15:54:47 +0000 (08:54 -0700)
removal of some of the deadcode in ospf6d.

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
ospf6d/ospf6_abr.c
ospf6d/ospf6_abr.h
ospf6d/ospf6_asbr.c
ospf6d/ospf6_flood.c
ospf6d/ospf6_intra.c
ospf6d/ospf6_message.c
ospf6d/ospf6_route.c

index 057e1d9ea25fba5993716fa6182401333b50a45b..f3e8127a80b64eee8d29d02f426410964020cba0 100644 (file)
 
 unsigned char conf_debug_ospf6_abr;
 
-int ospf6_ls_origin_cmp(struct ospf6_path *o_path, struct ospf6_route *route)
+int ospf6_ls_origin_same(struct ospf6_path *o_path, struct ospf6_path *r_path)
 {
-       if (((o_path->origin.type == route->path.origin.type)
-                               && (o_path->origin.id == route->path.origin.id)
-                               && (o_path->origin.adv_router ==
-                                       route->path.origin.adv_router)))
+       if (((o_path->origin.type == r_path->origin.type)
+            && (o_path->origin.id == r_path->origin.id)
+            && (o_path->origin.adv_router == r_path->origin.adv_router)))
                return 1;
        else
                return 0;
@@ -826,8 +825,8 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route,
        struct ospf6_nexthop *nh, *rnh;
 
        for (ALL_LIST_ELEMENTS(old_route->paths, anode, anext, o_path)) {
-               if (o_path->area_id != route->path.area_id ||
-                   (!ospf6_ls_origin_cmp(o_path, route)))
+               if (o_path->area_id != route->path.area_id
+                   || !ospf6_ls_origin_same(o_path, &route->path))
                        continue;
 
                if ((o_path->cost == route->path.cost) &&
@@ -1242,8 +1241,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
 
                for (ALL_LIST_ELEMENTS_RO(old_route->paths, anode,
                                                  o_path)) {
-                       if (o_path->area_id == route->path.area_id &&
-                           (ospf6_ls_origin_cmp(o_path, route)))
+                       if (o_path->area_id == route->path.area_id
+                           && ospf6_ls_origin_same(o_path, &route->path))
                                break;
                }
 
index 75e051761db74ff8591ccec222e833ba785186fe..a4dc4ddc843e32708ef82de6c7b9e681e5e3d029 100644 (file)
@@ -89,7 +89,7 @@ extern void ospf6_abr_init(void);
 extern void ospf6_abr_range_update(struct ospf6_route *range,
                                   struct ospf6 *ospf6);
 extern void ospf6_abr_remove_unapproved_summaries(struct ospf6 *ospf6);
-extern int ospf6_ls_origin_cmp(struct ospf6_path *o_path,
-               struct ospf6_route *route);
+extern int ospf6_ls_origin_same(struct ospf6_path *o_path,
+                               struct ospf6_path *r_path);
 
 #endif /*OSPF6_ABR_H*/
index beed61d047317c819ccc9c2d5294cf60808c2dbc..c5ee22bc5eecfda2d42559b83f5d1968b6fe17c7 100644 (file)
@@ -290,7 +290,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
                         * origin.
                         */
                        if (o_path->area_id != route->path.area_id
-                           || (!ospf6_ls_origin_cmp(o_path, route)))
+                           || !ospf6_ls_origin_same(o_path, &route->path))
                                continue;
 
                        /* Cost is not same then delete current path */
@@ -409,7 +409,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
                        for (ALL_LIST_ELEMENTS_RO(old_route->paths, anode,
                                                  o_path)) {
                                if (o_path->area_id == route->path.area_id
-                                   && (ospf6_ls_origin_cmp(o_path, route)))
+                                   && ospf6_ls_origin_same(o_path, &route->path))
                                        break;
                        }
                        /* If path is not found in old_route paths's list,
index 186eac35a505d2a30c16a24360bc1add5d7b5666..0c004b85af02d7b782f2d3cf40de3964653eb1ef 100644 (file)
@@ -1239,7 +1239,6 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from,
                        ospf6_lsa_delete(new);
                        return;
                }
-               return;
        }
 }
 
index 27e21a04171886e1781bac1e9fa84abd5dc46bfd..830a0960c282977519c3bb7ec05b5251c38c17b9 100644 (file)
@@ -1524,8 +1524,8 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
                        /* Check old route path and route has same
                         * origin.
                         */
-                       if (o_path->area_id != route->path.area_id ||
-                           (!ospf6_ls_origin_cmp(o_path, route)))
+                       if (o_path->area_id != route->path.area_id
+                           || !ospf6_ls_origin_same(o_path, &route->path))
                                continue;
 
                        /* Cost is not same then delete current path */
@@ -1629,8 +1629,8 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
                         */
                        for (ALL_LIST_ELEMENTS_RO(old_route->paths, anode,
                                                  o_path)) {
-                               if (o_path->area_id == route->path.area_id &&
-                                   (ospf6_ls_origin_cmp(o_path, route)))
+                               if (o_path->area_id == route->path.area_id
+                                   && ospf6_ls_origin_same(o_path, &route->path))
                                        break;
                        }
                        /* If path is not found in old_route paths's list,
index 64de9bae4167a1468b82babe4438faeaeca33787..23610f649d47a8570bf1004c1c1932ca06c84b7e 100644 (file)
@@ -726,7 +726,6 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
                                zlog_debug("Ignoring LSA of reserved scope");
                        ospf6_lsa_delete(his);
                        continue;
-                       break;
                }
 
                if (ntohs(his->header->type) == OSPF6_LSTYPE_AS_EXTERNAL
@@ -949,7 +948,6 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
                                zlog_debug("Ignoring LSA of reserved scope");
                        ospf6_lsa_delete(his);
                        continue;
-                       break;
                }
 
                if (OSPF6_LSA_SCOPE(his->header->type) == OSPF6_SCOPE_AS
@@ -1084,7 +1082,6 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst,
                        if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV))
                                zlog_debug("Ignoring LSA of reserved scope");
                        continue;
-                       break;
                }
 
                /* Find database copy */
@@ -1636,7 +1633,6 @@ static void ospf6_lsack_recv(struct in6_addr *src, struct in6_addr *dst,
                                zlog_debug("Ignoring LSA of reserved scope");
                        ospf6_lsa_delete(his);
                        continue;
-                       break;
                }
 
                if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV))
index 8bfd3b7124df197a74ad8b49ae78d38bbf04df95..4b87c4cf3089b44f612f81a6a00ecd50f1967d93 100644 (file)
@@ -408,8 +408,6 @@ int ospf6_nexthop_cmp(struct ospf6_nexthop *a, struct ospf6_nexthop *b)
        else
                return memcmp(&a->address, &b->address,
                              sizeof(struct in6_addr));
-
-       return 0;
 }
 
 static int ospf6_path_cmp(struct ospf6_path *a, struct ospf6_path *b)