]> git.proxmox.com Git - mirror_frr.git/commitdiff
ripd: Make sure we do not overuse higher values for ECMP count
authorDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 17 May 2023 19:47:56 +0000 (22:47 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 18 May 2023 18:32:32 +0000 (21:32 +0300)
Use a minimum value of a CLI version and a value of Zebra capabilities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
ripd/rip_main.c
ripd/rip_nb_config.c
ripd/rip_zebra.c
ripd/ripd.h

index 0e26662cdb5ca9b815568666fd0f603e0255d2af..ac358ebbaf58b70adafa504b97c8620480a71a29 100644 (file)
@@ -34,6 +34,8 @@ static struct option longopts[] = {{0}};
 /* ripd privileges */
 zebra_capabilities_t _caps_p[] = {ZCAP_NET_RAW, ZCAP_BIND, ZCAP_SYS_ADMIN};
 
+uint32_t zebra_ecmp_count = MULTIPATH_NUM;
+
 struct zebra_privs_t ripd_privs = {
 #if defined(FRR_USER)
        .user = FRR_USER,
index 1117ec9ff7a5112c6b1831e9cf9491554ee0f4aa..8d3b6705968a630d23e5ca4d770dbd3e781f3c83 100644 (file)
@@ -99,7 +99,8 @@ int ripd_instance_allow_ecmp_modify(struct nb_cb_modify_args *args)
                return NB_OK;
 
        rip = nb_running_get_entry(args->dnode, NULL, true);
-       rip->ecmp = yang_dnode_get_uint8(args->dnode, NULL);
+       rip->ecmp =
+               MIN(yang_dnode_get_uint8(args->dnode, NULL), zebra_ecmp_count);
        if (!rip->ecmp) {
                rip_ecmp_disable(rip);
                return NB_OK;
index 834c7d2d6519a96b87ac29fb0131da32aed64589..5bf51c2f15284bc171fcc044cf371a2704a0fce9 100644 (file)
@@ -20,7 +20,6 @@
 
 /* All information about zebra. */
 struct zclient *zclient = NULL;
-uint32_t zebra_ecmp_count = MULTIPATH_NUM;
 
 /* Send ECMP routes to zebra. */
 static void rip_zebra_ipv4_send(struct rip *rip, struct route_node *rp,
index 2db1e5a6b0ee62bb956c03b5fc28374f7da2e569..ac4a51f586fda4e05b1a4ad43a651cdf70c8247b 100644 (file)
@@ -539,4 +539,6 @@ DECLARE_HOOK(rip_ifaddr_del, (struct connected * ifc), (ifc));
 
 extern void rip_ecmp_change(struct rip *rip);
 
+extern uint32_t zebra_ecmp_count;
+
 #endif /* _ZEBRA_RIP_H */