diff options
author | Manoj Naragund <mnaragund@vmware.com> | 2021-09-30 18:15:18 +0200 |
---|---|---|
committer | Manoj Naragund <mnaragund@vmware.com> | 2021-09-30 18:53:26 +0200 |
commit | 25dd89e398b41c50e0e928a01d5ce8376f60c220 (patch) | |
tree | 955ca0c247a20220f114e54b948981f084bf8271 /ospf6d/ospf6_abr.c | |
parent | Merge pull request #9422 from pguibert6WIND/update_autort_l3vni (diff) | |
download | frr-25dd89e398b41c50e0e928a01d5ce8376f60c220.tar.xz frr-25dd89e398b41c50e0e928a01d5ce8376f60c220.zip |
ospf6d: minor struct compare issues.
Problem Statement:
Multiple struct compare using memcmp, which might result in issue due to
structure padding/alignment.
Fix:
The code changes involve structure member by member comparison to
remove any issues related to padding/alignment.
Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
(cherry picked from commit 67db821a1d6d68b19862d50b68ed19278c5f2422)
Diffstat (limited to 'ospf6d/ospf6_abr.c')
-rw-r--r-- | ospf6d/ospf6_abr.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 57165201b..057e1d9ea 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -53,6 +53,17 @@ unsigned char conf_debug_ospf6_abr; +int ospf6_ls_origin_cmp(struct ospf6_path *o_path, struct ospf6_route *route) +{ + 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))) + return 1; + else + return 0; +} + bool ospf6_check_and_set_router_abr(struct ospf6 *o) { struct listnode *node; @@ -816,8 +827,7 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route, 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)) + (!ospf6_ls_origin_cmp(o_path, route))) continue; if ((o_path->cost == route->path.cost) && @@ -1233,8 +1243,7 @@ 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)) + (ospf6_ls_origin_cmp(o_path, route))) break; } |