From: Mark Stapp Date: Wed, 14 Apr 2021 13:24:37 +0000 (-0400) Subject: bgpd: don't overrun fixed zapi array of nexthops X-Git-Tag: base_8.0~137^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=719b209ce73f50879aecafc5919bd1af691b133e;p=matthieu%2Ffrr.git bgpd: don't overrun fixed zapi array of nexthops Avoid overrunning the fixed-size array of nexthops in a zapi_nhg. Signed-off-by: Mark Stapp --- diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index 868238ebdd..6467ff8a28 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -2493,6 +2493,10 @@ static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, if (!CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ACTIVE)) continue; + /* Don't overrun the zapi buffer. */ + if (api_nhg.nexthop_num == MULTIPATH_NUM) + break; + /* overwrite the gw */ if (v4_nhg) nh.gate.ipv4 = es_vtep->vtep_ip; @@ -2514,9 +2518,6 @@ static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, if (!api_nhg.nexthop_num) return; - if (api_nhg.nexthop_num > MULTIPATH_NUM) - return; - zclient_nhg_send(zclient, ZEBRA_NHG_ADD, &api_nhg); }