summaryrefslogtreecommitdiff
path: root/watchfrr/watchfrr.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2020-04-17 10:35:15 -0300
committerRafael Zalamena <rzalamena@opensourcerouting.org>2020-04-17 20:57:43 -0300
commit5920b3eb38a6cfd1c9b87106aa7403171408f0bd (patch)
treefe6c96488ab537bebfeb07f658b4d500ba20c446 /watchfrr/watchfrr.c
parent4110aa2cb342fb0f025746c4b7df7707f69334c5 (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 'watchfrr/watchfrr.c')
-rw-r--r--watchfrr/watchfrr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c
index d6d8f77243..2db612adca 100644
--- a/watchfrr/watchfrr.c
+++ b/watchfrr/watchfrr.c
@@ -28,6 +28,7 @@
#include "libfrr.h"
#include "lib_errors.h"
#include "zlog_targets.h"
+#include "network.h"
#include <getopt.h>
#include <sys/un.h>
@@ -43,7 +44,7 @@
#endif
/* Macros to help randomize timers. */
-#define JITTER(X) ((random() % ((X)+1))-((X)/2))
+#define JITTER(X) ((frr_weak_random() % ((X)+1))-((X)/2))
#define FUZZY(X) ((X)+JITTER((X)/20))
#define DEFAULT_PERIOD 5