diff options
Diffstat (limited to 'ripd/ripd.c')
| -rw-r--r-- | ripd/ripd.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ripd/ripd.c b/ripd/ripd.c index f092da847d..fc53796bd2 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -44,6 +44,7 @@ #include "privs.h" #include "lib_errors.h" #include "northbound_cli.h" +#include "network.h" #include "ripd/ripd.h" #include "ripd/rip_nb.h" @@ -2647,7 +2648,7 @@ static int rip_triggered_update(struct thread *t) random interval between 1 and 5 seconds. If other changes that would trigger updates occur before the timer expires, a single update is triggered when the timer expires. */ - interval = (random() % 5) + 1; + interval = (frr_weak_random() % 5) + 1; rip->t_triggered_interval = NULL; thread_add_timer(master, rip_triggered_interval, rip, interval, @@ -2844,7 +2845,8 @@ static int rip_update_jitter(unsigned long time) if (jitter_input < JITTER_BOUND) jitter_input = JITTER_BOUND; - jitter = (((random() % ((jitter_input * 2) + 1)) - jitter_input)); + jitter = (((frr_weak_random() % ((jitter_input * 2) + 1)) + - jitter_input)); return jitter / JITTER_BOUND; } @@ -2972,8 +2974,8 @@ static void rip_distance_show(struct vty *vty, struct rip *rip) " Address Distance List\n"); header = 0; } - sprintf(buf, "%s/%d", inet_ntoa(rn->p.u.prefix4), - rn->p.prefixlen); + snprintf(buf, sizeof(buf), "%s/%d", + inet_ntoa(rn->p.u.prefix4), rn->p.prefixlen); vty_out(vty, " %-20s %4d %s\n", buf, rdistance->distance, rdistance->access_list ? rdistance->access_list @@ -3327,8 +3329,15 @@ static int config_write_rip(struct vty *vty) return write; } +static int config_write_rip(struct vty *vty); /* RIP node structure. */ -static struct cmd_node rip_node = {RIP_NODE, "%s(config-router)# ", 1}; +static struct cmd_node rip_node = { + .name = "rip", + .node = RIP_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-router)# ", + .config_write = config_write_rip, +}; /* Distribute-list update functions. */ static void rip_distribute_update(struct distribute_ctx *ctx, @@ -3731,7 +3740,7 @@ void rip_vrf_terminate(void) void rip_init(void) { /* Install top nodes. */ - install_node(&rip_node, config_write_rip); + install_node(&rip_node); /* Install rip commands. */ install_element(VIEW_NODE, &show_ip_rip_cmd); |
