]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: use random() to pick initial DD seq#
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 28 Jul 2016 15:23:38 +0000 (17:23 +0200)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Thu, 28 Jul 2016 11:27:47 +0000 (07:27 -0400)
While the idea for this came the other way around - removing
quagga_time() - using random() is actually a better idea here.  It's
seeded by time to begin with, but if ospfd restarts several times in a
short timespan it won't run straight into the same sequence number.

(Should also update the random seed to include microseconds so restarts
within a second use a different seq#)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd/ospf_nsm.c

index 23d1e3fc6cbb7281b742f7b65140aecde29b64f0..6fc7c266acabe71af74207f7e65e9aabe64811f6 100644 (file)
@@ -783,7 +783,7 @@ nsm_change_state (struct ospf_neighbor *nbr, int state)
   if (state == NSM_ExStart)
     {
       if (nbr->dd_seqnum == 0)
-       nbr->dd_seqnum = quagga_time (NULL);
+       nbr->dd_seqnum = (uint32_t)random ();
       else
        nbr->dd_seqnum++;