Another RIP problem...

Martin Mares mj at suse.cz
Wed Jun 21 23:48:04 CEST 2000


Hello!

> It is a bug. Fix is to use lastmod timer instead (in all places but
> assignments; remove assignments). I'll commit fix to cvs in short time.

Here it is as a patch (warning, a reverse one!).

				Have a nice fortnight
-- 
Martin `MJ' Mares <mj at ucw.cz> <mj at suse.cz> http://atrey.karlin.mff.cuni.cz/~mj/
"If at first you don't succeed, you must be using Windows ..."



diff -u -r1.66 -r1.65
--- nest/route.h	2000/06/21 19:40:46	1.66
+++ nest/route.h	2000/06/02 12:29:24	1.65
@@ -157,6 +157,7 @@
       node garbage;			/* List for garbage collection */
       byte metric;			/* RIP metric */
       u16 tag;				/* External route tag */
+      bird_clock_t lastmodX;		/* Strange kind of last modification time */
       struct rip_entry *entry;
     } rip;
 #endif
diff -u -r1.132 -r1.131
--- proto/rip/rip.c	2000/06/21 19:40:46	1.132
+++ proto/rip/rip.c	2000/06/07 14:06:37	1.131
@@ -522,7 +522,7 @@
     DBG( "Garbage: (%p)", rte ); rte_dump( rte );
 #endif
 
-    if (now - rte->lastmod > P_CF->timeout_time) {
+    if (now - rte->u.rip.lastmodX > P_CF->timeout_time) {
       TRACE(D_EVENTS, "entry is too old: %I", rte->net->n.prefix );
       if (rte->u.rip.entry) {
 	rte->u.rip.entry->metric = P_CF->infinity;
@@ -530,7 +530,7 @@
       }
     }
 
-    if (now - rte->lastmod > P_CF->garbage_time) {
+    if (now - rte->u.rip.lastmodX > P_CF->garbage_time) {
       TRACE(D_EVENTS, "entry is much too old: %I", rte->net->n.prefix );
       rte_discard(p->table, rte);
     }
@@ -900,9 +900,13 @@
   if (old->u.rip.metric > new->u.rip.metric)
     return 1;
 
+  if ((old->u.rip.metric < 16) && (new->u.rip.metric == P_CF->infinity)) {
+    new->u.rip.lastmodX = now - P_CF->timeout_time;	/* Check this: if new metric is 16, act as it was timed out */
+  }
+
   if (old->attrs->proto == new->attrs->proto)		/* This does not make much sense for different protocols */
     if ((old->u.rip.metric == new->u.rip.metric) &&
-	((now - old->lastmod) > (P_CF->timeout_time / 2)))
+	((now - old->u.rip.lastmodX) > (P_CF->timeout_time / 2)))
       return 1;
 
   return 0;
@@ -919,6 +923,7 @@
   struct proto *p = rte->attrs->proto;
   CHK_MAGIC;
   DBG( "rip_rte_insert: %p\n", rte );
+  rte->u.rip.lastmodX = now;
   add_head( &P->garbage, &rte->u.rip.garbage );
 }
 



More information about the Bird-users mailing list