summaryrefslogtreecommitdiffstats
path: root/staticd/static_zebra.c
diff options
context:
space:
mode:
authorMark Stapp <mstapp@nvidia.com>2022-02-17 15:49:41 +0100
committerMark Stapp <mstapp@nvidia.com>2022-02-17 15:56:40 +0100
commit1f7ab1a2cc2a7079c9dd2cb791fc6ba3b9c5a6aa (patch)
treed3c70b3f028898d934faf1e1ca82e7d6400aa37e /staticd/static_zebra.c
parentstaticd: capture zebra's advertised ECMP limit (diff)
downloadfrr-1f7ab1a2cc2a7079c9dd2cb791fc6ba3b9c5a6aa.tar.xz
frr-1f7ab1a2cc2a7079c9dd2cb791fc6ba3b9c5a6aa.zip
staticd: reject route config with too many nexthops
Restrict the number of nexthops for a route to the compiled-in limit. Be careful with the zapi route struct's array of nexthops too. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
Diffstat (limited to 'staticd/static_zebra.c')
-rw-r--r--staticd/static_zebra.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index a62225294..b75e1a1cd 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -414,6 +414,10 @@ extern void static_zebra_route_add(struct static_path *pn, bool install)
api.tableid = pn->table_id;
}
frr_each(static_nexthop_list, &pn->nexthop_list, nh) {
+ /* Don't overrun the nexthop array */
+ if (nh_num == zebra_ecmp_count)
+ break;
+
api_nh = &api.nexthops[nh_num];
if (nh->nh_vrf_id == VRF_UNKNOWN)
continue;