Skip to content

Commit

Permalink
Merge pull request FRRouting#8469 from mjstapp/fix_bgp_nhg_mpath
Browse files Browse the repository at this point in the history
bgpd: don't overrun fixed zapi array of nexthops
  • Loading branch information
rwestphal committed Apr 15, 2021
2 parents 8b74cd9 + 719b209 commit 9759c51
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bgpd/bgp_evpn_mh.c
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down

0 comments on commit 9759c51

Please sign in to comment.