mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
ripd: Do not overrun with more ECMP paths than Zebra supports
Let's say FRR is compiled with ECMP max 16, we enter `allow-ecmp 10`, but Zebra supports only 4. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
75fce4645a
commit
f21277a38a
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
/* All information about zebra. */
|
/* All information about zebra. */
|
||||||
struct zclient *zclient = NULL;
|
struct zclient *zclient = NULL;
|
||||||
|
uint32_t zebra_ecmp_count = MULTIPATH_NUM;
|
||||||
|
|
||||||
/* Send ECMP routes to zebra. */
|
/* Send ECMP routes to zebra. */
|
||||||
static void rip_zebra_ipv4_send(struct rip *rip, struct route_node *rp,
|
static void rip_zebra_ipv4_send(struct rip *rip, struct route_node *rp,
|
||||||
|
@ -30,7 +31,7 @@ static void rip_zebra_ipv4_send(struct rip *rip, struct route_node *rp,
|
||||||
struct zapi_nexthop *api_nh;
|
struct zapi_nexthop *api_nh;
|
||||||
struct listnode *listnode = NULL;
|
struct listnode *listnode = NULL;
|
||||||
struct rip_info *rinfo = NULL;
|
struct rip_info *rinfo = NULL;
|
||||||
int count = 0;
|
uint32_t count = 0;
|
||||||
|
|
||||||
memset(&api, 0, sizeof(api));
|
memset(&api, 0, sizeof(api));
|
||||||
api.vrf_id = rip->vrf->vrf_id;
|
api.vrf_id = rip->vrf->vrf_id;
|
||||||
|
@ -39,7 +40,7 @@ static void rip_zebra_ipv4_send(struct rip *rip, struct route_node *rp,
|
||||||
|
|
||||||
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
||||||
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
|
for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) {
|
||||||
if (count >= MULTIPATH_NUM)
|
if (count >= zebra_ecmp_count)
|
||||||
break;
|
break;
|
||||||
api_nh = &api.nexthops[count];
|
api_nh = &api.nexthops[count];
|
||||||
api_nh->vrf_id = rip->vrf->vrf_id;
|
api_nh->vrf_id = rip->vrf->vrf_id;
|
||||||
|
@ -227,6 +228,11 @@ zclient_handler *const rip_handlers[] = {
|
||||||
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = rip_zebra_read_route,
|
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = rip_zebra_read_route,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void rip_zebra_capabilities(struct zclient_capabilities *cap)
|
||||||
|
{
|
||||||
|
zebra_ecmp_count = MIN(cap->ecmp, zebra_ecmp_count);
|
||||||
|
}
|
||||||
|
|
||||||
void rip_zclient_init(struct event_loop *master)
|
void rip_zclient_init(struct event_loop *master)
|
||||||
{
|
{
|
||||||
/* Set default value to the zebra client structure. */
|
/* Set default value to the zebra client structure. */
|
||||||
|
@ -234,6 +240,7 @@ void rip_zclient_init(struct event_loop *master)
|
||||||
array_size(rip_handlers));
|
array_size(rip_handlers));
|
||||||
zclient_init(zclient, ZEBRA_ROUTE_RIP, 0, &ripd_privs);
|
zclient_init(zclient, ZEBRA_ROUTE_RIP, 0, &ripd_privs);
|
||||||
zclient->zebra_connected = rip_zebra_connected;
|
zclient->zebra_connected = rip_zebra_connected;
|
||||||
|
zclient->zebra_capabilities = rip_zebra_capabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rip_zclient_stop(void)
|
void rip_zclient_stop(void)
|
||||||
|
|
Loading…
Reference in a new issue