ports/78524: net/quagga: defence for time goes backwards

Dmitry Morozovsky marck at FreeBSD.org
Mon Mar 7 09:40:03 UTC 2005


>Number:         78524
>Category:       ports
>Synopsis:       net/quagga: defence for time goes backwards
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 07 09:40:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Morozovsky
>Release:        FreeBSD 4-STABLE i386
>Organization:
Cronyx Plus LLC (RiNet ISP)
>Environment:
System: FreeBSD 4-STABLE; FreeBSD/i386 and /amd64 5.4-PRERELEASE


>Description:

This PR is analogous to ports/78302 for zebra: when system time goes backwards
for some reasone, it's possible for LSA refresher to enter nearly endless loop,
blocking router from updates and effectively disconnecting from peers.

>How-To-Repeat:

Non-deterministic, but mostly working example:
run quagga's ospfd, slide time backwards. watch for adjacency goes down on other
OSPF router.

>Fix:

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net/quagga/Makefile,v
retrieving revision 1.25
diff -u -r1.25 Makefile
--- Makefile	7 Feb 2005 10:39:44 -0000	1.25
+++ Makefile	7 Mar 2005 09:33:54 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	quagga
 PORTVERSION=	0.98.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net ipv6
 MASTER_SITES=	http://quagga.net/download/
 
Index: files/patch-ospfd_ospf_lsa.c
===================================================================
RCS file: files/patch-ospfd_ospf_lsa.c
diff -N files/patch-ospfd_ospf_lsa.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-ospfd_ospf_lsa.c	7 Mar 2005 09:33:54 -0000
@@ -0,0 +1,37 @@
+--- ospfd/ospf_lsa.c.orig	Wed Dec 22 19:16:02 2004
++++ ospfd/ospf_lsa.c	Mon Mar  7 12:24:04 2005
+@@ -3665,6 +3665,7 @@
+   struct listnode *node;
+   struct ospf *ospf = THREAD_ARG (t);
+   int i;
++  time_t ct;
+   struct list *lsa_to_refresh = list_new ();
+ 
+   if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
+@@ -3672,15 +3673,25 @@
+ 
+   
+   i = ospf->lsa_refresh_queue.index;
++
++  if ((ct = time(NULL)) < ospf->lsa_refresher_started) {
++    zlog_debug ("LSA[Refresh]: ospf_lsa_refresh_walker(): HACK: fixing lsa_refresher_started: %d -> %d", ospf->lsa_refresher_started, ct);
++    ospf->lsa_refresher_started = ct;
++  }
+   
+   ospf->lsa_refresh_queue.index =
+     (ospf->lsa_refresh_queue.index +
+-     (time (NULL) - ospf->lsa_refresher_started) / OSPF_LSA_REFRESHER_GRANULARITY)
++     (ct - 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",
+ 	       ospf->lsa_refresh_queue.index);
++
++  if (ospf->lsa_refresh_queue.index >= OSPF_LSA_REFRESHER_SLOTS) {
++    zlog_debug ("LSA[Refresh]: ospf_lsa_refresh_walker(): HACK: fixing index: %hu -> 0", ospf->lsa_refresh_queue.index);
++    ospf->lsa_refresh_queue.index = 0;
++  }
+ 
+   for (;i != ospf->lsa_refresh_queue.index;
+        i = (i + 1) % OSPF_LSA_REFRESHER_SLOTS)

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list