Skip to content

Commit

Permalink
ripngd: Make sure we do not overuse higher values for ECMP count
Browse files Browse the repository at this point in the history
Use a minimum value of a CLI version and a value of Zebra capabilities.

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 authored and cscarpitta committed Jul 7, 2023
1 parent 517b10e commit 94a94e8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ripngd/ripng_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ struct option longopts[] = {{0}};
/* ripngd 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 ripngd_privs = {
#if defined(FRR_USER)
.user = FRR_USER,
Expand Down
3 changes: 2 additions & 1 deletion ripngd/ripng_nb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ int ripngd_instance_allow_ecmp_modify(struct nb_cb_modify_args *args)
return NB_OK;

ripng = nb_running_get_entry(args->dnode, NULL, true);
ripng->ecmp = yang_dnode_get_uint8(args->dnode, NULL);
ripng->ecmp =
MIN(yang_dnode_get_uint8(args->dnode, NULL), zebra_ecmp_count);
if (!ripng->ecmp) {
ripng_ecmp_disable(ripng);
return NB_OK;
Expand Down
1 change: 0 additions & 1 deletion ripngd/ripng_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ripng_zebra_ipv6_send(struct ripng *ripng, struct agg_node *rp,
Expand Down
2 changes: 2 additions & 0 deletions ripngd/ripngd.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,6 @@ extern void ripng_vrf_init(void);
extern void ripng_vrf_terminate(void);
extern void ripng_cli_init(void);

extern uint32_t zebra_ecmp_count;

#endif /* _ZEBRA_RIPNG_RIPNGD_H */

0 comments on commit 94a94e8

Please sign in to comment.