diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-04-17 15:35:15 +0200 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-04-18 01:57:43 +0200 |
commit | 5920b3eb38a6cfd1c9b87106aa7403171408f0bd (patch) | |
tree | fe6c96488ab537bebfeb07f658b4d500ba20c446 /ripngd | |
parent | Merge pull request #6248 from donaldsharp/zebra_snmp (diff) | |
download | frr-5920b3eb38a6cfd1c9b87106aa7403171408f0bd.tar.xz frr-5920b3eb38a6cfd1c9b87106aa7403171408f0bd.zip |
*: replace all random() calls
Replace all `random()` calls with a function called `frr_weak_random()`
and make it clear that it is only supposed to be used for weak random
applications.
Use the annotation described by the Coverity Scan documentation to
ignore `random()` call warnings.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'ripngd')
-rw-r--r-- | ripngd/ripngd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index d26e10386..625adcaa3 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -37,6 +37,7 @@ #include "privs.h" #include "lib_errors.h" #include "northbound_cli.h" +#include "network.h" #include "ripngd/ripngd.h" #include "ripngd/ripng_route.h" @@ -1545,7 +1546,7 @@ int ripng_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; ripng->t_triggered_interval = NULL; thread_add_timer(master, ripng_triggered_interval, ripng, interval, @@ -1950,7 +1951,7 @@ int ripng_request(struct interface *ifp) static int ripng_update_jitter(int time) { - return ((random() % (time + 1)) - (time / 2)); + return ((frr_weak_random() % (time + 1)) - (time / 2)); } void ripng_event(struct ripng *ripng, enum ripng_event event, int sock) |