diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2020-09-11 23:59:30 +0200 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2020-09-28 18:41:00 +0200 |
commit | 54a701e4c1d61a7bc72161d501c5e4ee5204c929 (patch) | |
tree | 55d527d251e196daa830eaa50578f0ff1683b763 /sharpd/sharp_zebra.c | |
parent | zebra: free ctx if we skip replace for NHG PROTO routes (diff) | |
download | frr-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.c | 7 |
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); |