summaryrefslogtreecommitdiff
path: root/ripd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-05-17 22:47:56 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2023-05-18 21:32:32 +0300
commit1b839d486a8a392f9122bb5483b26540603e7550 (patch)
treedc4023e0886cbc721c03226280c9e2464ac27964 /ripd
parent98f71533f6a5e2396c29e9ef002ee120dcd026e9 (diff)
ripd: Make sure we do not overuse higher values for ECMP count
Use a minimum value of a CLI version and a value of Zebra capabilities. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'ripd')
-rw-r--r--ripd/rip_main.c2
-rw-r--r--ripd/rip_nb_config.c3
-rw-r--r--ripd/rip_zebra.c1
-rw-r--r--ripd/ripd.h2
4 files changed, 6 insertions, 2 deletions
diff --git a/ripd/rip_main.c b/ripd/rip_main.c
index 0e26662cdb..ac358ebbaf 100644
--- a/ripd/rip_main.c
+++ b/ripd/rip_main.c
@@ -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,
diff --git a/ripd/rip_nb_config.c b/ripd/rip_nb_config.c
index 1117ec9ff7..8d3b670596 100644
--- a/ripd/rip_nb_config.c
+++ b/ripd/rip_nb_config.c
@@ -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;
diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c
index 834c7d2d65..5bf51c2f15 100644
--- a/ripd/rip_zebra.c
+++ b/ripd/rip_zebra.c
@@ -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,
diff --git a/ripd/ripd.h b/ripd/ripd.h
index 2db1e5a6b0..ac4a51f586 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -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 */