From: Donald Sharp Date: Tue, 5 Jan 2021 16:10:19 +0000 (-0500) Subject: pathd: Convert to use our internal frr_weak_random X-Git-Tag: base_7.6~84^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=6f4196d72b2aba8497ff91940db60c57647314ec;p=matthieu%2Ffrr.git pathd: Convert to use our internal frr_weak_random rand() should not be used, we should be using the frr_weak_random() call instead. Signed-off-by: Donald Sharp --- diff --git a/pathd/path_pcep_controller.c b/pathd/path_pcep_controller.c index e467a79a87..255503b459 100644 --- a/pathd/path_pcep_controller.c +++ b/pathd/path_pcep_controller.c @@ -26,6 +26,7 @@ #include "northbound.h" #include "frr_pthread.h" #include "jhash.h" +#include "network.h" #include "pathd/pathd.h" #include "pathd/path_errors.h" @@ -1043,7 +1044,7 @@ void remove_pcc_state(struct ctrl_state *ctrl_state, uint32_t backoff_delay(uint32_t max, uint32_t base, uint32_t retry_count) { uint32_t a = min(max, base * (1 << retry_count)); - uint64_t r = rand(), m = RAND_MAX; + uint64_t r = frr_weak_random(), m = RAND_MAX; uint32_t b = (a / 2) + (r * (a / 2)) / m; return b; } diff --git a/pathd/pathd.c b/pathd/pathd.c index 2e2fa86714..e2c7c95728 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -21,6 +21,7 @@ #include "memory.h" #include "log.h" #include "lib_errors.h" +#include "network.h" #include "pathd/pathd.h" #include "pathd/path_memory.h" @@ -480,7 +481,7 @@ struct srte_candidate *srte_candidate_add(struct srte_policy *policy, candidate->preference = preference; candidate->policy = policy; candidate->type = SRTE_CANDIDATE_TYPE_UNDEFINED; - candidate->discriminator = rand(); + candidate->discriminator = frr_weak_random(); lsp->candidate = candidate; candidate->lsp = lsp;