]> git.puffer.fish Git - mirror/frr.git/commitdiff
2005-03-13 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
authorajs <ajs>
Sun, 13 Mar 2005 19:27:22 +0000 (19:27 +0000)
committerajs <ajs>
Sun, 13 Mar 2005 19:27:22 +0000 (19:27 +0000)
* ospf_lsa.c: (ospf_lsa_refresh_walker) If the system clock jumps
  backward, then current time may be less than
  ospf->lsa_refresher_started.  This was causing invalid values
  for ospf->lsa_refresh_queue.index resulting in infinite loops.
  Problem fixed by casting the expression to unsigned before taking
  the modulus.

[backport candidate]

ospfd/ChangeLog
ospfd/ospf_lsa.c

index 668999f93832fc401852a0a2eaf94ff566da87bc..f169b8e2819f50a3aee3080eb42a004cffbec9f7 100644 (file)
@@ -1,3 +1,12 @@
+2005-03-13 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * ospf_lsa.c: (ospf_lsa_refresh_walker) If the system clock jumps
+         backward, then current time may be less than
+         ospf->lsa_refresher_started.  This was causing invalid values
+         for ospf->lsa_refresh_queue.index resulting in infinite loops.
+         Problem fixed by casting the expression to unsigned before taking
+         the modulus.
+
 2005-02-23 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
        * ospfd.h: Add new field struct stream *ibuf to struct ospf.
index 13302dd3de2757fcada548c91faa223a40fe5771..203c4a5e6943309a5558e834133466b7b654abf4 100644 (file)
@@ -3673,10 +3673,13 @@ ospf_lsa_refresh_walker (struct thread *t)
   
   i = ospf->lsa_refresh_queue.index;
   
+  /* Note: if clock has jumped backwards, then time change could be negative,
+     so we are careful to cast the expression to unsigned before taking
+     modulus. */
   ospf->lsa_refresh_queue.index =
-    (ospf->lsa_refresh_queue.index +
-     (time (NULL) - ospf->lsa_refresher_started) / OSPF_LSA_REFRESHER_GRANULARITY)
-    % OSPF_LSA_REFRESHER_SLOTS;
+   ((unsigned long)(ospf->lsa_refresh_queue.index +
+                   (time (NULL) - ospf->lsa_refresher_started) /
+                   OSPF_LSA_REFRESHER_GRANULARITY)) % OSPF_LSA_REFRESHER_SLOTS;
 
   if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
     zlog_debug ("LSA[Refresh]: ospf_lsa_refresh_walker(): next index %d",