]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
After contemplating about RIP route timeouts for a long time, I've implemented
authorMartin Mares <mj@ucw.cz>
Sun, 18 Oct 1998 11:13:16 +0000 (11:13 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 18 Oct 1998 11:13:16 +0000 (11:13 +0000)
protocol callbacks for route insertion and deletion from the central table.
RIP should maintain its own per-protocol queue of existing routes, scan it
periodically and call rte_discard() for routes that have timed out.

nest/protocol.h
nest/route.h
nest/rt-table.c

index ec4408fde434e4e8e12596c366104b2338d8824d..6059f7c26e1bbe72b165e99a5dc023e335a87193 100644 (file)
@@ -58,7 +58,6 @@ struct proto {
   unsigned debug;                      /* Debugging flags */
   pool *pool;                          /* Local objects */
   unsigned preference;                 /* Default route preference */
-  int ready;                           /* Already initialized */
 
   void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old);
   void (*rt_notify)(struct proto *, struct network *net, struct rte *new, struct rte *old);
@@ -69,6 +68,8 @@ struct proto {
 
   int (*rta_same)(struct rtattr *, struct rtattr *);
   int (*rte_better)(struct rte *, struct rte *);
+  int (*rte_insert)(struct network *, struct rte *);
+  int (*rte_remove)(struct network *, struct rte *);
 
   /* Reconfigure function? */
   /* Interface patterns */
index 1bd20b634a27f2cc274724c2b04e291c9bbe0e27..e50de07d380c20a542a7474b47b9718921d6c4cb 100644 (file)
@@ -123,6 +123,7 @@ net *net_get(rtable *tab, unsigned tos, ip_addr addr, unsigned len);
 rte *rte_find(net *net, struct proto *p);
 rte *rte_get_temp(struct rtattr *);
 void rte_update(net *net, struct proto *p, rte *new);
+void rte_discard(net *net, rte *old);
 void rte_dump(net *, rte *);
 void rt_dump(rtable *);
 void rt_dump_all(void);
index e04d599066578169d777642ba7273899a5e15003..0b8b7934d14e9dd122eefa1443735895dee49108 100644 (file)
@@ -198,8 +198,20 @@ rte_update(net *net, struct proto *p, rte *new)
        }
     }
   if (old)
-    rte_free(old);
+    {
+      if (p->rte_remove)
+       p->rte_remove(net, old);
+      rte_free(old);
+    }
   new->lastmod = now;
+  if (p->rte_insert)
+    p->rte_insert(net, new);
+}
+
+void
+rte_discard(net *net, rte *old)                /* Non-filtered route deletion, used during garbage collection */
+{
+  rte_update(net, old->attrs->proto, NULL);
 }
 
 void