diff options
author | Mark Stapp <mjs@voltanet.io> | 2021-04-14 15:24:37 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2021-04-14 15:24:37 +0200 |
commit | 719b209ce73f50879aecafc5919bd1af691b133e (patch) | |
tree | fe1aed625f8a6f2c2cdac69d247f5ed443b27757 /bgpd/bgp_evpn_mh.c | |
parent | Merge pull request #8431 from ton31337/feature/show_bgp_version_per_prefix (diff) | |
download | frr-719b209ce73f50879aecafc5919bd1af691b133e.tar.xz frr-719b209ce73f50879aecafc5919bd1af691b133e.zip |
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 <mjs@voltanet.io>
Diffstat (limited to 'bgpd/bgp_evpn_mh.c')
-rw-r--r-- | bgpd/bgp_evpn_mh.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index 868238ebd..6467ff8a2 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); } |