]> git.puffer.fish Git - matthieu/frr.git/commitdiff
2004-05-05 Anthony.Golia@morganstanley.com
authorpaul <paul>
Wed, 5 May 2004 14:09:37 +0000 (14:09 +0000)
committerpaul <paul>
Wed, 5 May 2004 14:09:37 +0000 (14:09 +0000)
        * ripd.c: (rip_update_jitter) Bound jitter to a more sensible
          value, eg 1/4 of update time.

ripd/ChangeLog
ripd/ripd.c

index 9f4e1badcc313400b9635ee90d7a9d841f05a821..0f3717919bec7cb973866b8ff0822749c6f75f83 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-05 Anthony.Golia@morganstanley.com
+
+       * ripd.c: (rip_update_jitter) Bound jitter to a more sensible
+         value, eg 1/4 of update time.
+         
 2004-05-03 Paul Jakma <paul@dishone.st>
 
        * ripd.c: (rip_rte_process) fix typo in merge of previous patch
index d520af0e46bb9fbb8c20001b480389aa3d4342cf..b2c99f0579a72ea141e860178d651a797f3e1cad 100644 (file)
@@ -2710,7 +2710,22 @@ rip_request_send (struct sockaddr_in *to, struct interface *ifp,
 int
 rip_update_jitter (unsigned long time)
 {
-  return ((rand () % (time + 1)) - (time / 2));
+#define JITTER_BOUND 4
+  /* We want to get the jitter to +/- 1/JITTER_BOUND the interval.
+     Given that, we cannot let time be less than JITTER_BOUND seconds.
+     The RIPv2 RFC says jitter should be small compared to
+     update_time.  We consider 1/JITTER_BOUND to be small.
+  */
+  
+  int jitter_input = time;
+  int jitter;
+  
+  if (jitter_input < JITTER_BOUND)
+    jitter_input = JITTER_BOUND;
+  
+  jitter = (((rand () % ((jitter_input * 2) + 1)) - jitter_input));  
+
+  return jitter/JITTER_BOUND;
 }
 
 void