diff options
author | Russ White <russ@riw.us> | 2021-09-10 20:29:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 20:29:53 +0200 |
commit | 3e2321b88c4d2ff1f3dadfcc1b6cfd8d5e785f87 (patch) | |
tree | a9ff89fd339f4b6da8abbaea4fe13c318a95801c /ospf6d | |
parent | Merge pull request #9597 from donaldsharp/ospf6_header_cleanup (diff) | |
parent | ospf6d: break early on route prefix mismatch (diff) | |
download | frr-3e2321b88c4d2ff1f3dadfcc1b6cfd8d5e785f87.tar.xz frr-3e2321b88c4d2ff1f3dadfcc1b6cfd8d5e785f87.zip |
Merge pull request #9019 from pjdruddy/ospfv3-early-break-list-walk
ospf6d: break early on route prefix mismatch
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_abr.c | 13 | ||||
-rw-r--r-- | ospf6d/ospf6_asbr.c | 21 | ||||
-rw-r--r-- | ospf6d/ospf6_intra.c | 20 |
3 files changed, 41 insertions, 13 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index aa8547567..fe1845907 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -1201,9 +1201,16 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) __func__, &prefix, listcount(old->paths)); } for (old_route = old; old_route; old_route = old_route->next) { - if (!ospf6_route_is_same(old_route, route) || - (old_route->type != route->type) || - (old_route->path.type != route->path.type)) + + /* The route linked-list is grouped in batches of prefix. + * If the new prefix is not the same as the one of interest + * then we have walked over the end of the batch and so we + * should break rather than continuing unnecessarily. + */ + if (!ospf6_route_is_same(old_route, route)) + break; + if ((old_route->type != route->type) + || (old_route->path.type != route->path.type)) continue; if ((ospf6_route_cmp(route, old_route) != 0)) { diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index b5bf81c21..90c9fdf23 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -262,8 +262,14 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, next_route = old_route->next; - if (!ospf6_route_is_same(old_route, route) - || (old_route->path.type != route->path.type)) + /* The route linked-list is grouped in batches of prefix. + * If the new prefix is not the same as the one of interest + * then we have walked over the end of the batch and so we + * should break rather than continuing unnecessarily. + */ + if (!ospf6_route_is_same(old_route, route)) + break; + if (old_route->path.type != route->path.type) continue; /* Current and New route has same origin, @@ -367,11 +373,14 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, /* Add new route */ for (old_route = old; old_route; old_route = old_route->next) { - /* Current and New Route prefix or route type - * is not same skip this current node. + /* The route linked-list is grouped in batches of prefix. + * If the new prefix is not the same as the one of interest + * then we have walked over the end of the batch and so we + * should break rather than continuing unnecessarily. */ - if (!ospf6_route_is_same(old_route, route) - || (old_route->path.type != route->path.type)) + if (!ospf6_route_is_same(old_route, route)) + break; + if (old_route->path.type != route->path.type) continue; /* Old Route and New Route have Equal Cost, Merge NHs */ diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index e4db8f3a0..06a950156 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1470,8 +1470,14 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, for (old_route = old; old_route; old_route = old_route->next) { bool route_updated = false; - if (!ospf6_route_is_same(old_route, route) || - (old_route->path.type != route->path.type)) + /* The route linked-list is grouped in batches of prefix. + * If the new prefix is not the same as the one of interest + * then we have walked over the end of the batch and so we + * should break rather than continuing unnecessarily. + */ + if (!ospf6_route_is_same(old_route, route)) + break; + if (old_route->path.type != route->path.type) continue; /* Current and New route has same origin, @@ -1569,8 +1575,14 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, for (old_route = old; old_route; old_route = old_route->next) { - if (!ospf6_route_is_same(old_route, route) || - (old_route->path.type != route->path.type)) + /* The route linked-list is grouped in batches of prefix. + * If the new prefix is not the same as the one of interest + * then we have walked over the end of the batch and so we + * should break rather than continuing unnecessarily. + */ + if (!ospf6_route_is_same(old_route, route)) + break; + if (old_route->path.type != route->path.type) continue; /* Old Route and New Route have Equal Cost, Merge NHs */ |