summaryrefslogtreecommitdiffstats
path: root/sharpd/sharp_zebra.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2020-09-11 23:59:30 +0200
committerStephen Worley <sworley@cumulusnetworks.com>2020-09-28 18:41:00 +0200
commit54a701e4c1d61a7bc72161d501c5e4ee5204c929 (patch)
tree55d527d251e196daa830eaa50578f0ff1683b763 /sharpd/sharp_zebra.c
parentzebra: free ctx if we skip replace for NHG PROTO routes (diff)
downloadfrr-54a701e4c1d61a7bc72161d501c5e4ee5204c929.tar.xz
frr-54a701e4c1d61a7bc72161d501c5e4ee5204c929.zip
sharp: add check for num_nh > multipath
Add a check for installing nexthop_group greater than multipath number. Truncate if we hit it and log a warning to the user. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'sharpd/sharp_zebra.c')
-rw-r--r--sharpd/sharp_zebra.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index 03def0d9b..edbc7460e 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -365,6 +365,13 @@ void nhg_add(uint32_t id, const struct nexthop_group *nhg)
struct nexthop *nh;
for (ALL_NEXTHOPS_PTR(nhg, nh)) {
+ if (nexthop_num >= MULTIPATH_NUM) {
+ zlog_warn(
+ "%s: number of nexthops greater than max multipath size, truncating",
+ __func__);
+ break;
+ }
+
api_nh = &nh_array[nexthop_num];
zapi_nexthop_from_nexthop(api_nh, nh);