From 771626860adfc30c00f70d993ccb8f4d7c0c0c63 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 19 Jun 2015 19:26:18 -0400 Subject: 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 --- pimd/pim_iface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pimd/pim_iface.c') diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index dc3e9a2b..6f806a1b 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 @@ int pim_if_t_override_msec(struct interface *ifp) 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 @@ long pim_if_t_suppressed_msec(struct interface *ifp) { struct pim_interface *pim_ifp; long t_suppressed_msec; + uint32_t ramount = 0; pim_ifp = ifp->info; zassert(pim_ifp); @@ -911,8 +911,8 @@ long pim_if_t_suppressed_msec(struct interface *ifp) 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; } -- cgit v1.2.3