From 774f149959030b66faca7a97dfb4d1703a84e0d7 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Thu, 25 Nov 1999 12:01:45 +0000 Subject: [PATCH] Fix timeouts. Triggered updates are not done, yet. --- nest/route.h | 1 + proto/rip/rip.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nest/route.h b/nest/route.h index e79affbd..c2b21d13 100644 --- a/nest/route.h +++ b/nest/route.h @@ -139,6 +139,7 @@ typedef struct rte { 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 */ } rip; #endif #ifdef CONFIG_OSPF diff --git a/proto/rip/rip.c b/proto/rip/rip.c index de0ae828..2890f61e 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -8,7 +8,7 @@ FIXME: IpV6 support: packet size FIXME: IpV6 support: use right address for broadcasts FIXME: IpV6 support: receive "route using" blocks - FIXME: Do we send "triggered updates" correctly? + FIXME: Do we send "triggered updates" correctly? No. FIXME: When route's metric changes to 16, start garbage collection immediately? Do _not_ restart on new updates with metric == 16. FIXME: When route's 60 seconds old and we get same metric, use that! FIXME: Triggered updates. When triggered update was sent, don't send new one for something between 1 and 5 seconds (and send one after that). @@ -408,12 +408,12 @@ rip_timer(timer *t) rte = SKIP_BACK( struct rte, u.rip.garbage, e ); DBG( "Garbage: " ); rte_dump( rte ); - if (now - rte->lastmod > P_CF->timeout_time) { + if (now - rte->u.rip.lastmodX > P_CF->timeout_time) { debug( "RIP: entry is too old: " ); rte_dump( rte ); e->metric = P_CF->infinity; } - if (now - rte->lastmod > P_CF->garbage_time) { + if (now - rte->u.rip.lastmodX > P_CF->garbage_time) { debug( "RIP: entry is much too old: " ); rte_dump( rte ); rte_discard(p->table, rte); } @@ -694,8 +694,13 @@ rip_rte_better(struct rte *new, struct rte *old) if (old->u.rip.metric > new->u.rip.metric) return 1; + if (new->u.rip.metric == 16) { + struct proto *p = new->attrs->proto; + new->u.rip.lastmodX = now - P_CF->timeout_time; /* Check this: if new metric is 16, act as it was timed out */ + } + if ((old->u.rip.metric == new->u.rip.metric) && - ((now - old->lastmod) > 60)) /* FIXME (nonurgent): this probably should be P_CF->timeout_time / 2 if old->attrs->proto == new->attrs->proto, else don't do this check */ + ((now - old->u.rip.lastmodX) > 60)) /* FIXME (nonurgent): this probably should be P_CF->timeout_time / 2 if old->attrs->proto == new->attrs->proto, else don't do this check */ return 1; return 0; @@ -705,6 +710,7 @@ static void rip_rte_insert(net *net, rte *rte) { struct proto *p = rte->attrs->proto; + rte->u.rip.lastmodX = now; add_head( &P->garbage, &rte->u.rip.garbage ); }