PIMD: Fix code to use srandom/random
pimd rolled it's own solution to random #'s, that was not
terribly random. Rely on the underlying system to generate
random #'s for us
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index dc3e9a2..6f806a1 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -36,7 +36,6 @@
#include "pim_pim.h"
#include "pim_neighbor.h"
#include "pim_ifchannel.h"
-#include "pim_rand.h"
#include "pim_sock.h"
#include "pim_time.h"
#include "pim_ssmpingd.h"
@@ -839,7 +838,7 @@
effective_override_interval_msec =
pim_if_effective_override_interval_msec(ifp);
- t_override_msec = pim_rand_next(0, effective_override_interval_msec);
+ t_override_msec = random() % (effective_override_interval_msec + 1);
return t_override_msec;
}
@@ -902,6 +901,7 @@
{
struct pim_interface *pim_ifp;
long t_suppressed_msec;
+ uint32_t ramount = 0;
pim_ifp = ifp->info;
zassert(pim_ifp);
@@ -911,8 +911,8 @@
return 0;
/* t_suppressed = t_periodic * rand(1.1, 1.4) */
-
- t_suppressed_msec = qpim_t_periodic * pim_rand_next(1100, 1400);
+ ramount = 1100 + (random() % (1400 - 1100 + 1));
+ t_suppressed_msec = qpim_t_periodic * ramount;
return t_suppressed_msec;
}