summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNaveen Thanikachalam <nthanikachal@vmware.com>2020-07-14 18:15:27 +0200
committerNaveen Thanikachalam <nthanikachal@vmware.com>2020-07-14 18:28:38 +0200
commit1410dd3f1b0648d75490995153e8a70fc9eb39f7 (patch)
tree7e6dd99ca4da8c0a15acbf028c4181f174d3753c /lib
parentMerge pull request #6617 from Niral-Networks/niral_dev_isis_vrf (diff)
downloadfrr-1410dd3f1b0648d75490995153e8a70fc9eb39f7.tar.xz
frr-1410dd3f1b0648d75490995153e8a70fc9eb39f7.zip
libfrr: Retain ret value if the best idx is found
While iteratively looking for a best match route-map index amongst a list of potential best match route-map indices, if a candidate best match index is already found, disregard the value returned by the function route_map_apply_match() if it returns either RMAP_NOOP or RMAP_NOMATCH in the following iterations. This is because if a best match route-map index is found then, the return value must always be set to RMAP_MATCH. Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/routemap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/routemap.c b/lib/routemap.c
index 3d69a3495..b2bbdf865 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -1741,14 +1741,19 @@ route_map_get_index(struct route_map *map, const struct prefix *prefix,
* more noops, we retain this return value and
* return this eventually if there are no
* matches.
+ * If a best match route-map index already
+ * exists, do not reset the match_ret.
*/
- if (*match_ret != RMAP_NOMATCH)
+ if (!best_index && (*match_ret != RMAP_NOMATCH))
*match_ret = ret;
} else {
/*
* ret is RMAP_NOMATCH.
+ * If a best match route-map index already
+ * exists, do not reset the match_ret.
*/
- *match_ret = ret;
+ if (!best_index)
+ *match_ret = ret;
}
}