Skip to content

Commit

Permalink
Merge pull request FRRouting#9699 from manojvn/379032-dev
Browse files Browse the repository at this point in the history
ospf6d: minor struct compare issues.
  • Loading branch information
riw777 authored Oct 6, 2021
2 parents ef11fb0 + bc465fb commit 45ebf5f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 27 deletions.
20 changes: 14 additions & 6 deletions ospf6d/ospf6_abr.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@

unsigned char conf_debug_ospf6_abr;

int ospf6_ls_origin_same(struct ospf6_path *o_path, struct ospf6_path *r_path)
{
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;
}

bool ospf6_check_and_set_router_abr(struct ospf6 *o)
{
struct listnode *node;
Expand Down Expand Up @@ -815,9 +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 ||
(memcmp(&(o_path)->origin, &(route)->path.origin,
sizeof(struct ospf6_ls_origin)) != 0))
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) &&
Expand Down Expand Up @@ -1232,9 +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 &&
(memcmp(&(o_path)->origin, &(route)->path.origin,
sizeof(struct ospf6_ls_origin)) == 0))
if (o_path->area_id == route->path.area_id
&& ospf6_ls_origin_same(o_path, &route->path))
break;
}

Expand Down
2 changes: 2 additions & 0 deletions ospf6d/ospf6_abr.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +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_same(struct ospf6_path *o_path,
struct ospf6_path *r_path);

#endif /*OSPF6_ABR_H*/
9 changes: 2 additions & 7 deletions ospf6d/ospf6_asbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
* origin.
*/
if (o_path->area_id != route->path.area_id
|| (memcmp(&(o_path)->origin, &(route)->path.origin,
sizeof(struct ospf6_ls_origin))
!= 0))
|| !ospf6_ls_origin_same(o_path, &route->path))
continue;

/* Cost is not same then delete current path */
Expand Down Expand Up @@ -411,10 +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
&& (memcmp(&(o_path)->origin,
&(route)->path.origin,
sizeof(struct ospf6_ls_origin))
== 0))
&& ospf6_ls_origin_same(o_path, &route->path))
break;
}
/* If path is not found in old_route paths's list,
Expand Down
1 change: 0 additions & 1 deletion ospf6d/ospf6_flood.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,6 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from,
ospf6_lsa_delete(new);
return;
}
return;
}
}

Expand Down
11 changes: 4 additions & 7 deletions ospf6d/ospf6_intra.c
Original file line number Diff line number Diff line change
Expand Up @@ -1524,9 +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 ||
(memcmp(&(o_path)->origin, &(route)->path.origin,
sizeof(struct ospf6_ls_origin)) != 0))
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 */
Expand Down Expand Up @@ -1630,10 +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 &&
(memcmp(&(o_path)->origin,
&(route)->path.origin,
sizeof(struct ospf6_ls_origin)) == 0))
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,
Expand Down
4 changes: 0 additions & 4 deletions ospf6d/ospf6_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -947,7 +946,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
Expand Down Expand Up @@ -1082,7 +1080,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 */
Expand Down Expand Up @@ -1634,7 +1631,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))
Expand Down
2 changes: 0 additions & 2 deletions ospf6d/ospf6_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 45ebf5f

Please sign in to comment.