diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-04-17 10:35:15 -0300 | 
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-04-17 20:57:43 -0300 | 
| commit | 5920b3eb38a6cfd1c9b87106aa7403171408f0bd (patch) | |
| tree | fe6c96488ab537bebfeb07f658b4d500ba20c446 /zebra/irdp_main.c | |
| parent | 4110aa2cb342fb0f025746c4b7df7707f69334c5 (diff) | |
*: 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 'zebra/irdp_main.c')
| -rw-r--r-- | zebra/irdp_main.c | 5 | 
1 files changed, 3 insertions, 2 deletions
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index a1e6e8248e..b868d23a94 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -66,6 +66,7 @@  #include "if.h"  #include "sockunion.h"  #include "log.h" +#include "network.h"  /* GLOBAL VARS */ @@ -233,7 +234,7 @@ int irdp_send_thread(struct thread *t_advert)  		}  	tmp = irdp->MaxAdvertInterval - irdp->MinAdvertInterval; -	timer = random() % (tmp + 1); +	timer = frr_weak_random() % (tmp + 1);  	timer = irdp->MinAdvertInterval + timer;  	if (irdp->irdp_sent < MAX_INITIAL_ADVERTISEMENTS @@ -303,7 +304,7 @@ void process_solicit(struct interface *ifp)  		thread_cancel(irdp->t_advertise);  	irdp->t_advertise = NULL; -	timer = (random() % MAX_RESPONSE_DELAY) + 1; +	timer = (frr_weak_random() % MAX_RESPONSE_DELAY) + 1;  	irdp->t_advertise = NULL;  	thread_add_timer(zrouter.master, irdp_send_thread, ifp, timer,  | 
